├── .github └── workflows │ └── main.yml ├── .gitignore ├── COPYING ├── README.md ├── build-aux └── meson │ └── postinstall.py ├── com.github.hezral.inspektor.yml ├── data ├── action.gif ├── application.css ├── com.github.hezral.inspektor.appdata.xml.in ├── com.github.hezral.inspektor.contract.in ├── com.github.hezral.inspektor.desktop.in ├── com.github.hezral.inspektor.gschema.xml ├── icons │ ├── 128.svg │ ├── 16.svg │ ├── 24.svg │ ├── 32.svg │ ├── 48.svg │ └── 64.svg ├── meson.build ├── screenshot-01.png ├── screenshot-02.png ├── screenshot-03.png ├── screenshot-04.png └── screenshot-05.png ├── debian ├── changelog ├── compat ├── control ├── copyright ├── rules └── source │ └── format ├── meson.build ├── po ├── LINGUAS ├── POTFILES └── meson.build └── src ├── __init__.py ├── base_view.py ├── constants.py ├── drop_view.py ├── file_inspeck.py ├── inspektor.in ├── main.py ├── meson.build ├── mode_switch.py ├── playaudio.py ├── playvideo.py ├── utils.py ├── waveform.py └── window.py /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | # This workflow will run for any pull request or pushed commit 4 | on: [push, pull_request] 5 | 6 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 7 | jobs: 8 | # This workflow contains a single job called "flatpak" 9 | flatpak: 10 | # The type of runner that the job will run on 11 | runs-on: ubuntu-latest 12 | 13 | # This job runs in a special container designed for building Flatpaks for AppCenter 14 | container: 15 | image: ghcr.io/elementary/flatpak-platform/runtime:6 16 | options: --privileged 17 | 18 | # Steps represent a sequence of tasks that will be executed as part of the job 19 | steps: 20 | # Checks-out your repository under $GITHUB_WORKSPACE, so the job can access it 21 | - uses: actions/checkout@v2 22 | 23 | # Builds your flatpak manifest using the Flatpak Builder action 24 | - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 25 | with: 26 | # This is the name of the Bundle file we're building and can be anything you like 27 | bundle: inspektor.flatpak 28 | # This uses your app's RDNN ID 29 | manifest-path: com.github.hezral.inspektor.yml 30 | 31 | # You can automatically run any of the tests you've created as part of this workflow 32 | run-tests: false 33 | 34 | # These lines specify the location of the elementary Runtime and Sdk 35 | repository-name: appcenter 36 | repository-url: https://flatpak.elementary.io/repo.flatpakrepo 37 | cache-key: "flatpak-builder-${{ github.sha }}" 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # Distribution / packaging 7 | .Python 8 | build/ 9 | develop-eggs/ 10 | dist/ 11 | downloads/ 12 | eggs/ 13 | .eggs/ 14 | lib/ 15 | lib64/ 16 | parts/ 17 | sdist/ 18 | var/ 19 | wheels/ 20 | *.egg-info/ 21 | .installed.cfg 22 | *.egg 23 | MANIFEST 24 | 25 | # Environments 26 | .env 27 | .venv 28 | env/ 29 | venv/ 30 | ENV/ 31 | env.bak/ 32 | venv.bak/ 33 | 34 | *.mp4 35 | *.mkv 36 | *.mp3 37 | *.avi 38 | *.jpeg 39 | *.heic 40 | *.mov 41 | 42 | # Flatpak 43 | .flatpak/ 44 | .flatpak-builder/ 45 | build-dir/ 46 | 47 | # VSCode 48 | .vscode/ 49 | 50 | .github/ -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | ![icon](data/icons/128.svg) 4 | 5 | 6 | [![Get it on AppCenter](https://appcenter.elementary.io/badge.svg)](https://appcenter.elementary.io/com.github.hezral.inspektor) 7 | 8 | Buy Me A Coffee 9 |
10 | 11 | ### Inspektor helps your to view file metadata easily in a window and export it to JSON, CSV or Text file format. 12 | 13 | | ![Screenshot 01](data/screenshot-01.png?raw=true) | ![Screenshot 02](data/screenshot-02.png?raw=true) | ![Screenshot 03](data/screenshot-03.png?raw=true) | 14 | |------------------------------------------|-----------------------------------------|-----------------------------------------| 15 | 16 | | ![Screenshot 03](data/screenshot-04.png?raw=true) | ![Screenshot 03](data/screenshot-05.png?raw=true) | 17 | |------------------------------------------|-----------------------------------------| 18 | 19 | ## Installation 20 | 21 | ## Build using flatpak 22 | * requires that you have flatpak-builder installed 23 | * flatpak enabled 24 | * flathub remote enabled 25 | 26 | ``` 27 | flatpak-builder --user --force-clean --install build-dir com.github.hezral.inspektor.yml 28 | ``` 29 | 30 | ### Build using meson 31 | Ensure you have these dependencies installed 32 | 33 | * python3 34 | * python3-gi 35 | * libgranite-dev 36 | * python3 37 | * libgtk-3-dev 38 | * libimage-exiftool-perl 39 | * attr 40 | 41 | Download the updated source [here](https://github.com/hezral/inspektor/archive/master.zip), or use git: 42 | ```bash 43 | git clone https://github.com/hezral/inspektor.git 44 | cd inspektor 45 | meson build --prefix=/usr 46 | cd build 47 | ninja build 48 | sudo ninja install 49 | ``` 50 | The desktop launcher should show up on the application launcher for your desktop environment 51 | if it doesn't, try running 52 | ``` 53 | com.github.hezral.inspektor 54 | ``` 55 | 56 | ## Thanks/Credits 57 | - [ExifTool by Phil Harvey](https://exiftool.org/) Won't work without it. 58 | - [Extended File Attribues in Linux](https://www.linuxtoday.com/blog/extended-file-attributes-rock.html) Gave me the idea. 59 | - [ElementaryPython](https://github.com/mirkobrombin/ElementaryPython) This started me off on coding with Python and GTK. 60 | -------------------------------------------------------------------------------- /build-aux/meson/postinstall.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from os import environ, path 4 | from subprocess import call 5 | 6 | prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local') 7 | datadir = path.join(prefix, 'share') 8 | destdir = environ.get('DESTDIR', '') 9 | 10 | # Package managers set this so we don't need to run 11 | if not destdir: 12 | print('Updating icon cache...') 13 | call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')]) 14 | 15 | print('Updating desktop database...') 16 | call(['update-desktop-database', '-q', path.join(datadir, 'applications')]) 17 | 18 | print('Compiling GSettings schemas...') 19 | call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')]) 20 | 21 | 22 | -------------------------------------------------------------------------------- /com.github.hezral.inspektor.yml: -------------------------------------------------------------------------------- 1 | app-id: com.github.hezral.inspektor 2 | runtime: io.elementary.Platform 3 | runtime-version: '6' 4 | sdk: io.elementary.Sdk 5 | command: com.github.hezral.inspektor 6 | finish-args: 7 | - --socket=wayland 8 | - --socket=fallback-x11 9 | - --socket=pulseaudio 10 | # access home diectory for inspecting files 11 | - --filesystem=home 12 | modules: 13 | 14 | - name: exiftool 15 | modules: 16 | - name: exiftool 17 | buildsystem: simple 18 | build-commands: 19 | - perl Makefile.PL 20 | - make install 21 | cleanup: 22 | - '*.pod' 23 | sources: 24 | - type: git 25 | url: https://github.com/exiftool/exiftool.git 26 | tag: '12.30' 27 | commit: 57f44297961839f40e70d682865c41828b7f71b5 28 | modules: 29 | - name: perl 30 | buildsystem: simple 31 | build-commands: 32 | - ./Configure -des -Dprefix=$FLATPAK_DEST -Dman1dir=none -Dman3dir=none 33 | - make 34 | - make install 35 | post-install: 36 | # Fix wrong permissions 37 | - chmod -R u+w $FLATPAK_DEST/lib/perl5 38 | cleanup: 39 | - /bin/corelist 40 | - /bin/cpan 41 | - /bin/enc2xs 42 | - /bin/encguess 43 | - /bin/h2ph 44 | - /bin/h2xs 45 | - /bin/instmodsh 46 | - /bin/json_pp 47 | - /bin/libnetcfg 48 | - /bin/perl5* 49 | - /bin/perlbug 50 | - /bin/perldoc 51 | - /bin/perlivp 52 | - /bin/perlthanks 53 | - /bin/piconv 54 | - /bin/pl2pm 55 | - /bin/pod2html 56 | - /bin/pod2man 57 | - /bin/pod2text 58 | - /bin/pod2usage 59 | - /bin/podchecker 60 | - /bin/prove 61 | - /bin/ptar 62 | - /bin/ptardiff 63 | - /bin/ptargrep 64 | - /bin/shasum 65 | - /bin/splain 66 | - /bin/streamzip 67 | - /bin/xsubpp 68 | - /bin/zipdetails 69 | - '*.pod' 70 | sources: 71 | - type: git 72 | url: https://github.com/Perl/perl5.git 73 | tag: v5.34.0 74 | commit: 79a7b254d85a10b65126ad99bf10e70480569d68 75 | 76 | - name: attr 77 | sources: 78 | - type: git 79 | url: https://git.savannah.nongnu.org/git/attr.git 80 | 81 | - name: opencv-python 82 | buildsystem: simple 83 | build-options: 84 | build-args: 85 | - --share=network 86 | build-commands: 87 | - "pip3 install --prefix=${FLATPAK_DEST} opencv-python" 88 | 89 | - name: inspektor 90 | buildsystem: meson 91 | sources: 92 | - type: dir 93 | path: . -------------------------------------------------------------------------------- /data/action.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hezral/inspektor/08eb92982b4477d05a48fe04763ebb2b9f246c32/data/action.gif -------------------------------------------------------------------------------- /data/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | # Copyright 2020 Adi Hezral (hezral@gmail.com) (https://github.com/hezral) 3 | # 4 | # This file is part of QuickWord ("Application"). 5 | # 6 | # The Application is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # The Application is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this Application. If not, see . 18 | */ 19 | 20 | /* -- colors -- */ 21 | /* ------------------------------ */ 22 | @define-color shaded_dark shade(@theme_base_color, 0.95); 23 | @define-color shaded_darker shade(@theme_base_color, 0.85); 24 | @define-color shaded_base shade(@theme_base_color, 0.98); 25 | @define-color popup shade(@theme_base_color, 0.98); 26 | 27 | 28 | scrolledwindow > undershoot.top { 29 | background-blend-mode: normal; 30 | background-clip: border-box; 31 | background-color: rgba(0,0,0,0); 32 | background-image: linear-gradient(@theme_bg_color 0, alpha(@theme_bg_color, 0) 50%); 33 | background-origin: padding-box; 34 | background-position: left top; 35 | background-repeat: repeat; 36 | background-size: auto; 37 | } 38 | 39 | scrolledwindow > undershoot.bottom { 40 | background-blend-mode: normal; 41 | background-clip: border-box; 42 | background-color: rgba(0,0,0,0); 43 | background-image: linear-gradient(alpha(@theme_bg_color, 0) 50%, @theme_bg_color 100%); 44 | background-origin: padding-box; 45 | background-position: left top; 46 | background-repeat: repeat; 47 | background-size: auto; 48 | } 49 | 50 | expander arrow { 51 | padding-right: 4px; 52 | } 53 | 54 | textview { 55 | border-radius: 3px; 56 | padding: 6px; 57 | } 58 | 59 | scrolledwindow { 60 | border-radius: 3px; 61 | border-style: solid; 62 | border-color: rgba(0,0,0,0.3); 63 | border-width: 1px; 64 | background-clip: padding-box; 65 | box-shadow: 0 1px rgba(255,255,255,0.06), 0 1px 1px rgba(0,0,0,0.5) inset, 0 0 1px 1px rgba(0,0,0,0.05) inset; 66 | } 67 | 68 | label#drop { 69 | font-size: 125%; 70 | font-weight: bold; 71 | color: alpha(@theme_text_color, 0.5); 72 | } 73 | 74 | @keyframes crossfader { 75 | 0% { opacity: 0; } 76 | 03.33% { opacity: 0; } 77 | 06.66% { opacity: 0; } 78 | 09.99% { opacity: 0; } 79 | 13.33% { opacity: 0; } 80 | 16.65% { opacity: 0.75; } 81 | 100% { opacity: 1; } 82 | } 83 | 84 | 85 | expander > * { 86 | animation: crossfader 0.5s ease-in-out forwards; 87 | } 88 | 89 | .checkerboard { 90 | background-image: 91 | linear-gradient(45deg, rgba(0,0,0,0.1) 25%, transparent 25%), 92 | linear-gradient(135deg, rgba(0,0,0,0.1) 25%, transparent 25%), 93 | linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.1) 75%), 94 | linear-gradient(135deg, transparent 75%, rgba(0,0,0,0.1) 75%); 95 | background-size:24px 24px; /* Must be a square */ 96 | background-position:0 0, 12px 0, 12px -12px, 0px 12px; /* Must be half of one side of the square */ 97 | } 98 | 99 | .dropshadow { 100 | /* border-radius: 5px; */ 101 | border-style: solid; 102 | border-width: 1px; 103 | border-color: rgba(0,0,0,0.1); 104 | background-color: transparent; 105 | animation: crossfader 0.25s ease-in-out forwards; 106 | box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 13px 16px 4px rgba(0,0,0,0), 0 3px 4px rgba(0,0,0,0.25), 0 3px 3px -3px rgba(0,0,0,0.45); 107 | } 108 | 109 | @keyframes pulsing { 110 | 25% {opacity: 0.25;} 111 | 75% {opacity: 0.75;} 112 | 100% {opacity: 1.00;} 113 | } 114 | 115 | .play-pause-shadow { 116 | background-color: rgba(0,0,0,0.25); 117 | border-radius: 16px; 118 | } 119 | 120 | .icon-dropshadow { 121 | -gtk-icon-shadow: 0 2px 12px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.7); 122 | } 123 | 124 | .copied-widget { 125 | background-color: rgba(0, 0, 0, 0.8); 126 | border-radius: 3px; 127 | padding-left: 6px; 128 | padding-right: 6px; 129 | padding-top: 1px; 130 | padding-bottom: 1px; 131 | } -------------------------------------------------------------------------------- /data/com.github.hezral.inspektor.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.github.hezral.inspektor 5 | CC0 6 | GPL-3.0+ 7 | Inspektor 8 | View file metadata information 9 | Adi Hezral 10 | 11 |

View file metadata information

12 |
    13 |
  • Supported file metadata by ExifTool
  • 14 |
  • Supports adding file comments, provided the filesystem supports it
  • 15 |
16 |
17 | 18 | 19 | com.github.hezral.inspektor 20 | 21 | 22 | https://github.com/hezral/inspektor 23 | https://github.com/hezral/inspektor/issues 24 | https://github.com/hezral/inspektor/issues/labels/bug 25 | 26 | 27 | 28 | Basic file information and file comments view 29 | https://github.com/hezral/inspektor/blob/master/data/screenshot-01.png?raw=true 30 | 31 | 32 | Extended file information view 33 | https://github.com/hezral/inspektor/blob/master/data/screenshot-02.png?raw=true 34 | 35 | 36 | Preview images, video thumbnail and animated gifs 37 | https://github.com/hezral/inspektor/blob/master/data/screenshot-03.png?raw=true 38 | 39 | 40 | Export file information to JSON, CSV or Text file format 41 | https://github.com/hezral/inspektor/blob/master/data/screenshot-04.png?raw=true 42 | 43 | 44 | Copy lines to clipboard 45 | https://github.com/hezral/inspektor/blob/master/data/screenshot-05.png?raw=true 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |

Fixed issue with dragn and drop

55 |
56 |
57 |
58 | 59 | 60 | #B7E1E5 61 | #29484F 62 | 2.00 63 | pk_live_51HUnWtAIOwvlC6vL2CzkJLIag2jOPmncxxnkjukyaHhdQrvgtVz11ji7g0eCofbf84QK7wksSEKCCmrIt0AMM8jZ00cVKp27Ih 64 | 65 | 66 |
67 | -------------------------------------------------------------------------------- /data/com.github.hezral.inspektor.contract.in: -------------------------------------------------------------------------------- 1 | [Contractor Entry] 2 | Name=Inspektor 3 | Description=View additional metadata for files 4 | MimeType=!archive;inode/blockdevice;inode/chardevice;inode/fifo;inode/socket; 5 | Icon=com.github.hezral.inspektor 6 | Exec=com.github.hezral.inspektor %F 7 | -------------------------------------------------------------------------------- /data/com.github.hezral.inspektor.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Inspektor 3 | Exec=com.github.hezral.inspektor %f 4 | Icon=com.github.hezral.inspektor 5 | Terminal=false 6 | Type=Application 7 | Categories=Office;Utility;Viewer; 8 | StartupNotify=true 9 | Comment=View additional metadata for files 10 | -------------------------------------------------------------------------------- /data/com.github.hezral.inspektor.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /data/icons/128.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /data/icons/16.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /data/icons/24.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /data/icons/32.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /data/icons/48.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /data/icons/64.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | desktop_file = i18n.merge_file( 2 | input: 'com.github.hezral.inspektor.desktop.in', 3 | output: 'com.github.hezral.inspektor.desktop', 4 | type: 'desktop', 5 | po_dir: '../po', 6 | install: true, 7 | install_dir: join_paths(get_option('datadir'), 'applications') 8 | ) 9 | 10 | desktop_utils = find_program('desktop-file-validate', required: false) 11 | if desktop_utils.found() 12 | test('Validate desktop file', desktop_utils, 13 | args: [desktop_file] 14 | ) 15 | endif 16 | 17 | appstream_file = i18n.merge_file( 18 | input: 'com.github.hezral.inspektor.appdata.xml.in', 19 | output: 'com.github.hezral.inspektor.appdata.xml', 20 | po_dir: '../po', 21 | install: true, 22 | install_dir: join_paths(get_option('datadir'), 'metainfo') 23 | ) 24 | 25 | appstream_util = find_program('appstream-util', required: false) 26 | if appstream_util.found() 27 | test('Validate appstream file', appstream_util, 28 | args: ['validate', appstream_file] 29 | ) 30 | endif 31 | 32 | install_data('com.github.hezral.inspektor.gschema.xml', 33 | install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') 34 | ) 35 | 36 | compile_schemas = find_program('glib-compile-schemas', required: false) 37 | if compile_schemas.found() 38 | test('Validate schema file', compile_schemas, 39 | args: ['--strict', '--dry-run', meson.current_source_dir()] 40 | ) 41 | endif 42 | 43 | install_data('application.css', 44 | install_dir: join_paths(pkgdatadir, project_short_name, 'data') 45 | ) 46 | 47 | icon_sizes = ['16', '24', '32', '48', '64', '128'] 48 | foreach i : icon_sizes 49 | install_data( 50 | join_paths('icons', i + '.svg'), 51 | rename: meson.project_name() + '.svg', 52 | install_dir: join_paths(get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps') 53 | ) 54 | install_data( 55 | join_paths('icons', i + '.svg'), 56 | rename: meson.project_name() + '.svg', 57 | install_dir: join_paths(get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i + '@2', 'apps') 58 | ) 59 | endforeach -------------------------------------------------------------------------------- /data/screenshot-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hezral/inspektor/08eb92982b4477d05a48fe04763ebb2b9f246c32/data/screenshot-01.png -------------------------------------------------------------------------------- /data/screenshot-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hezral/inspektor/08eb92982b4477d05a48fe04763ebb2b9f246c32/data/screenshot-02.png -------------------------------------------------------------------------------- /data/screenshot-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hezral/inspektor/08eb92982b4477d05a48fe04763ebb2b9f246c32/data/screenshot-03.png -------------------------------------------------------------------------------- /data/screenshot-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hezral/inspektor/08eb92982b4477d05a48fe04763ebb2b9f246c32/data/screenshot-04.png -------------------------------------------------------------------------------- /data/screenshot-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hezral/inspektor/08eb92982b4477d05a48fe04763ebb2b9f246c32/data/screenshot-05.png -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | com.github.hezral.inspektor (2.0.4) precise; urgency=low 2 | 3 | * Fixed issue with drag and drop 4 | 5 | -- Adi Hezral Tue, 1 Dec 2021 00:00:00 +0800 6 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: com.github.hezral.inspektor 2 | Section: utils 3 | Priority: optional 4 | Maintainer: Adi Hezral 5 | Build-Depends: debhelper (>= 10), 6 | dh-python, 7 | python3 8 | X-Python3-Version: >= 3.6.9 9 | Standards-Version: 3.9.3 10 | 11 | Package: com.github.hezral.inspektor 12 | Architecture: any 13 | Depends: ${python3:Depends}, 14 | ${misc:Depends}, 15 | python3, 16 | python3-gi, 17 | libimage-exiftool-perl, 18 | attr 19 | Description: Inspektor 20 | View file metadata information 21 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://dep.debian.net/deps/dep5 2 | Upstream-Name: inspektor 3 | Source: https://github.com/hezral/inspektor 4 | 5 | Files: * 6 | Copyright: 2017 Adi Hezral 7 | License: GPL-3.0+ 8 | 9 | License: GPL-3.0+ 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | . 15 | This package is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | . 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | . 23 | On Debian systems, the complete text of the GNU General 24 | Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". 25 | 26 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | %: 13 | dh $@ --with python3 --buildsystem=pybuild 14 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('com.github.hezral.inspektor', 2 | version: '2.0.4', 3 | meson_version: '>= 0.50.0', 4 | default_options: [ 'warning_level=2', 5 | ], 6 | ) 7 | 8 | i18n = import('i18n') 9 | 10 | pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) 11 | rdnn = meson.project_name().split('.') 12 | project_domain = '.'.join([rdnn[0],rdnn[1],rdnn[2]]) 13 | project_short_name = rdnn[3] 14 | moduledir = join_paths(pkgdatadir, 'inspektor') 15 | 16 | 17 | subdir('data') 18 | subdir('src') 19 | subdir('po') 20 | 21 | meson.add_install_script('build-aux/meson/postinstall.py') 22 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hezral/inspektor/08eb92982b4477d05a48fe04763ebb2b9f246c32/po/LINGUAS -------------------------------------------------------------------------------- /po/POTFILES: -------------------------------------------------------------------------------- 1 | data/com.github.hezral.inspektor.desktop.in 2 | data/com.github.hezral.inspektor.contract.in 3 | data/com.github.hezral.inspektor.appdata.xml.in 4 | data/com.github.hezral.inspektor.gschema.xml 5 | src/window.ui 6 | src/main.py 7 | src/window.py 8 | src/base_view.py 9 | src/constants.py 10 | src/drop_view.py 11 | src/file_inspeck.py 12 | src/playaudio.py 13 | src/playvideo.py 14 | src/utils.py 15 | src/waveform.py -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | i18n.gettext('inspektor', preset: 'glib') 2 | -------------------------------------------------------------------------------- /src/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hezral/inspektor/08eb92982b4477d05a48fe04763ebb2b9f246c32/src/__init__.py -------------------------------------------------------------------------------- /src/base_view.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | # SPDX-FileCopyrightText: 2021 Adi Hezral 3 | 4 | import gi 5 | gi.require_version('Gtk', '3.0') 6 | from gi.repository import Gtk, GLib, Pango 7 | 8 | class BaseView(Gtk.Grid): 9 | 10 | def __init__(self, app, *args, **kwargs): 11 | super().__init__(*args, **kwargs) 12 | 13 | self.app = app 14 | 15 | self.props.halign = Gtk.Align.FILL 16 | self.props.valign = Gtk.Align.START 17 | self.props.expand = True 18 | self.props.column_spacing = 6 19 | self.props.row_spacing = 6 20 | self.props.margin_bottom = 10 21 | 22 | self.attach(self.generate_comments_section(), 0, 0, 1, 1) 23 | self.attach(Gtk.Separator(), 0, 1, 1, 1) 24 | self.attach(self.generate_base_info(), 0, 2, 1, 1) 25 | self.attach(Gtk.Separator(), 0, 3, 1, 1) 26 | self.attach(self.generate_extended_info(), 0, 4, 1, 1) 27 | self.attach(Gtk.Separator(), 0, 5, 1, 1) 28 | self.attach(self.generate_preview(), 0, 6, 1, 1) 29 | self.attach(Gtk.Separator(), 0, 7, 1, 1) 30 | self.attach(self.generate_utils(), 0, 8, 1, 1) 31 | 32 | def on_view_visible(self): 33 | if self.app.inspeck_obj.comments != "": 34 | self.comment_expander.props.expanded = True 35 | self.base_expander.props.expanded = True 36 | 37 | def update_file_comments(self, textview, event): 38 | startIter, endIter = textview.get_buffer().get_bounds() 39 | text = textview.get_buffer().get_text(startIter, endIter, True) 40 | if text != self.app.inspeck_obj.comments: 41 | self.app.utils.set_file_comments(self.app.inspeck_obj.path,text) 42 | self.app.inspeck_obj.comments = text 43 | 44 | def generate_comments_section(self): 45 | self.file_comments = Gtk.TextBuffer() 46 | 47 | comments_textview = Gtk.TextView(buffer=self.file_comments) 48 | comments_textview.props.wrap_mode = Gtk.WrapMode.WORD_CHAR 49 | comments_textview.connect('focus-out-event',self.update_file_comments) 50 | 51 | comments_scrolledview = Gtk.ScrolledWindow() 52 | comments_scrolledview.add(comments_textview) 53 | comments_scrolledview.props.halign = Gtk.Align.FILL 54 | comments_scrolledview.props.valign = Gtk.Align.START 55 | comments_scrolledview.props.vscrollbar_policy = Gtk.PolicyType(1) 56 | comments_scrolledview.props.expand = True 57 | comments_scrolledview.props.margin_top = 6 58 | comments_scrolledview.props.margin_bottom = 6 59 | comments_scrolledview.set_size_request(-1, 60) 60 | 61 | self.comment_expander = Gtk.Expander() 62 | self.comment_expander.props.label = "Comments" 63 | self.comment_expander.props.spacing = 10 64 | self.comment_expander.props.margin_left = 10 65 | self.comment_expander.props.margin_right = 10 66 | self.comment_expander.add(comments_scrolledview) 67 | 68 | return self.comment_expander 69 | 70 | def generate_base_info(self): 71 | self.base_grid = Gtk.Grid() 72 | self.base_grid.props.halign = Gtk.Align.FILL 73 | self.base_grid.props.valign = Gtk.Align.START 74 | self.base_grid.props.expand = True 75 | self.base_grid.props.row_spacing = 6 76 | self.base_grid.props.margin_top = 5 77 | self.base_grid.props.margin_left = 5 78 | self.base_grid.props.margin_right = 5 79 | 80 | self.base_expander = Gtk.Expander() 81 | self.base_expander.props.label = "Base Info" 82 | self.base_expander.props.spacing = 10 83 | self.base_expander.props.margin_left = 10 84 | self.base_expander.props.margin_right = 10 85 | self.base_expander.add(self.base_grid) 86 | 87 | return self.base_expander 88 | 89 | def generate_extended_info(self): 90 | self.extended_grid = Gtk.Grid() 91 | self.extended_grid.props.halign = Gtk.Align.FILL 92 | self.extended_grid.props.valign = Gtk.Align.START 93 | self.extended_grid.props.expand = True 94 | self.extended_grid.props.row_spacing = 4 95 | self.extended_grid.props.margin_top = 5 96 | self.extended_grid.props.margin_left = 5 97 | self.extended_grid.props.margin_right = 5 98 | 99 | self.extended_scrolledwindow = Gtk.ScrolledWindow() 100 | self.extended_scrolledwindow.props.margin_top = 5 101 | self.extended_scrolledwindow.set_size_request(-1, 300) 102 | self.extended_scrolledwindow.add(self.extended_grid) 103 | self.extended_scrolledwindow.set_shadow_type(Gtk.ShadowType.NONE) 104 | 105 | self.extended_expander = Gtk.Expander() 106 | self.extended_expander.props.label = "Extended Info" 107 | self.extended_expander.props.spacing = 20 108 | self.extended_expander.props.margin_left = 10 109 | self.extended_expander.props.margin_right = 10 110 | self.extended_expander.add(self.extended_scrolledwindow) 111 | 112 | return self.extended_expander 113 | 114 | def generate_preview(self): 115 | self.preview_grid = Gtk.Grid() 116 | self.preview_grid.props.halign = Gtk.Align.FILL 117 | self.preview_grid.props.valign = Gtk.Align.START 118 | self.preview_grid.props.expand = True 119 | self.preview_grid.props.row_spacing = 6 120 | self.preview_grid.props.margin_top = 10 121 | self.preview_grid.props.margin_left = 5 122 | self.preview_grid.props.margin_right = 5 123 | 124 | self.preview_expander = Gtk.Expander() 125 | self.preview_expander.props.label = "Preview" 126 | self.preview_expander.props.spacing = 10 127 | self.preview_expander.props.margin_left = 10 128 | self.preview_expander.props.margin_right = 10 129 | self.preview_expander.add(self.preview_grid) 130 | 131 | return self.preview_expander 132 | 133 | def generate_utils(self): 134 | 135 | def generate_export_menu(name, menu_label, icon_name, callback): 136 | image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.LARGE_TOOLBAR) 137 | button = Gtk.Button(label=menu_label,image=image) 138 | button.props.name = name 139 | button.props.always_show_image = True 140 | button.props.image_position = Gtk.PositionType.TOP 141 | button.props.expand = True 142 | button.get_style_context().add_class("flat") 143 | button.connect("clicked", callback) 144 | return button 145 | 146 | self.utils_grid = Gtk.Grid() 147 | self.utils_grid.props.halign = Gtk.Align.FILL 148 | self.utils_grid.props.valign = Gtk.Align.START 149 | self.utils_grid.props.expand = True 150 | self.utils_grid.props.row_spacing = 6 151 | self.utils_grid.props.margin_top = 10 152 | self.utils_grid.props.margin_left = 5 153 | self.utils_grid.props.margin_right = 5 154 | self.utils_grid.attach(generate_export_menu("json", "Export JSON", "text-css", self.on_button_clicked), 0, 0, 1, 1) 155 | self.utils_grid.attach(generate_export_menu("csv", "Export CSV", "application-vnd.ms-excel", self.on_button_clicked), 1, 0, 1, 1) 156 | self.utils_grid.attach(generate_export_menu("txt", "Export TXT", "text-x-generic", self.on_button_clicked), 2, 0, 1, 1) 157 | 158 | self.utils_expander = Gtk.Expander() 159 | self.utils_expander.props.label = "Utilities" 160 | self.utils_expander.props.spacing = 10 161 | self.utils_expander.props.margin_left = 10 162 | self.utils_expander.props.margin_right = 10 163 | self.utils_expander.add(self.utils_grid) 164 | 165 | return self.utils_expander 166 | 167 | def on_button_clicked(self, button): 168 | if button.props.name == "json": 169 | self.app.utils.export_json(self.app.inspeck_obj.path) 170 | if button.props.name == "csv": 171 | self.app.utils.export_csv(self.app.inspeck_obj.path) 172 | if button.props.name == "txt": 173 | self.app.utils.export_txt(self.app.inspeck_obj.path) 174 | 175 | class DataLabel(Gtk.EventBox): 176 | def __init__(self, title, value, app, *args, **kwargs): 177 | super().__init__(*args, **kwargs) 178 | 179 | self.app = app 180 | self.label = title + ': ' + value 181 | 182 | self.data_label = Gtk.Label() 183 | self.data_label.props.halign = Gtk.Align.START 184 | self.data_label.props.expand = True 185 | self.data_label.props.wrap = True 186 | self.data_label.props.selectable = False 187 | self.data_label.props.max_width_chars = 32 188 | self.data_label.props.ellipsize = Pango.EllipsizeMode.END 189 | self.data_label.props.label = self.label 190 | if len(self.label) > 32: 191 | self.data_label.props.has_tooltip = True 192 | self.data_label.props.tooltip_text = self.label 193 | 194 | self.generate_copy_to_clipboard() 195 | 196 | overlay = Gtk.Overlay() 197 | overlay.add(self.data_label) 198 | overlay.add_overlay(self.copy_revealer) 199 | overlay.add_overlay(self.copied_revealer) 200 | 201 | self.set_size_request(-1, 18) 202 | self.props.expand = True 203 | self.add(overlay) 204 | self.show_all() 205 | 206 | self.connect("enter-notify-event", self.on_hover_datalabel_enter) 207 | self.connect("leave-notify-event", self.on_hover_datalabel_leave) 208 | self.connect("button-press-event", self.on_button_pressed) 209 | 210 | def generate_copy_to_clipboard(self): 211 | copy_button = Gtk.Image().new_from_icon_name("edit-copy-symbolic", Gtk.IconSize.SMALL_TOOLBAR) 212 | copy_button.props.halign = Gtk.Align.END 213 | copy_button.get_style_context().add_class("icon-dropshadow") 214 | 215 | self.copy_revealer = Gtk.Revealer() 216 | self.copy_revealer.add(copy_button) 217 | self.copy_revealer.props.transition_type = Gtk.RevealerTransitionType.CROSSFADE 218 | 219 | copied_image = Gtk.Image().new_from_icon_name("process-completed", Gtk.IconSize.SMALL_TOOLBAR) 220 | copied_label = Gtk.Label("copied to clipboard") 221 | copied_grid = Gtk.Grid() 222 | copied_grid.props.column_spacing = 2 223 | copied_grid.props.valign = Gtk.Align.CENTER 224 | copied_grid.attach(copied_image, 0, 0, 1, 1) 225 | copied_grid.attach(copied_label, 1, 0, 1, 1) 226 | copied_grid.props.halign = Gtk.Align.END 227 | copied_grid.get_style_context().add_class("copied-widget") 228 | 229 | self.copied_revealer = Gtk.Revealer() 230 | self.copied_revealer.add(copied_grid) 231 | self.copied_revealer.props.transition_type = Gtk.RevealerTransitionType.CROSSFADE 232 | 233 | def on_hover_datalabel_enter(self, *args): 234 | self.copy_revealer.set_reveal_child(True) 235 | 236 | def on_hover_datalabel_leave(self, *args): 237 | self.copy_revealer.set_reveal_child(False) 238 | 239 | def on_button_pressed(self, eventbox, eventbutton): 240 | if eventbutton.button == 1 and eventbutton.type.value_name == "GDK_BUTTON_PRESS": 241 | if self.app.utils.copy_to_clipboard(self.label): 242 | self.copied_revealer.set_reveal_child(True) 243 | GLib.timeout_add(1000, self.copied_revealer.set_reveal_child, False) 244 | else: 245 | self.copied_revealer.get_child().get_children()[1].props.label = "copy failed" 246 | self.copied_revealer.set_reveal_child(True) 247 | GLib.timeout_add(1000, self.copied_revealer.set_reveal_child, False) -------------------------------------------------------------------------------- /src/constants.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | # SPDX-FileCopyrightText: 2021 Adi Hezral 3 | 4 | import gi 5 | import os 6 | import locale 7 | import gettext 8 | import gi 9 | gi.require_version('Gtk', '3.0') 10 | from gi.repository import Gtk 11 | 12 | class app: 13 | app_name = "inspektor" 14 | app_id = "com.github.hezral.inspektor" 15 | 16 | class data: 17 | basedata = [ 18 | ('FileName','Name'), 19 | ('Directory','Directory'), 20 | ('FileSize','Size'), 21 | ('FileAccessDate','Last Accessed'), 22 | ('FileModifyDate','Content Modified'), 23 | ('FileInodeChangeDate','Properties Changed'), 24 | ('FilePermissions','Permissions'), 25 | ('FileTypeExtension','Extension'), 26 | ('MIMEType','Type') 27 | ] 28 | mindata = [ 29 | ('FileName','Name'), 30 | ('Directory','Directory'), 31 | ('FileSize','Size'), 32 | ('FileModifyDate','Modified'), 33 | ('FileAccessDate','Last Accessed'), 34 | ('FileInodeChangeDate','Changed'), 35 | ('FilePermissions','Permissions') 36 | ] -------------------------------------------------------------------------------- /src/drop_view.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | # SPDX-FileCopyrightText: 2021 Adi Hezral 3 | 4 | import gi 5 | gi.require_version('Gtk', '3.0') 6 | from gi.repository import Gtk, Gdk, GLib, Gio 7 | 8 | class DropView(Gtk.Grid): 9 | 10 | def __init__(self, app, *args, **kwargs): 11 | super().__init__(*args, **kwargs) 12 | 13 | self.app = app 14 | 15 | self.props.halign = Gtk.Align.FILL 16 | self.props.valign = Gtk.Align.FILL 17 | self.props.expand = True 18 | self.props.column_spacing = 6 19 | self.props.row_spacing = 6 20 | self.set_size_request(-1, 200) 21 | 22 | drop_label = Gtk.Label("Drag file here") 23 | drop_label.props.name = "drop" 24 | drop_label.props.expand = True 25 | drop_label.props.valign = Gtk.Align.CENTER 26 | drop_label.props.halign = Gtk.Align.CENTER 27 | 28 | drop_box = Gtk.EventBox() 29 | drop_box.add(drop_label) 30 | 31 | self.attach(drop_box, 0, 0, 1, 1) 32 | 33 | self.drag_and_drop_setup_drop_view(drop_box) 34 | 35 | def drag_and_drop_setup_drop_view(self, widget): 36 | widget.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY) 37 | widget.drag_dest_add_uri_targets() 38 | widget.connect("drag_data_received", self.on_drag_data_received) 39 | 40 | def drag_and_drop_setup_main_window(self, widget): 41 | widget.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY) 42 | widget.drag_dest_add_uri_targets() 43 | widget.connect("drag_motion", self.on_drag_motion) 44 | 45 | def on_drag_motion(self, *args): 46 | self.app.window.stack.set_visible_child_name("drop-view") 47 | self.app.window.show_all() 48 | 49 | def on_drag_end(self, widget, drag_context): 50 | ... 51 | 52 | def on_drag_begin(self, widget, drag_context): 53 | ... 54 | 55 | def on_drag_data_get(self, widget, drag_context, data, info, timestamp): 56 | ... 57 | 58 | def on_drag_data_received(self, widget, context, x, y, data, info, timestamp): 59 | from urllib.parse import urlparse 60 | import os 61 | 62 | uris = data.get_uris() 63 | for uri in uris: 64 | parsed_uri = urlparse(uri) 65 | path, hostname = GLib.filename_from_uri(uri) 66 | if os.path.exists(path): 67 | if os.path.isfile(path): 68 | self.app.file = Gio.File.new_for_uri(uri) 69 | self.app.do_initialize_inspeck_obj(self.app.file) 70 | self.app.window.do_show_window() 71 | self.hide() 72 | 73 | Gtk.drag_finish(context, True, False, timestamp) 74 | -------------------------------------------------------------------------------- /src/file_inspeck.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | # SPDX-FileCopyrightText: 2021 Adi Hezral 3 | 4 | from dataclasses import dataclass, field 5 | from subprocess import call 6 | 7 | import gi 8 | gi.require_version('Gtk', '3.0') 9 | from gi.repository import GdkPixbuf, Gtk, Gio, Gdk, GLib, Pango 10 | 11 | import tempfile 12 | 13 | from .utils import HelperUtils 14 | 15 | import os 16 | 17 | @dataclass 18 | class FileInspeck: 19 | 20 | giofile: Gio.File 21 | name: str = "" 22 | path: str = "" 23 | uri: str = "" 24 | name_label: Gtk.Label = Gtk.Label(name) 25 | icon: Gtk.Image = Gtk.Image.new_from_icon_name("application-octet-stream", Gtk.IconSize.LARGE_TOOLBAR) 26 | metadata: dict = field(default_factory=dict) 27 | comments: str = "" 28 | preview_available: bool = False 29 | preview: Gtk.Image = Gtk.Image.new_from_icon_name("image-generic", Gtk.IconSize.DIALOG) 30 | dimension: Gtk.Label = Gtk.Label() 31 | 32 | def __post_init__(self): 33 | self.name = self.giofile.get_basename() 34 | self.path = self.giofile.get_path() 35 | self.uri = self.giofile.get_uri() 36 | 37 | self.name_label.props.label = self.name 38 | self.name_label.props.max_width_chars = 48 39 | self.name_label.props.ellipsize = Pango.EllipsizeMode.END 40 | self.name_label.props.selectable = False 41 | self.name_label.props.has_tooltip = True 42 | self.name_label.props.tooltip_text = self.name 43 | 44 | self.set_fileicon() 45 | 46 | utils = HelperUtils() 47 | 48 | type = self.metadata['MIMEType'] 49 | 50 | if "image" in type: 51 | self.preview_available = True 52 | self.preview = PreviewContainer(self.path, self.metadata['MIMEType'], None) 53 | if "svg" in type: 54 | self.dimension.props.label = "Dimension: {0}x{1}".format(self.metadata['SvgWidth'],self.metadata['SvgHeight']) 55 | else: 56 | self.dimension.props.label = "Dimension: {0}".format(self.metadata['ImageSize']) 57 | 58 | elif "audio" in type: 59 | self.preview_available = True 60 | 61 | temp_filename = next(tempfile._get_candidate_names()) + tempfile.gettempprefix() 62 | temp_cache_uri = os.path.join(GLib.get_user_cache_dir(), temp_filename) 63 | 64 | audio_art = utils.get_audio_art(infile=self.path, outfile=temp_cache_uri) 65 | if audio_art is None: 66 | audio_icon = Gtk.IconTheme.get_default().lookup_icon("audio-x-generic", 128, 0) 67 | audio_art = audio_icon.get_filename() 68 | 69 | self.preview = PreviewContainer(audio_art, self.metadata['MIMEType'], (utils.open_file_with_default_app, self.path)) 70 | self.dimension.props.label = "Duration: {0}".format(self.metadata['Duration']) 71 | 72 | elif "video" in type: 73 | self.preview_available = True 74 | 75 | temp_filename = next(tempfile._get_candidate_names()) + tempfile.gettempprefix() 76 | temp_cache_uri = os.path.join(GLib.get_user_cache_dir(), temp_filename) 77 | 78 | video_frame = utils.get_video_frame(infile=self.path, outfile=temp_cache_uri) 79 | if video_frame is None: 80 | video_icon = Gtk.IconTheme.get_default().lookup_icon("video-x-generic", 128, 0) 81 | video_frame = video_icon.get_filename() 82 | 83 | self.preview = PreviewContainer(video_frame, self.metadata['MIMEType'], (utils.open_file_with_default_app, self.path), self.metadata['ImageWidth'], self.metadata['ImageHeight']) 84 | self.dimension.props.label = "Dimension: {0} Duration: {1}".format(self.metadata['ImageSize'], self.metadata['Duration']) 85 | 86 | else: 87 | self.dimension.props.label = "unavailable" 88 | 89 | def set_fileicon(self): 90 | size = 24 91 | info = self.giofile.query_info('standard::icon' , 0 , Gio.Cancellable()) 92 | for icon_name in info.get_icon().get_names(): 93 | try: 94 | self.icon.set_from_pixbuf(Gtk.IconTheme.get_default().load_icon(icon_name, size, 0)) 95 | break 96 | except: 97 | pass 98 | 99 | 100 | class PreviewContainer(Gtk.Grid): 101 | 102 | stop_threads = False 103 | play_gif_thread = None 104 | alpha = False 105 | 106 | def __init__(self, filepath, type, callback=None, width=None, height=None, *args, **kwargs): 107 | super().__init__(*args, **kwargs) 108 | 109 | self.props.halign = self.props.valign = Gtk.Align.FILL 110 | self.props.expand = True 111 | self.type = type 112 | self.filepath = filepath 113 | if callback is not None: 114 | self.callback = callback[0] 115 | self.callback_data = callback[1] 116 | 117 | self.get_style_context().add_class("dropshadow") 118 | 119 | if "gif" in self.type: 120 | self.pixbuf_original = GdkPixbuf.PixbufAnimation.new_from_file(filepath) 121 | self.pixbuf_original_height = self.pixbuf_original.get_height() 122 | self.pixbuf_original_width = self.pixbuf_original.get_width() 123 | self.iter = self.pixbuf_original.get_iter() 124 | if self.iter.get_pixbuf().get_has_alpha(): 125 | self.alpha = True 126 | else: 127 | self.pixbuf_original = GdkPixbuf.Pixbuf.new_from_file(filepath) 128 | self.pixbuf_original_height = self.pixbuf_original.props.height 129 | self.pixbuf_original_width = self.pixbuf_original.props.width 130 | if self.pixbuf_original.get_has_alpha(): 131 | self.alpha = True 132 | 133 | if self.alpha and "image" in self.type: 134 | self.get_style_context().add_class("checkerboard") 135 | 136 | self.ratio_h_w = self.pixbuf_original_height / self.pixbuf_original_width 137 | self.ratio_w_h = self.pixbuf_original_width / self.pixbuf_original_height 138 | 139 | if "generic" not in self.filepath: 140 | preview_width = 256 141 | preview_height = preview_width * self.ratio_h_w 142 | else: 143 | preview_width = self.pixbuf_original_width 144 | preview_height = self.pixbuf_original_height 145 | self.set_size_request(preview_width, preview_height) 146 | 147 | drawing_area = Gtk.DrawingArea() 148 | drawing_area.props.expand = True 149 | drawing_area.connect("draw", self.draw) 150 | drawing_area.props.can_focus = False 151 | 152 | preview_box = drawing_area 153 | 154 | if "gif" in self.type or "audio" in self.type or "video" in self.type: 155 | self.generate_play_pause_icons() 156 | 157 | overlay = Gtk.Overlay() 158 | overlay.add(preview_box) 159 | overlay.add_overlay(self.pause_revealer) 160 | overlay.add_overlay(self.play_revealer) 161 | eventbox = Gtk.EventBox() 162 | eventbox.props.above_child = True 163 | eventbox.add(overlay) 164 | eventbox.connect("enter-notify-event", self.on_hover_enter) 165 | eventbox.connect("leave-notify-event", self.on_hover_leave) 166 | 167 | if "gif" in self.type: 168 | eventbox.connect("button-press-event", self.toggle_gif_animation) 169 | else: 170 | eventbox.connect("button-press-event", self.open_file) 171 | 172 | self.attach(eventbox, 0, 0, 1, 1) 173 | else: 174 | self.attach(preview_box, 0, 0, 1, 1) 175 | 176 | def generate_play_pause_icons(self): 177 | play_image = Gtk.Image().new_from_icon_name("media-playback-start-symbolic", Gtk.IconSize.SMALL_TOOLBAR) 178 | play_image.get_style_context().add_class("icon-dropshadow") 179 | play_icon = Gtk.Button(image=play_image) 180 | play_icon.props.always_show_image = True 181 | play_icon.props.halign = Gtk.Align.CENTER 182 | play_icon.props.valign = Gtk.Align.CENTER 183 | play_icon.set_size_request(32, 32) 184 | play_icon.get_style_context().add_class("play-pause-shadow") 185 | self.play_revealer = Gtk.Revealer() 186 | self.play_revealer.props.transition_type = Gtk.RevealerTransitionType.CROSSFADE 187 | self.play_revealer.add(play_icon) 188 | 189 | pause_image = Gtk.Image().new_from_icon_name("media-playback-pause-symbolic", Gtk.IconSize.SMALL_TOOLBAR) 190 | pause_image.get_style_context().add_class("icon-dropshadow") 191 | pause_icon = Gtk.Button(image=pause_image) 192 | pause_icon.props.always_show_image = True 193 | pause_icon.props.halign = Gtk.Align.CENTER 194 | pause_icon.props.valign = Gtk.Align.CENTER 195 | pause_icon.set_size_request(32, 32) 196 | pause_icon.get_style_context().add_class("play-pause-shadow") 197 | self.pause_revealer = Gtk.Revealer() 198 | self.pause_revealer.props.transition_type = Gtk.RevealerTransitionType.CROSSFADE 199 | self.pause_revealer.add(pause_icon) 200 | 201 | def open_file(self, eventbox, eventbutton): 202 | if eventbutton.button == 1 and eventbutton.type.value_name == "GDK_BUTTON_PRESS": 203 | self.callback(self.callback_data) 204 | 205 | def toggle_gif_animation(self, eventbox, eventbutton): 206 | if eventbutton.button == 1 and eventbutton.type.value_name == "GDK_BUTTON_PRESS": 207 | if self.play_gif_thread is not None: 208 | self.stop_threads = True 209 | self.play_gif_thread.join() 210 | self.play_gif_thread = None 211 | else: 212 | import threading 213 | self.stop_threads = False 214 | self.play_gif_thread = threading.Thread(target=self.animation_func) 215 | self.play_gif_thread.start() 216 | 217 | def on_hover_enter(self, *args): 218 | proceed = False 219 | if "audio" in self.type or "video" in self.type: 220 | proceed = True 221 | if "gif" in self.type and self.play_gif_thread is not None: 222 | proceed = True 223 | if proceed: 224 | if "audio" in self.type or "video" in self.type: 225 | self.play_revealer.set_reveal_child(True) 226 | else: 227 | self.pause_revealer.set_reveal_child(True) 228 | else: 229 | self.play_revealer.set_reveal_child(True) 230 | 231 | def on_hover_leave(self, *args): 232 | self.pause_revealer.set_reveal_child(False) 233 | self.play_revealer.set_reveal_child(False) 234 | 235 | def animation_func(self, *args): 236 | import time 237 | while True: 238 | self.iter.advance() 239 | self.queue_draw() 240 | time.sleep(self.iter.get_delay_time()/1000) 241 | if self.stop_threads: 242 | break 243 | 244 | def draw(self, drawing_area, cairo_context, hover_scale=1): 245 | ''' 246 | Forked and ported from https://github.com/elementary/greeter/blob/master/src/Widgets/BackgroundImage.vala 247 | ''' 248 | from math import pi 249 | 250 | scale = self.get_scale_factor() 251 | width = self.get_allocated_width() * scale * hover_scale 252 | height = self.get_allocated_height() * scale * hover_scale 253 | radius = 4 * scale #Off-by-one to prevent light bleed 254 | 255 | if "gif" in self.type: 256 | pixbuf = GdkPixbuf.PixbufAnimationIter.get_pixbuf(self.iter) 257 | pixbuf_fitted = GdkPixbuf.Pixbuf.new(pixbuf.get_colorspace(), pixbuf.get_has_alpha(), pixbuf.get_bits_per_sample(), width, height) 258 | else: 259 | pixbuf = self.pixbuf_original 260 | pixbuf_fitted = GdkPixbuf.Pixbuf.new(pixbuf.get_colorspace(), pixbuf.get_has_alpha(), pixbuf.get_bits_per_sample(), width, height) 261 | 262 | if int(width * self.ratio_h_w) < height: 263 | scaled_pixbuf = pixbuf.scale_simple(int(height * self.ratio_w_h), height, GdkPixbuf.InterpType.BILINEAR) 264 | else: 265 | scaled_pixbuf = pixbuf.scale_simple(width, int(width * self.ratio_h_w), GdkPixbuf.InterpType.BILINEAR) 266 | 267 | if self.pixbuf_original_width * self.pixbuf_original_height < width * height: 268 | # Find the offset we need to center the source pixbuf on the destination since its smaller 269 | y = abs((height - self.pixbuf_original_height) / 2) 270 | x = abs((width - self.pixbuf_original_width) / 2) 271 | final_pixbuf = self.pixbuf_original 272 | else: 273 | # Find the offset we need to center the source pixbuf on the destination 274 | y = abs((height - scaled_pixbuf.props.height) / 2) 275 | x = abs((width - scaled_pixbuf.props.width) / 2) 276 | scaled_pixbuf.copy_area(x, y, width, height, pixbuf_fitted, 0, 0) 277 | # Set coordinates for cairo surface since this has been fitted, it should be (0, 0) coordinate 278 | x = y = 0 279 | final_pixbuf = pixbuf_fitted 280 | 281 | # cairo_context.set_operator(cairo.Operator.SOURCE) 282 | 283 | cairo_context.save() 284 | cairo_context.scale(1.0 / scale, 1.0 / scale) 285 | # cairo_context.new_sub_path() 286 | 287 | # draws rounded rectangle 288 | # cairo_context.arc(width - radius, radius, radius, 0-pi/2, 0) # top-right-corner 289 | # cairo_context.arc(width - radius, height - radius, radius, 0, pi/2) # bottom-right-corner 290 | # cairo_context.arc(radius, height - radius, radius, pi/2, pi) # bottom-left-corner 291 | # cairo_context.arc(radius, radius, radius, pi, pi + pi/2) # top-left-corner 292 | 293 | # cairo_context.close_path() 294 | 295 | Gdk.cairo_set_source_pixbuf(cairo_context, final_pixbuf, x, y) 296 | 297 | # cairo_context.clip() 298 | cairo_context.paint() 299 | cairo_context.restore() -------------------------------------------------------------------------------- /src/inspektor.in: -------------------------------------------------------------------------------- 1 | #!@PYTHON@ 2 | 3 | # inspektor.in 4 | # 5 | # Copyright 2021 Adi Hezral 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | import os 21 | import sys 22 | import signal 23 | import gettext 24 | 25 | VERSION = '@VERSION@' 26 | pkgdatadir = '@pkgdatadir@' 27 | localedir = '@localedir@' 28 | 29 | sys.path.insert(1, pkgdatadir) 30 | signal.signal(signal.SIGINT, signal.SIG_DFL) 31 | gettext.install('inspektor', localedir) 32 | 33 | if __name__ == '__main__': 34 | 35 | from inspektor import main 36 | sys.exit(main.main(VERSION)) 37 | -------------------------------------------------------------------------------- /src/main.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | # SPDX-FileCopyrightText: 2021 Adi Hezral 3 | 4 | import sys 5 | import os 6 | 7 | import gi 8 | gi.require_version('Gtk', '3.0') 9 | gi.require_version('Granite', '1.0') 10 | 11 | from gi.repository import Gtk, Gio, Granite, Gdk 12 | 13 | from .window import InspektorWindow 14 | from .constants import app 15 | from .utils import HelperUtils 16 | from .file_inspeck import FileInspeck 17 | 18 | import argparse 19 | import shutil 20 | 21 | class Application(Gtk.Application): 22 | 23 | def __init__(self): 24 | super().__init__() 25 | 26 | self.props.application_id = app.app_id 27 | self.props.flags=Gio.ApplicationFlags.HANDLES_OPEN 28 | 29 | self.gio_settings = Gio.Settings(schema_id=app.app_id) 30 | self.gtk_settings = Gtk.Settings().get_default() 31 | self.granite_settings = Granite.Settings.get_default() 32 | self.utils = HelperUtils() 33 | 34 | self.window = None 35 | self.file = None 36 | self.inspeck_obj = None 37 | 38 | def do_startup(self): 39 | Gtk.Application.do_startup(self) 40 | 41 | # Support quiting app using Super+Q 42 | quit_action = Gio.SimpleAction.new("quit", None) 43 | quit_action.connect("activate", self.on_quit_action) 44 | self.add_action(quit_action) 45 | self.set_accels_for_action("app.quit", ["Q", "Escape"]) 46 | 47 | prefers_color_scheme = self.granite_settings.get_prefers_color_scheme() 48 | self.gtk_settings.set_property("gtk-application-prefer-dark-theme", prefers_color_scheme) 49 | self.granite_settings.connect("notify::prefers-color-scheme", self.on_prefers_color_scheme) 50 | 51 | if "io.elementary.stylesheet" not in self.gtk_settings.props.gtk_theme_name: 52 | self.gtk_settings.set_property("gtk-theme-name", "io.elementary.stylesheet.blueberry") 53 | 54 | # set CSS provider 55 | provider = Gtk.CssProvider() 56 | provider.load_from_path(os.path.join(os.path.dirname(__file__), "data", "application.css")) 57 | Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) 58 | 59 | # prepend custom path for icon theme 60 | icon_theme = Gtk.IconTheme.get_default() 61 | icon_theme.prepend_search_path(os.path.join(os.path.dirname(__file__), "data", "icons")) 62 | 63 | def do_activate(self): 64 | if self.window is None: 65 | self.window = InspektorWindow(application=self) 66 | self.add_window(self.window) 67 | 68 | try: 69 | self.file = self.file[0] #GLocalFile object 70 | self.do_initialize_inspeck_obj(self.file) 71 | except: 72 | self.window.stack.set_visible_child_name("drop-view") 73 | finally: 74 | self.window.do_show_window() 75 | 76 | 77 | def do_initialize_inspeck_obj(self, file): 78 | self.inspeck_obj = FileInspeck( 79 | giofile=file, 80 | metadata=self.utils.get_jsondata(self.file.get_path()), 81 | comments=self.utils.get_file_comments(self.file.get_path()) 82 | ) 83 | 84 | def do_open(self, files, *hint): 85 | self.file = files 86 | self.do_activate() 87 | return 0 88 | 89 | def on_quit_action(self, action, param): 90 | if self.window is not None: 91 | self.window.destroy() 92 | 93 | def on_prefers_color_scheme(self, *args): 94 | prefers_color_scheme = self.granite_settings.get_prefers_color_scheme() 95 | self.gtk_settings.set_property("gtk-application-prefer-dark-theme", prefers_color_scheme) 96 | 97 | 98 | def main(version): 99 | app = Application() 100 | print(version) 101 | return app.run(sys.argv) 102 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | python = import('python') 2 | 3 | conf = configuration_data() 4 | conf.set('PYTHON', python.find_installation('python3').path()) 5 | conf.set('VERSION', meson.project_version()) 6 | conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir'))) 7 | conf.set('pkgdatadir', pkgdatadir) 8 | 9 | configure_file( 10 | input: 'inspektor.in', 11 | output: 'com.github.hezral.inspektor', 12 | configuration: conf, 13 | install: true, 14 | install_dir: get_option('bindir') 15 | ) 16 | 17 | inspektor_sources = [ 18 | '__init__.py', 19 | 'main.py', 20 | 'window.py', 21 | 'drop_view.py', 22 | 'base_view.py', 23 | 'constants.py', 24 | 'utils.py', 25 | 'file_inspeck.py', 26 | ] 27 | 28 | install_data(inspektor_sources, install_dir: moduledir) 29 | -------------------------------------------------------------------------------- /src/mode_switch.py: -------------------------------------------------------------------------------- 1 | # mode_switch.py 2 | # 3 | # Copyright 2021 adi 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | #(at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | 19 | import gi 20 | 21 | gi.require_version('Gtk', '3.0') 22 | gi.require_version('Gdk', '3.0') 23 | from gi.repository import Gtk, GObject, Gdk 24 | 25 | class ModeSwitch(Gtk.Grid): 26 | '''Gtk only basic port of https://github.com/elementary/granite/blob/master/lib/Widgets/ModeSwitch.vala''' 27 | 28 | __gtype_name__ = "ModeSwitch" 29 | 30 | CSS = """ 31 | .modeswitch slider {min-height: 16px; min-width: 16px;} 32 | .modeswitch:checked {background-clip: border-box; background-color: rgba(0,0,0,0.1); background-image: none;} 33 | """ 34 | 35 | css_provider = Gtk.CssProvider() 36 | css_provider.load_from_data(CSS.encode()) 37 | Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) 38 | 39 | active = GObject.Property(type=bool, default=True) 40 | 41 | def __init__(self, primary_widget, secondary_widget, primary_widget_callback, secondary_widget_callback, *args, **kwargs): 42 | super().__init__(*args, **kwargs) 43 | 44 | self.primary_widget = primary_widget 45 | self.secondary_widget = secondary_widget 46 | 47 | self.primary_widget_callback = primary_widget_callback 48 | self.secondary_widget_callback = secondary_widget_callback 49 | 50 | if self.primary_widget is not None: 51 | self.primary_widget.connect("button-release-event", self.on_primary_widget_pressed) 52 | self.primary_widget.props.valign = Gtk.Align.CENTER 53 | self.primary_widget.props.halign = Gtk.Align.END 54 | self.attach(self.primary_widget, 0, 0, 1, 1) 55 | 56 | if self.secondary_widget is not None: 57 | self.secondary_widget.connect("button-release-event", self.on_secondary_widget_pressed) 58 | self.secondary_widget.props.valign = Gtk.Align.CENTER 59 | self.secondary_widget.props.halign = Gtk.Align.START 60 | self.attach(self.secondary_widget, 2, 0, 1, 1) 61 | 62 | self.switch = Gtk.Switch() 63 | self.switch.get_style_context().add_class("modeswitch") 64 | self.switch.props.can_focus = False 65 | self.switch.props.valign = Gtk.Align.CENTER 66 | self.switch.set_size_request(32, -1) 67 | self.attach(self.switch, 1, 0, 1, 1) 68 | 69 | self.props.column_spacing = 6 70 | self.props.margin_top = 6 71 | self.props.margin_right = 6 72 | 73 | def on_primary_widget_pressed(self, *args): 74 | self.active = False 75 | if self.primary_widget_callback is not None: 76 | self.primary_widget_callback() 77 | return Gdk.EVENT_STOP 78 | 79 | def on_secondary_widget_pressed(self, *args): 80 | self.active = True 81 | if self.secondary_widget_callback is not None: 82 | self.secondary_widget_callback() 83 | return Gdk.EVENT_STOP 84 | -------------------------------------------------------------------------------- /src/playaudio.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | # SPDX-FileCopyrightText: 2021 Adi Hezral 3 | 4 | import sys 5 | import gi 6 | gi.require_version('Gst', '1.0') 7 | from gi.repository import Gst, Gio 8 | 9 | class Playaudio(): 10 | Gst.init(None) 11 | 12 | def __init__(self, giofile, *args, **kwargs): 13 | self.giofile = giofile 14 | 15 | self.player = Gst.ElementFactory.make("playbin", "player") 16 | fakesink = Gst.ElementFactory.make("fakesink", "fakesink") 17 | self.player.set_property("video-sink", fakesink) 18 | self.player.props.uri = self.giofile.get_uri() 19 | self.bus = self.player.get_bus() 20 | self.bus.add_signal_watch() 21 | self.bus.connect("message", self.on_message) 22 | 23 | def play_pause(self, *args): 24 | if self.is_playing() is False: 25 | self.player.set_state(Gst.State.PLAYING) 26 | print("playing") 27 | else: 28 | self.player.set_state(Gst.State.NULL) 29 | print("pausing") 30 | print(self.player.get_state(Gst.CLOCK_TIME_NONE).state.value_name) 31 | 32 | def is_playing(self, *args): 33 | if self.player.get_state(Gst.CLOCK_TIME_NONE).state.value_name == "GST_STATE_NULL": 34 | return False 35 | else: 36 | return True 37 | 38 | def on_message(self, bus, message): 39 | # print(message.type) 40 | if message.type == Gst.MessageType.EOS: 41 | self.player.set_state(Gst.State.NULL) 42 | elif message.type == Gst.MessageType.ERROR: 43 | self.player.set_state(Gst.State.NULL) 44 | err, debug = message.parse_error() 45 | print("Error: %s" % err, debug) 46 | 47 | # if __name__ == '__main__': 48 | # filename = sys.argv[1] 49 | 50 | # gfile = Gio.File.new_for_path(filename) 51 | 52 | # player = Playaudio(gfile) 53 | # player.play_pause() 54 | -------------------------------------------------------------------------------- /src/playvideo.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | # SPDX-FileCopyrightText: 2021 Adi Hezral 3 | 4 | import gi 5 | gi.require_version("Gtk", "3.0") 6 | gi.require_version("Gst", "1.0") 7 | from gi.repository import Gtk, Gst, Gio 8 | 9 | class Playvideo(): 10 | Gst.init(None) 11 | Gst.init_check(None) 12 | 13 | def __init__(self, giofile, *args, **kwargs): 14 | self.giofile = giofile 15 | 16 | # self.parent_widget = parent_widget 17 | # self.parent_widget.connect("realize", self.on_realize) 18 | 19 | self.player = Gst.ElementFactory.make("playbin") 20 | self.player.set_property("uri", self.giofile.get_uri()) 21 | self.player.set_state(Gst.State.NULL) 22 | self.bus = self.player.get_bus() 23 | self.bus.add_signal_watch() 24 | self.bus.connect("message", self.on_message) 25 | 26 | def set_parent_widget(self, widget): 27 | self.parent_widget = widget 28 | self.parent_widget.connect("realize", self.on_realize) 29 | 30 | def on_realize(self, widget): 31 | playerFactory = self.player.get_factory() 32 | gtksink = playerFactory.make('gtksink') 33 | self.player.set_property("video-sink", gtksink) 34 | gtkgstwidget = gtksink.props.widget 35 | gtkgstwidget.props.expand = True 36 | gtkgstwidget.props.halign = Gtk.Align.FILL 37 | gtkgstwidget.props.valign = Gtk.Align.FILL 38 | 39 | widget.add(gtkgstwidget) 40 | gtkgstwidget.show() 41 | 42 | def play_pause(self, *args): 43 | if self.is_playing() is False: 44 | self.player.set_state(Gst.State.PLAYING) 45 | else: 46 | self.player.set_state(Gst.State.PAUSED) 47 | 48 | def is_playing(self, *args): 49 | playerState = self.player.get_state(Gst.SECOND).state 50 | if playerState <= Gst.State.PAUSED: 51 | return False 52 | elif playerState is Gst.State.PLAYING: 53 | return True 54 | # if self.player.get_state(Gst.CLOCK_TIME_NONE).state.value_name == "GST_STATE_NULL": 55 | # return False 56 | # else: 57 | # return True 58 | 59 | def on_message(self, bus, message): 60 | # print(message.type) 61 | if message.type == Gst.MessageType.EOS: 62 | self.player.set_state(Gst.State.NULL) 63 | elif message.type == Gst.MessageType.ERROR: 64 | self.player.set_state(Gst.State.NULL) 65 | err, debug = message.parse_error() 66 | print("Error: %s" % err, debug) 67 | 68 | # class MainWindow(Gtk.Window): 69 | # def __init__(self, *args, **kwargs): 70 | # super().__init__(*args, **kwargs) 71 | 72 | # filepath = "/home/adi/Downloads/d.mkv" 73 | # self.file = Gio.File.new_for_path(filepath) 74 | 75 | # self.box = Gtk.Box() 76 | # self.box.props.expand = True 77 | # self.box.props.halign = Gtk.Align.FILL 78 | # self.box.props.valign = Gtk.Align.FILL 79 | # self.set_default_size(720, 560) 80 | # # self.set_size_request(720, 560) 81 | 82 | # self.playvideo = Playvideo(self.file, self.box) 83 | 84 | # self.play_button = Gtk.Button(label="Play") 85 | # self.play_button.connect("clicked", self.playvideo.play_pause) 86 | 87 | # grid = Gtk.Grid() 88 | # grid.attach(self.box, 0, 0, 1, 1) 89 | # grid.attach(self.play_button, 0, 1, 1, 1) 90 | # self.add(grid) 91 | # self.show_all() 92 | 93 | 94 | # def on_btnPlay_clicked(self, widget): 95 | # playerState = self.player.get_state(Gst.SECOND).state 96 | # if playerState <= Gst.State.PAUSED: 97 | # self.player.set_state(Gst.State.PLAYING) 98 | # self.btnPlay.set_label("Pause") 99 | # elif playerState is Gst.State.PLAYING: 100 | # self.player.set_state(Gst.State.PAUSED) 101 | # self.btnPlay.set_label("Play") 102 | 103 | # win = MainWindow() 104 | # win.connect("destroy", Gtk.main_quit) 105 | # # win.show_all() 106 | # Gtk.main() 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /src/utils.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | # SPDX-FileCopyrightText: 2021 Adi Hezral 3 | 4 | import os 5 | import stat 6 | import json 7 | import subprocess 8 | import cv2 9 | 10 | import gi 11 | gi.require_version('Gtk', '3.0') 12 | from gi.repository import Gtk, Gdk, Gio 13 | 14 | class HelperUtils(): 15 | 16 | def get_jsondata(self, file): 17 | run_executable = subprocess.Popen(['exiftool', '-j', file], stdout=subprocess.PIPE) 18 | stdout, stderr = run_executable.communicate() 19 | jsondata = json.loads(stdout)[0] 20 | # for key in jsondata: 21 | # print(key, ":", jsondata[key]) 22 | return jsondata 23 | 24 | def get_audio_art(self, infile=None, outfile=None): 25 | audio_art = None 26 | probe_cmd = 'exiftool -a -G4 "-picture*" {0}'.format(infile) 27 | run_executable = subprocess.Popen(probe_cmd, shell=True, stdout=subprocess.PIPE) 28 | stdout, stderr = run_executable.communicate() 29 | i = 0 30 | lines = stdout.decode("utf-8").replace(" ","").split("\n") 31 | for line in lines: 32 | if "FrontCover" in line: 33 | image_type =lines[i-1].split(":")[-1].split("/")[-1] 34 | if image_type == "jpeg": 35 | image_type = "jpg" 36 | outfile = "{0}.{1}".format(outfile, image_type) 37 | 38 | copynum = line.split(":")[0].split("]")[0].split("[") 39 | 40 | if copynum[-1] == "": 41 | export_cmd = 'exiftool -picture -b {0} > {1}'.format(infile, outfile) 42 | else: 43 | export_cmd = 'exiftool -{0}:picture -b {1} > {2}'.format(copynum[-1], infile, outfile) 44 | run_executable = subprocess.Popen(export_cmd, shell=True, stdout=subprocess.PIPE) 45 | stdout, stderr = run_executable.communicate() 46 | audio_art = outfile 47 | break 48 | i += 1 49 | return audio_art 50 | 51 | def get_video_frame(self, infile=None, outfile=None): 52 | video_frame = None 53 | video_capture = cv2.VideoCapture(infile) 54 | success, image = video_capture.read() 55 | count = 0 56 | frame = 30 57 | outfile = "{0}.{1}".format(outfile, "png") 58 | while count <= frame: 59 | if count == frame: 60 | cv2.imwrite(outfile, image) 61 | video_frame = outfile 62 | success, image = video_capture.read() 63 | count += 1 64 | return video_frame 65 | 66 | def get_permission(self, file): 67 | stmode = os.lstat(file).st_mode 68 | permissions = stat.filemode(stmode) 69 | mode = oct(stat.S_IMODE(stmode)) 70 | return permissions 71 | 72 | def get_file_comments(self, file): 73 | run_executable = subprocess.Popen(['getfattr', '-n', 'user.comment', '--only-values', '--absolute-names', file], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) 74 | stdout, stderr = run_executable.communicate() 75 | file_comments = stdout.decode('utf-8') 76 | return file_comments 77 | 78 | def set_file_comments(self, file, text): 79 | run_executable = subprocess.Popen(['setfattr', '-n', 'user.comment', '-v', text, file], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) 80 | run_executable.communicate() 81 | if self.get_file_comments(file) == text: 82 | return True 83 | else: 84 | return False 85 | 86 | def export_json(self, file): 87 | outfile = file + '_metadata.json' 88 | with open(outfile,'wb') as out: 89 | subprocess.Popen(['exiftool', '-j', file], stdout=out,stderr=subprocess.DEVNULL) 90 | 91 | def export_csv(self, file): 92 | outfile = file + '_metadata.csv' 93 | with open(outfile,'wb') as out: 94 | subprocess.Popen(['exiftool', '-csv', file], stdout=out,stderr=subprocess.DEVNULL) 95 | 96 | def export_txt(self, file): 97 | outfile = file + '_metadata.txt' 98 | with open(outfile,'wb') as out: 99 | subprocess.Popen(['exiftool', file], stdout=out,stderr=subprocess.DEVNULL) 100 | 101 | def file_chooser(self, parent): 102 | file_chooser_dialog = Gtk.FileChooserDialog() 103 | file_chooser_dialog.add_button("_Open", Gtk.ResponseType.OK) 104 | file_chooser_dialog.add_button("_Cancel", Gtk.ResponseType.CANCEL) 105 | file_chooser_dialog.set_default_response(Gtk.ResponseType.OK) 106 | file_chooser_dialog.set_transient_for(parent) 107 | file_chooser_dialog.set_destroy_with_parent(False) 108 | file_chooser_dialog.set_position(Gtk.WindowPosition.MOUSE) 109 | file_chooser_dialog.set_size_request(320, 480) 110 | 111 | response = file_chooser_dialog.run() 112 | file = None 113 | if response == Gtk.ResponseType.OK: 114 | file = file_chooser_dialog.get_file() #return a GLocalFile object 115 | file_chooser_dialog.destroy() 116 | else: 117 | file_chooser_dialog.destroy() 118 | if file is not None: 119 | return file 120 | 121 | def copy_to_clipboard(self, text): 122 | import gi 123 | gi.require_version('Gtk', '3.0') 124 | from gi.repository import Gtk, Gdk 125 | 126 | clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) 127 | 128 | try: 129 | clipboard.set_text(text, -1) 130 | return True 131 | except: 132 | return False 133 | 134 | def open_file_with_default_app(self, path=None): 135 | ''' Function to view file using default application via Gio''' 136 | view_file = Gio.File.new_for_path(path) 137 | if view_file.query_exists(): 138 | try: 139 | Gio.AppInfo.launch_default_for_uri(uri=view_file.get_uri(), context=None) 140 | except: 141 | import traceback 142 | print(traceback.format_exc()) -------------------------------------------------------------------------------- /src/waveform.py: -------------------------------------------------------------------------------- 1 | # Requires pydub (with ffmpeg) and Pillow 2 | # 3 | # Usage: python waveform.py 4 | 5 | import sys 6 | 7 | from pydub import AudioSegment 8 | from PIL import Image, ImageDraw 9 | 10 | import gi 11 | gi.require_version('Gtk', '3.0') 12 | from gi.repository import GdkPixbuf, GLib 13 | 14 | class Waveform(object): 15 | """ 16 | Credits: https://gist.github.com/mixxorz/abb8a2f22adbdb6d387f 17 | Minor modifications on shape and colors by hezral@gmail.com 18 | Credits: https://gist.github.com/mozbugbox/10cd35b2872628246140 19 | Added function image2pixbuf 20 | """ 21 | 22 | bar_count = 107 23 | db_ceiling = 60 24 | 25 | def __init__(self, filename): 26 | self.filename = filename 27 | 28 | audio_file = AudioSegment.from_file( 29 | self.filename, self.filename.split('.')[-1]) 30 | 31 | self.peaks = self._calculate_peaks(audio_file) 32 | 33 | def _calculate_peaks(self, audio_file): 34 | """ Returns a list of audio level peaks """ 35 | chunk_length = len(audio_file) / self.bar_count 36 | 37 | loudness_of_chunks = [ 38 | audio_file[i * chunk_length: (i + 1) * chunk_length].rms 39 | for i in range(self.bar_count)] 40 | 41 | max_rms = max(loudness_of_chunks) * 1.00 42 | 43 | return [int((loudness / max_rms) * self.db_ceiling) 44 | for loudness in loudness_of_chunks] 45 | 46 | def _get_bar_image(self, size, fill): 47 | """ Returns an image of a bar. """ 48 | width, height = size 49 | bar = Image.new('RGBA', size, fill) 50 | 51 | end = Image.new('RGBA', (width, 2), fill) 52 | draw = ImageDraw.Draw(end) 53 | # draw.point([(0, 0), (3, 0)], fill='#c1c1c1') 54 | # draw.point([(0, 1), (3, 1), (1, 0), (2, 0)], fill='#555555') 55 | 56 | bar.paste(end, (0, 0)) 57 | bar.paste(end.rotate(180), (0, height - 2)) 58 | return bar 59 | 60 | def _generate_waveform_image(self): 61 | """ Returns the full waveform image """ 62 | im = Image.new('RGBA', (840, 128), (255, 255, 255, 0)) 63 | for index, value in enumerate(self.peaks, start=0): 64 | column = index * 8 + 2 65 | upper_endpoint = 64 - value 66 | 67 | im.paste(self._get_bar_image((4, value * 2), '#5E5EF4'), 68 | (column, upper_endpoint)) 69 | 70 | return im 71 | 72 | def save(self, outfile): 73 | """ Save the waveform as an image """ 74 | png_filename = self.filename.replace(self.filename.split('.')[-1], 'png') 75 | png_filename = outfile 76 | with open(png_filename, 'wb') as imfile: 77 | self._generate_waveform_image().save(imfile, 'PNG') 78 | 79 | def image2pixbuf(self): 80 | """Convert Pillow image to GdkPixbuf""" 81 | im = self._generate_waveform_image() 82 | data = im.tobytes() 83 | w, h = im.size 84 | data = GLib.Bytes.new(data) 85 | pix = GdkPixbuf.Pixbuf.new_from_bytes(data, GdkPixbuf.Colorspace.RGB, 86 | False, 8, w, h, w * 3) 87 | return pix 88 | 89 | # if __name__ == '__main__': 90 | # filename = sys.argv[1] 91 | 92 | # waveform = Waveform(filename) 93 | # waveform.save() 94 | -------------------------------------------------------------------------------- /src/window.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-or-later 2 | # SPDX-FileCopyrightText: 2021 Adi Hezral 3 | 4 | from json import load 5 | import re 6 | import gi 7 | 8 | gi.require_version('Handy', '1') 9 | gi.require_version('Granite', '1.0') 10 | gi.require_version('Gtk', '3.0') 11 | 12 | from gi.repository import Gtk, Handy, Gio, Pango, Granite, Gdk, GdkPixbuf 13 | from .constants import data, app 14 | from .drop_view import DropView 15 | from .base_view import BaseView, DataLabel 16 | 17 | class InspektorWindow(Handy.ApplicationWindow): 18 | __gtype_name__ = 'InspektorWindow' 19 | 20 | Handy.init() 21 | 22 | file = None 23 | comments = None 24 | 25 | def __init__(self, *args, **kwargs): 26 | super().__init__(*args, **kwargs) 27 | 28 | self.app = self.props.application 29 | 30 | self.props.title = app.app_name 31 | self.props.halign = Gtk.Align.FILL 32 | self.props.valign = Gtk.Align.START 33 | self.props.resizable = False 34 | self.props.window_position = Gtk.WindowPosition.CENTER_ON_PARENT 35 | self.set_default_size(400, 320) 36 | self.set_size_request(400, -1) 37 | 38 | geometry = Gdk.Geometry() 39 | setattr(geometry, 'max_height', 800) 40 | setattr(geometry, 'max_width', 400) 41 | self.set_geometry_hints(None, geometry, Gdk.WindowHints.MAX_SIZE) 42 | 43 | self.drop_view = DropView(app=self.app) 44 | self.base_view = BaseView(app=self.app) 45 | 46 | self.stack = Gtk.Stack() 47 | self.stack.props.expand = True 48 | self.stack.props.transition_type = Gtk.StackTransitionType.CROSSFADE 49 | self.stack.add_named(self.drop_view, "drop-view") 50 | self.stack.add_named(self.base_view, "base-view") 51 | 52 | self.layout = Gtk.Grid() 53 | self.layout.props.name = "main" 54 | self.layout.props.expand = True 55 | self.layout.props.row_spacing = 10 56 | self.layout.attach(self.generate_headerbar(), 0, 0, 1, 1) 57 | self.layout.attach(self.stack, 0, 1, 1, 1) 58 | 59 | self.add(self.layout) 60 | self.show_all() 61 | self.connect("delete-event", self.on_close_window) 62 | self.drop_view.drag_and_drop_setup_main_window(self) 63 | 64 | def generate_headerbar(self): 65 | self.headerbar = Handy.HeaderBar() 66 | self.headerbar.set_size_request(-1, 44) 67 | self.headerbar.props.hexpand = True 68 | self.headerbar.props.has_subtitle = False 69 | self.headerbar.props.show_close_button = True 70 | self.headerbar.props.decoration_layout = "close:" 71 | self.headerbar.props.title = "Inspektor" 72 | return self.headerbar 73 | 74 | def do_show_window(self): 75 | if self.app.file: 76 | self.load_metadata() 77 | self.show_all() 78 | 79 | def load_metadata(self): 80 | 81 | #clear previous data if the app is invoked while an existing window is open. need to figure out how to do multiple instance 82 | for child in self.base_view.base_grid.get_children(): 83 | self.base_view.base_grid.remove(child) 84 | for child in self.base_view.extended_grid.get_children(): 85 | self.base_view.extended_grid.remove(child) 86 | for child in self.base_view.preview_grid.get_children(): 87 | self.base_view.preview_grid.remove(child) 88 | for child in self.headerbar.get_children(): 89 | self.headerbar.remove(child) 90 | 91 | self.headerbar.pack_start(self.app.inspeck_obj.icon) 92 | self.headerbar.pack_start(self.app.inspeck_obj.name_label) 93 | self.headerbar.props.title = "" 94 | self.stack.set_visible_child_name("base-view") 95 | 96 | self.base_view.file_comments.set_text(self.app.inspeck_obj.comments) 97 | 98 | if self.app.inspeck_obj.preview_available is True: 99 | self.base_view.preview_grid.attach(self.app.inspeck_obj.preview, 0, 0, 1, 1) 100 | 101 | self.base_view.preview_grid.attach(self.app.inspeck_obj.dimension, 0, 1, 1, 1) 102 | 103 | # add error checking if exiftool doesn't support a file format 104 | dict = self.app.inspeck_obj.metadata 105 | if 'Error' in dict.keys(): 106 | self.basedata = data().mindata 107 | i = 1 108 | for key in self.basedata: 109 | label = DataLabel(key[1], str(dict[key[0]]), self.app) 110 | self.base_view.base_grid.attach(label, 0, i, 1, 1) 111 | i = i + 1 112 | 113 | label = DataLabel('Error', 'Unsupported file format', self.app) 114 | self.base_view.extended_grid.attach(label, 0, 0, 1, 1) 115 | 116 | else: 117 | self.basedata = data().basedata 118 | i = 1 119 | for key in self.basedata: 120 | label = DataLabel(key[1], str(dict[key[0]]), self.app) 121 | self.base_view.base_grid.attach(label, 0, i, 1, 1) 122 | i = i + 1 123 | 124 | base_keys = [] 125 | for item in self.basedata: 126 | base_keys.append(item[0]) 127 | 128 | i = 1 129 | for key in sorted (dict.keys()): 130 | if "FileType" not in key or "ExifToolVersion" not in key: 131 | if key not in base_keys: 132 | label = DataLabel(key, str(dict[key]), self.app) 133 | self.base_view.extended_grid.attach(label, 0, i, 1, 1) 134 | separator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL) 135 | separator.props.expand = True 136 | self.base_view.extended_grid.attach(separator, 0, i+1, 1, 1) 137 | i = i + 2 138 | 139 | # present the window again in case its behind any window. usually if invoked from contractor menu 140 | self.base_view.on_view_visible() 141 | self.present() 142 | 143 | def on_close_window(self, window=None, event=None): 144 | if self.app.inspeck_obj is not None: 145 | if "image" in self.app.inspeck_obj.metadata['MIMEType']: 146 | if self.app.inspeck_obj.preview.play_gif_thread is not None: 147 | self.app.inspeck_obj.preview.stop_threads = True 148 | self.app.inspeck_obj.preview.play_gif_thread.join() 149 | self.app.inspeck_obj.preview.play_gif_thread = None 150 | self.destroy() 151 | --------------------------------------------------------------------------------