├── LICENSE
├── data
├── 16
│ └── ezame.png
├── 32
│ └── ezame.png
├── 64
│ └── ezame.png
├── 128
│ └── ezame.png
├── ezame
├── ezame.desktop
└── po
│ ├── de
│ └── ezame.mo
│ └── pt
│ └── ezame.mo
├── debian
├── changelog
├── compat
├── control
├── copyright
├── rules
├── source
│ └── format
└── watch
├── ezame
├── ThemedIconChooser.py
├── __init__.py
├── desktop.py
├── ezame.glade
└── main.py
├── po
├── de.po
├── ezame.pot
└── pt.po
├── readme.md
└── setup.py
/LICENSE:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/data/128/ezame.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linux-man/ezame/5fc1b6f16e27f913740dbc7157ff7da24a5b02b6/data/128/ezame.png
--------------------------------------------------------------------------------
/data/16/ezame.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linux-man/ezame/5fc1b6f16e27f913740dbc7157ff7da24a5b02b6/data/16/ezame.png
--------------------------------------------------------------------------------
/data/32/ezame.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linux-man/ezame/5fc1b6f16e27f913740dbc7157ff7da24a5b02b6/data/32/ezame.png
--------------------------------------------------------------------------------
/data/64/ezame.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linux-man/ezame/5fc1b6f16e27f913740dbc7157ff7da24a5b02b6/data/64/ezame.png
--------------------------------------------------------------------------------
/data/ezame:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | from ezame.main import run
4 | run()
5 |
6 |
--------------------------------------------------------------------------------
/data/ezame.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=0.6
3 | Name=Ezame
4 | Exec=ezame
5 | Icon=ezame
6 | Comment=Eza's Menu Editor
7 | Terminal=false
8 | Type=Application
9 | Categories=GNOME;GTK;System;Settings;
10 |
11 |
--------------------------------------------------------------------------------
/data/po/de/ezame.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linux-man/ezame/5fc1b6f16e27f913740dbc7157ff7da24a5b02b6/data/po/de/ezame.mo
--------------------------------------------------------------------------------
/data/po/pt/ezame.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linux-man/ezame/5fc1b6f16e27f913740dbc7157ff7da24a5b02b6/data/po/pt/ezame.mo
--------------------------------------------------------------------------------
/debian/changelog:
--------------------------------------------------------------------------------
1 | ezame (0.7.0-0) focal; urgency=low
2 |
3 | * Icon Chooser Dialog from https://github.com/Tomha/python-gtk-themed-icon-chooser
4 |
5 | -- Caldas Lopes Mon, 12 Oct 2020 10:12:24 +0100
6 |
7 | ezame (0.6.4-1) bionic; urgency=low
8 |
9 | * Revert to 0.6.2 behaviour - call pkexec when needed
10 |
11 | -- Caldas Lopes Thu, 30 Aug 2018 01:42:32 +0100
12 |
13 | ezame (0.6.3-1) bionic; urgency=low
14 |
15 | * Admin mode with pkexec
16 |
17 | -- Caldas Lopes Sun, 03 Jun 2018 23:32:35 +0100
18 |
19 | ezame (0.6.2.1-0) xenial; urgency=low
20 |
21 | * Catch bad encoded file names
22 | * Add semicolon to categories and desktops
23 | * Solve crash when XDG_DATA_DIRS is not defined
24 |
25 | -- Caldas Lopes Wed, 12 Apr 2017 13:43:55 +0100
26 |
27 | ezame (0.6.1-0trusty2) trusty; urgency=low
28 |
29 | * Bug fixes for non-Unity desktops
30 |
31 | -- Caldas Lopes Wed, 03 Jun 2015 21:56:33 +0100
32 |
33 | ezame (0.6-0trusty2) trusty; urgency=low
34 |
35 | * Dropped compatibility with Python 2
36 | * Menu edition
37 | * Separation between Menu and Desktop files
38 | * Use desktop-file-utils to validate and install files
39 | * Original menu backup
40 | * Create Menu Entry + Directory (Menu Entry must be manually removed)
41 | * Dropped python-xdg dependency
42 |
43 | -- Caldas Lopes Fri, 29 May 2015 00:50:08 +0100
44 |
45 | ezame (0.5~raring-1) raring; urgency=low
46 |
47 | * Actions
48 | * Initial LXDE and XFCE Support
49 | * New directory files go to desktop-directories
50 | * Show Menu Separators
51 |
52 | -- Caldas Lopes Tue, 18 Jun 2013 00:31:31 +0100
53 |
54 | ezame (0.4-0raring1) raring; urgency=low
55 |
56 | * Corrected dialog caption translation
57 | * Initial Cinnamon support
58 | * Several icons sizes
59 |
60 | -- Caldas Lopes Tue, 11 Jun 2013 19:16:16 +0100
61 |
62 | ezame (0.3.3-1) raring; urgency=low
63 |
64 | * New desktop name updated on tree entry
65 | * Change icon location to icon/hicolor
66 | * new desktop file get execute bit
67 | * Corrected translation
68 |
69 | -- Caldas Lopes Fri, 07 Jun 2013 21:07:52 +0100
70 |
71 | ezame (0.2-1) raring; urgency=low
72 |
73 | * Rebuild. Package enhancement
74 |
75 | ezame (0.1-1) raring; urgency=low
76 |
77 | * Original build
78 |
79 | -- Caldas Lopes Wed, 05 Jun 2013 16:03:40 +0100
80 |
81 |
--------------------------------------------------------------------------------
/debian/compat:
--------------------------------------------------------------------------------
1 | 9
2 |
--------------------------------------------------------------------------------
/debian/control:
--------------------------------------------------------------------------------
1 | Source: ezame
2 | Maintainer: Caldas Lopes
3 | Section: python
4 | Priority: optional
5 | Build-Depends: dh-python, python3-all, debhelper (>= 9)
6 | Standards-Version: 3.9.6
7 | Homepage: https://launchpad.net/~caldas-lopes/+archive/ppa
8 |
9 | Package: ezame
10 | Architecture: all
11 | Depends: ${misc:Depends}, ${python3:Depends}, python3-gi, desktop-file-utils
12 | Description: Eza's Menu Editor
13 |
14 |
--------------------------------------------------------------------------------
/debian/copyright:
--------------------------------------------------------------------------------
1 | Copyright: 2017, Caldas Lopes
2 | License: GPL-3+
3 |
4 | This package is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 3 of the License, or (at your option) any later version.
8 |
9 | This package is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this package; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 |
18 | On Debian systems, the complete text of the GNU Lesser General
19 | Public License can be found in `/usr/share/common-licenses/LGPL'.
20 |
21 |
--------------------------------------------------------------------------------
/debian/rules:
--------------------------------------------------------------------------------
1 | #!/usr/bin/make -f
2 |
3 | # This file was automatically generated by stdeb 0.8.5 at
4 | # Wed, 12 Apr 2017 13:43:55 +0100
5 | export PYBUILD_NAME=ezame
6 | %:
7 | dh $@ --with python3 --buildsystem=pybuild
8 |
9 |
--------------------------------------------------------------------------------
/debian/source/format:
--------------------------------------------------------------------------------
1 | 3.0 (quilt)
2 |
--------------------------------------------------------------------------------
/debian/watch:
--------------------------------------------------------------------------------
1 | # please also check http://pypi.debian.net/ezame/watch
2 | version=3
3 | opts=uversionmangle=s/(rc|a|b|c)/~$1/ \
4 | http://pypi.debian.net/ezame/ezame-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
--------------------------------------------------------------------------------
/ezame/ThemedIconChooser.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 Tom Hartill
2 | #
3 | # ThemedIconChooser.py - A set of GTK+ 3 widgets for selecting themed icons.
4 | #
5 | # ThemedIconChooser is free software; you can redistribute it and/or modify it
6 | # under the terms of the GNU General Public License as published by the Free
7 | # Software Foundation; either version 3 of the License, or (at your option) any
8 | # later version.
9 | #
10 | # ThemedIconChooser is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 | # details.
14 | #
15 | # You should have received a copy of the GNU General Public License along with
16 | # ThemedIconChooser; if not, see http://www.gnu.org/licenses/.
17 | #
18 | # An up to date version can be found at:
19 | # https://github.com/Tomha/python-gtk-themed-icon-chooser
20 |
21 | import re
22 | from threading import Thread
23 |
24 | import gi
25 | gi.require_version('Gtk', '3.0')
26 | from gi.repository import GLib, GObject, Gtk, Pango
27 |
28 | import gettext
29 | LOCALE_DOMAIN = "ezame"
30 | gettext.textdomain(LOCALE_DOMAIN)
31 | _ = gettext.gettext
32 |
33 | class IconChooserDialog(Gtk.Dialog):
34 | # TODO: Not all memory created by the dialog seems to be released.
35 | """GTK+ 3 Dialog to allow selection of a themed icon.
36 |
37 | The name of the selection icon is made available as a result of the run
38 | method, or by the get_selected_icon_name method.
39 |
40 | NOTE: If 1000s of icons are displayed this is 1000s of widgets. They are
41 | loaded asynchronously to prevent blocking the main thread, but they must
42 | still be show()n from the main thread, which may momentarily block it. This
43 | can be limited by filtering the available icon selection beforehand.
44 | """
45 | def __init__(self):
46 | super().__init__()
47 | GLib.threads_init()
48 |
49 | self.set_default_size(500, 500)
50 | self.set_icon_name("gtk-filter")
51 | self.set_title(_("Choose An Icon"))
52 |
53 | self._icon_contexts = []
54 | self._icon_size = 32
55 | self._icon_theme = None
56 | self._filter_term = ""
57 | self._selected_icon = ""
58 | self._use_regex = False
59 |
60 | # Widgets start here
61 |
62 | # Context Filtering
63 | icon_context_label = Gtk.Label(_("Icon Context:"))
64 | icon_context_label.set_width_chars(11)
65 |
66 | text_renderer = Gtk.CellRendererText()
67 | self._context_store = Gtk.ListStore(str)
68 | self._icon_context_combo = Gtk.ComboBox()
69 | self._icon_context_combo.set_model(self._context_store)
70 | self._icon_context_combo.pack_start(text_renderer, True)
71 | self._icon_context_combo.add_attribute(text_renderer, "text", 0)
72 |
73 | icon_context_box = Gtk.Box()
74 | icon_context_box.set_spacing(4)
75 | icon_context_box.pack_start(icon_context_label, False, False, 0)
76 | icon_context_box.pack_start(self._icon_context_combo, True, True, 0)
77 |
78 | # Name Filtering
79 |
80 | filter_label = Gtk.Label(_("Filter Term:"))
81 | filter_label.set_width_chars(11)
82 |
83 | self._filter_entry = Gtk.Entry()
84 |
85 | filter_clear_button = Gtk.Button.new_from_icon_name("gtk-clear",
86 | Gtk.IconSize.MENU)
87 |
88 | filter_box = Gtk.Box()
89 | filter_box.set_spacing(4)
90 | filter_box.pack_start(filter_label, False, False, 0)
91 | filter_box.pack_start(self._filter_entry, True, True, 0)
92 | filter_box.pack_start(filter_clear_button, False, False, 0)
93 |
94 | # Icon Previews
95 |
96 | self._icon_box = Gtk.FlowBox()
97 | self._icon_box.set_orientation(Gtk.Orientation.HORIZONTAL)
98 | self._icon_box.set_column_spacing(8)
99 | self._icon_box.set_row_spacing(8)
100 | self._icon_box.set_homogeneous(True)
101 | self._icon_box.set_valign(Gtk.Align.START)
102 |
103 | self._scroller = Gtk.ScrolledWindow()
104 | self._scroller.add(self._icon_box)
105 |
106 | # A slight hack to get the theme's background color for widgets.
107 | context = self._filter_entry.get_style_context()
108 | background_color = context.get_background_color(Gtk.StateType.NORMAL)
109 | self._icon_box_frame = Gtk.Frame()
110 | self._icon_box_frame.override_background_color(Gtk.StateFlags.NORMAL,
111 | background_color)
112 | self._icon_box_frame.add(self._scroller)
113 |
114 | # Spinner
115 | self._spinner = Gtk.Spinner()
116 | self._spinner.set_size_request(48, 48)
117 | self._spinner.set_hexpand(False)
118 | self._spinner.set_vexpand(False)
119 | self._spinner.set_halign(Gtk.Align.CENTER)
120 | self._spinner.set_valign(Gtk.Align.CENTER)
121 |
122 | content_box = self.get_content_area()
123 | content_box.set_margin_left(8)
124 | content_box.set_margin_right(8)
125 | content_box.set_margin_top(8)
126 | content_box.set_margin_bottom(8)
127 | content_box.set_spacing(8)
128 | content_box.pack_start(icon_context_box, False, False, 0)
129 | content_box.pack_start(filter_box, False, False, 0)
130 | content_box.pack_start(self._icon_box_frame, True, True, 0)
131 |
132 | # Dialog Buttons
133 | button_box = self.get_action_area()
134 | button_box.set_spacing(4)
135 | self._ok_button = self.add_button(Gtk.STOCK_OK, 1)
136 | self.add_button(Gtk.STOCK_CANCEL, 0)
137 |
138 | # Connect Signals
139 | self._icon_context_combo.connect("changed", self._on_context_changed)
140 | self._filter_entry.connect("changed", self._filter_icons)
141 | filter_clear_button.connect("clicked", lambda button:
142 | self._filter_entry.set_text(""))
143 | self._icon_box.connect("selected-children-changed",
144 | self._on_icon_selected)
145 |
146 | def _create_icon_previews(self, icon_name_list, icon_size):
147 | """Create icon previews to be placed in the dialog's icon box.
148 |
149 | Intended to be run in new thread. This only creates previews and adds
150 | them to the icon flow box, but it will not show()/display them. This is
151 | done by calling _display_icon_previews, which should be done in the
152 | main thread via GLib.idle_add.
153 |
154 | :param icon_name_list: List of icon names to create previews for.
155 | :param icon_size: Size to make icons within previews.
156 | :return: None
157 | """
158 | for icon in icon_name_list:
159 | flow_child = Gtk.FlowBoxChild()
160 | flow_child.add(_IconPreview(icon, icon_size))
161 | flow_child.connect("activate", self._on_icon_preview_selected)
162 | GLib.idle_add(self._icon_box.insert, flow_child, -1)
163 | GLib.idle_add(self._display_icon_previews)
164 |
165 | def _display_icon_previews(self):
166 | """Display icons and clean up after _create_icon_previews is run.
167 |
168 | WARNING: This must be run from the main thread, however show_all can
169 | take a noticeable amount of time, so the dialog will freeze momentarily
170 | as this runs if there are many icons to display. This is not avoidable
171 | to my knowledge.
172 |
173 | :return: None
174 | """
175 | self._icon_box_frame.remove(self._icon_box_frame.get_children()[0])
176 | self._icon_box_frame.add(self._scroller)
177 | self._spinner.stop()
178 | self._scroller.show_all()
179 |
180 | if self._filter_entry.get_text():
181 | self._filter_icons(self._filter_entry)
182 | self._filter_entry.set_position(len(self._filter_entry.get_text()))
183 | else:
184 | self._icon_box.show_all()
185 |
186 | self._icon_context_combo.set_sensitive(True)
187 |
188 | def _filter_icons(self, entry):
189 | """Filter icons based on filter term, used when filter term changes.
190 |
191 | If use_regex is True, the provided string will be used as the pattern
192 | for a regex match, otherwise basic case-insensitive matching is used.
193 |
194 | :param entry: Text entry containing filter text.
195 | :return: None
196 | """
197 | self._filter_term = entry.get_text()
198 | if self._filter_term == "":
199 | for icon in self._icon_box.get_children():
200 | icon.show()
201 | else:
202 | for icon in self._icon_box.get_children():
203 | if self._use_regex:
204 | if re.search(self._filter_term, icon):
205 | icon.show()
206 | else:
207 | icon.hide()
208 | else:
209 | name = icon.get_children()[0].get_name().lower()\
210 | .replace('-', ' ').replace('_', ' ')
211 | if self._filter_term.lower() in name:
212 | icon.show()
213 | else:
214 | icon.hide()
215 |
216 | def _on_context_changed(self, combobox):
217 | """When the context is changed, display the approprite icons.
218 |
219 | :param combobox: ComboBox used for context selection.
220 | :return: None
221 | """
222 | self._ok_button.set_sensitive(False)
223 | self._selected_icon = None
224 |
225 | for child in self._icon_box.get_children():
226 | child.destroy()
227 |
228 | # Place a spinner in the icon section while icons are loaded.
229 | self._icon_box_frame.remove(self._icon_box_frame.get_children()[0])
230 | self._icon_box_frame.add(self._spinner)
231 | self._spinner.start()
232 | self._icon_context_combo.set_sensitive(False)
233 | # Load icon previews for the new context asynchronously.
234 | selected_context = self._context_store.get_value(
235 | self._icon_context_combo.get_active_iter(), 0)
236 | current_icons = self._icon_theme.list_icons(selected_context)
237 | current_icons.sort()
238 | thread = Thread(target=self._create_icon_previews,
239 | args=(current_icons, self._icon_size))
240 | thread.setDaemon(True)
241 | thread.start()
242 |
243 | def _on_icon_preview_selected(self, preview):
244 | """Emulate OK when an icon preview is activated.
245 |
246 | :param preview: The preview activated.
247 | :return: None
248 | """
249 | self.response(1)
250 |
251 | def _on_icon_selected(self, flowbox):
252 | """Sets the selected_icon property when the selection changes.
253 |
254 | :param flowbox: FlowBox in which selection changed.
255 | :return: None
256 | """
257 | selection = flowbox.get_selected_children()
258 | if not selection:
259 | self._selected_icon = None
260 | self._ok_button.set_sensitive(False)
261 | else:
262 | self._selected_icon = selection[0].get_children()[0].get_name()
263 | self._ok_button.set_sensitive(True)
264 |
265 | def get_icon_contexts(self):
266 | """Get the list of icon contexts from which selection is allowed.
267 |
268 | :return: List of icon contexts to be displayed.
269 | """
270 | return self._icon_contexts
271 |
272 | def get_icon_size(self):
273 | """Get the pixel size to display icons in.
274 |
275 | :return: Size to display icons in, in pixels.
276 | """
277 | return self._icon_size
278 |
279 | def get_filter_term(self):
280 | """Get the string used for filtering icons by name.
281 |
282 | :return: String used for filtering icons by name.
283 | """
284 | return self._filter_term
285 |
286 | def get_selected_icon_name(self):
287 | """Get the name of the icon selected in the dialog.
288 |
289 | :return: Name of the currently selected icon.
290 | """
291 | return self._selected_icon
292 |
293 | def get_use_regex(self):
294 | """ Get whether the filter term should be used as a regex pattern.
295 |
296 | :return: Whether the filter term is used as a regex pattern.
297 | """
298 | return self._use_use_regex
299 |
300 | def run(self):
301 | """Run dialog to select a themed icon.
302 |
303 | This loads a the current icon theme, gets and filters available
304 | contexts, then filters/displays icon previews for the first
305 | (alphabetically) context.
306 |
307 | :return: None
308 | """
309 | self._icon_theme = Gtk.IconTheme.get_default()
310 | if self._icon_contexts:
311 | used_contexts = []
312 | for context in self._icon_theme.list_contexts():
313 | if context in self._icon_contexts:
314 | used_contexts += [context]
315 | used_contexts.sort()
316 | else:
317 | used_contexts = self._icon_theme.list_contexts()
318 | used_contexts.sort()
319 |
320 | self._context_store.clear()
321 | for context in used_contexts:
322 | self._context_store.append([context])
323 | self._icon_context_combo.set_active(0)
324 |
325 | if self._filter_term:
326 | self._filter_entry.set_text(self._filter_term)
327 |
328 | self._ok_button.set_sensitive(False)
329 |
330 | self.show_all()
331 | result = super().run()
332 | self.destroy()
333 | if result == 1:
334 | return self._selected_icon
335 | return None
336 |
337 | def set_icon_contexts(self, context_list):
338 | """Set the list of icon contexts from which selection is allowed.
339 |
340 | Contexts can be found using Gtk.IconTheme.get_default().list_contexts()
341 |
342 | Dialog will not update the available contexts once it has been shown.
343 |
344 | :param context_list: List of icon contexts to allow selection from.
345 | :return: None
346 | """
347 | if not type(context_list) == list:
348 | raise TypeError("must be type list, not " +
349 | type(context_list).__name__)
350 | self._icon_contexts = list(set(context_list))
351 |
352 | def set_icon_size(self, size):
353 | """Set the pixel size to display icons in.
354 |
355 | Dialog will not update the icon size once it has been shown.
356 |
357 | :param size: Size to display icons in, in pixels.
358 | :return: None
359 | """
360 | if not type(size) == int:
361 | raise TypeError("must be type int, not " +
362 | type(size).__name__)
363 | self._icon_size = size
364 |
365 | def set_filter_term(self, filter_term):
366 | """Set the string used for filtering icons by name.
367 |
368 | If use_regex is True, the provided string will be used as the pattern
369 | for a regex match, otherwise basic case-insensitive matching is used.
370 |
371 | Dialog will not update the filter term once it has been shown.
372 |
373 | :param filter_term: String used for filtering icons by name.
374 | :return: None
375 | """
376 | if not type(filter_term) == str:
377 | raise TypeError("must be type str, not " +
378 | type(filter_term).__name__)
379 | self._filter_term = filter_term
380 |
381 | def set_use_regex(self, use_regex):
382 | """Set whether or not regex terms are used to filter icons.
383 |
384 | If use_regex is True, the filter term will be used as the pattern for a
385 | regex match, otherwise basic case-insensitive matching is used.
386 |
387 | Dialog will not update this value once it has been shown.
388 |
389 | :param use_regex: Whether the filter term is used as a regex pattern.
390 | :return: None
391 | """
392 | if not type(use_regex) == bool:
393 | raise TypeError("must be type bool, not " +
394 | type(use_regex).__name__)
395 | self._use_regex = use_regex
396 |
397 |
398 | class IconChooserButton(Gtk.Button):
399 | """GTK + 3 Button to open dialog allowing selection of a themed icon.
400 |
401 | The name of the selected icon is emitted via the "icon-selected" signal
402 | once the dialog is closed, or via the get_selected_icon_name method.
403 |
404 | NOTE: The icon preview in the dialog and on the button may differ since
405 | icons can have a different appearance at different sizes.By default the
406 | dialog uses a larger size (32px) than the button (16px).
407 | set_dialog_icon_size(16) can be used to get the dialog to display the same
408 | icon that will be shown on the button, if you desire.
409 | """
410 | def __init__(self):
411 | super().__init__()
412 |
413 | self._icon_contexts = []
414 | self._icon_size = 32
415 | self._filter_term = ""
416 | self._use_regex = False
417 | self._selected_icon = None
418 |
419 | # Register a custom icon_selected signal for once dialog closes.
420 | GObject.type_register(IconChooserButton)
421 | GObject.signal_new("icon-selected",
422 | IconChooserButton,
423 | GObject.SIGNAL_RUN_FIRST,
424 | GObject.TYPE_NONE,
425 | [GObject.TYPE_STRING])
426 |
427 | # Widgets go here
428 | self._icon = Gtk.Image.new_from_icon_name("gtk-search",
429 | Gtk.IconSize.MENU)
430 | self._icon.set_margin_left(2)
431 |
432 | open_icon = Gtk.Image.new_from_icon_name("document-open-symbolic",
433 | Gtk.IconSize.MENU)
434 | self._label = Gtk.Label(_("(Choose An Icon)"))
435 | self._label.set_hexpand(True)
436 | self._label.set_halign(Gtk.Align.START)
437 | self._label.set_ellipsize(Pango.EllipsizeMode.END)
438 |
439 | box = Gtk.Box()
440 | box.set_spacing(4)
441 | box.pack_start(self._icon, False, False, 0)
442 | box.pack_start(self._label, False, True, 0)
443 | box.pack_start(open_icon, False, False, 2)
444 |
445 | self.add(box)
446 | self.connect("clicked", self._show_dialog)
447 |
448 | def _show_dialog(self, button):
449 | """Called when the button is clicked to show a selection dialog.
450 |
451 | :param button: The button used to show the dialog (self)
452 | :return: None
453 | """
454 | dialog = IconChooserDialog()
455 | dialog.set_transient_for(self.get_toplevel())
456 | dialog.set_icon_contexts(self._icon_contexts)
457 | dialog.set_icon_size(self._icon_size)
458 | dialog.set_filter_term(self._filter_term)
459 | dialog.set_use_regex(self._use_regex)
460 | self._selected_icon = dialog.run()
461 | dialog.destroy()
462 |
463 | if self._selected_icon:
464 | self._icon.set_from_icon_name(self._selected_icon,
465 | Gtk.IconSize.MENU)
466 | self._label.set_text(self._selected_icon)
467 | else:
468 | self._icon.set_from_icon_name("gtk-search", Gtk.IconSize.MENU)
469 | self._label.set_text(_("(Choose An Icon)"))
470 | self.emit("icon-selected", self._selected_icon)
471 |
472 | def get_icon_contexts(self):
473 | """Get the list of icon contexts from which selection is allowed.
474 |
475 | :return: List of icon contexts to be displayed.
476 | """
477 | return self._icon_contexts
478 |
479 | def get_icon_size(self):
480 | """Get the pixel size to display icons in.
481 |
482 | :return: Size to display icons in, in pixels.
483 | """
484 | return self._icon_size
485 |
486 | def get_filter_term(self):
487 | """Get the string used for filtering icons by name.
488 |
489 | :return: String used for filtering icons by name.
490 | """
491 | return self._filter_term
492 |
493 | def get_selected_icon_name(self):
494 | """Get the name of the icon selected in the dialog.
495 |
496 | :return: Name of the currently selected icon.
497 | """
498 | return self._selected_icon
499 |
500 | def get_use_regex(self):
501 | """ Get whether the filter term should be used as a regex pattern.
502 |
503 | :return: Whether the filter term is used as a regex pattern.
504 | """
505 | return self._use_use_regex
506 |
507 | def set_icon_contexts(self, context_list):
508 | """Set the list of icon contexts from which selection is allowed.
509 |
510 | Contexts can be found using Gtk.IconTheme.get_default().list_contexts()
511 |
512 | Dialog will not update the available contexts once it has been shown.
513 |
514 | :param context_list: List of icon contexts to allow selection from.
515 | :return: None
516 | """
517 | if not type(context_list) == list:
518 | raise TypeError("must be type list, not " +
519 | type(context_list).__name__)
520 | self._icon_contexts = list(set(context_list))
521 |
522 | def set_icon_size(self, size):
523 | """Set the pixel size to display icons in.
524 |
525 | Dialog will not update the icon size once it has been shown.
526 |
527 | :param size: Size to display icons in, in pixels.
528 | :return: None
529 | """
530 | if not type(size) == int:
531 | raise TypeError("must be type int, not " +
532 | type(size).__name__)
533 | self._icon_size = size
534 |
535 | def set_filter_term(self, filter_term):
536 | """Set the string used for filtering icons by name.
537 |
538 | If use_regex is True, the provided string will be used as the pattern
539 | for a regex match, otherwise basic case-insensitive matching is used.
540 |
541 | Dialog will not update the filter term once it has been shown.
542 |
543 | :param filter_term: String used for filtering icons by name.
544 | :return: None
545 | """
546 | if not type(filter_term) == str:
547 | raise TypeError("must be type str, not " +
548 | type(filter_term).__name__)
549 | self._filter_term = filter_term
550 |
551 | def set_use_regex(self, use_regex):
552 | """Set whether or not regex terms are used to filter icons.
553 |
554 | If use_regex is True, the filter term will be used as the pattern for a
555 | regex match, otherwise basic case-insensitive matching is used.
556 |
557 | Dialog will not update this value once it has been shown.
558 |
559 | :param use_regex: Whether the filter term is used as a regex pattern.
560 | :return: None
561 | """
562 | if not type(use_regex) == bool:
563 | raise TypeError("must be type bool, not " +
564 | type(use_regex).__name__)
565 | self._use_regex = use_regex
566 |
567 |
568 | class IconChooserComboBox(Gtk.ComboBox):
569 | """GTK+ 3 ComboBox allowing selection of a themed icon.
570 |
571 | The name of the currently selected icon is made available via the
572 | get_selected_icon method.
573 |
574 | Population of the combobox, done with the populate method, can take time
575 | and cause the UI to freeze if there are many icons to display. Therefore it
576 | is advised to limit the available icons by setting filter terms or context
577 | filters before population. I've attempted to make this asynchronous so as
578 | to avoid such delays but had no luck.
579 | """
580 | def __init__(self):
581 | super().__init__()
582 |
583 | self._icon_contexts = []
584 | self._filter_term = ""
585 | self._use_regex = False
586 |
587 | pixbuf_renderer = Gtk.CellRendererPixbuf()
588 | pixbuf_renderer.set_alignment(0, 0.5)
589 | pixbuf_renderer.set_padding(2, 0)
590 | text_renderer = Gtk.CellRendererText()
591 | text_renderer.set_alignment(0, 0.5)
592 |
593 | self._icon_store = Gtk.ListStore(str, str)
594 | self.set_model(self._icon_store)
595 | self.pack_start(pixbuf_renderer, True)
596 | self.add_attribute(pixbuf_renderer, "icon_name", 0)
597 | self.pack_start(text_renderer, True)
598 | self.add_attribute(text_renderer, "text", 1)
599 |
600 | def get_icon_contexts(self):
601 | """Get the list of icon contexts from which selection is allowed.
602 |
603 | :return: List of icon contexts to be displayed.
604 | """
605 | return self._icon_contexts
606 |
607 | def get_filter_term(self):
608 | """Get the string used for filtering icons by name.
609 |
610 | :return: String used for filtering icons by name.
611 | """
612 | return self._filter_term
613 |
614 | def get_selected_icon_name(self):
615 | """Get the name of the icon currently selected in the combo box.
616 |
617 | :return: Name of the currently selected icon.
618 | """
619 | selection = self._icon_store.get_value(self.get_active_iter(), 0)
620 | if selection == _("(Choose An Icon)"):
621 | return None
622 | else:
623 | return selection
624 |
625 | def get_use_regex(self):
626 | """ Get whether the filter term should be used as a regex pattern.
627 |
628 | :return: Whether the filter term is used as a regex pattern.
629 | """
630 | return self._use_regex
631 |
632 | def populate(self):
633 | """Populate the combo box with themed icons.
634 |
635 | This can take timeand cause the UI to freeze if there are many icons to
636 | display. Therefore itis advised to limit the available icons by setting
637 | filter terms or context filters before population. I've attempted to
638 | make this asynchronous so as to avoid such delays but had no luck.
639 |
640 | :return: None
641 | """
642 | unfiltered_icons = []
643 | icon_theme = Gtk.IconTheme.get_default()
644 | if not self._icon_contexts:
645 | for context in icon_theme.list_contexts():
646 | unfiltered_icons += icon_theme.list_icons(context)
647 | else:
648 | for context in icon_theme.list_contexts():
649 | if context not in self._icon_contexts:
650 | continue
651 | unfiltered_icons += icon_theme.list_icons(context)
652 |
653 | filtered_icons = []
654 | if not self._filter_term:
655 | for icon in unfiltered_icons:
656 | filtered_icons += [icon]
657 | else:
658 | for icon in unfiltered_icons:
659 | if self._use_regex:
660 | if not re.search(self._filter_term, icon):
661 | continue
662 | else:
663 | if not self._filter_term.lower() in \
664 | icon.lower().replace('-', ' ').replace('_', ' '):
665 | continue
666 | filtered_icons += [icon]
667 |
668 | # This section can be slow with many icons to show()
669 | self._icon_store.clear()
670 | self._icon_store.append(["gtk-search", _("(Choose An Icon)")])
671 | for icon in filtered_icons:
672 | self._icon_store.append([icon, icon])
673 | self.set_active(0)
674 | self.show_all()
675 |
676 | def set_icon_contexts(self, context_list):
677 | """Set the list of icon contexts from which selection is allowed.
678 |
679 | Contexts can be found using Gtk.IconTheme.get_default().list_contexts()
680 |
681 | Combobox will not update the available contexts once it has been shown.
682 |
683 | :param context_list: List of icon contexts to allow selection from.
684 | :return: None
685 | """
686 | if not type(context_list) == list:
687 | raise TypeError("must be type list, not " +
688 | type(context_list).__name__)
689 | self._icon_contexts = list(set(context_list))
690 |
691 | def set_filter_term(self, filter_term):
692 | """Set the string used for filtering icons by name.
693 |
694 | If use_regex is True, the provided string will be used as the pattern
695 | for a regex match, otherwise basic case-insensitive matching is used.
696 |
697 | Combobox will not update the filter term once it has been shown.
698 |
699 | :param filter_term: String used for filtering icons by name.
700 | :return: None
701 | """
702 | if not type(filter_term) == str:
703 | raise TypeError("must be type str, not " +
704 | type(filter_term).__name__)
705 | self._filter_term = filter_term
706 |
707 | def set_use_regex(self, use_regex):
708 | """Set whether or not regex terms are used to filter icons.
709 |
710 | If use_regex is True, the filter term will be used as the pattern for a
711 | regex match, otherwise basic case-insensitive matching is used.
712 |
713 | Combobox will not update this value once it has been shown.
714 |
715 | :param use_regex: Whether the filter term is used as a regex pattern.
716 | :return: None
717 | """
718 | if not type(use_regex) == bool:
719 | raise TypeError("must be type bool, not " +
720 | type(use_regex).__name__)
721 | self._use_regex = use_regex
722 |
723 |
724 | class _IconPreview(Gtk.Box):
725 | """Creates a preview box for icons containing the icon and its name."""
726 | def __init__(self, name, size):
727 | super().__init__()
728 | self.set_orientation(Gtk.Orientation.VERTICAL)
729 | self.set_spacing(2)
730 |
731 | self._icon_name = name
732 | self._display_name = name.replace('-', ' ').replace('_', ' ')
733 | self._icon_size = size
734 |
735 | icon = Gtk.Image.new_from_icon_name(name, Gtk.IconSize.DIALOG)
736 | # Gtk.Image.new_from_icon_name seems to sometimes ignore the set size,
737 | # leading to inconsistent icon sizes. Solution is to force a size
738 | # using set_pixel_size.
739 | icon.set_pixel_size(size)
740 | icon.set_tooltip_text(self._icon_name)
741 |
742 | label = Gtk.Label(self._display_name)
743 | label.set_justify(Gtk.Justification.CENTER)
744 | label.set_lines(3)
745 | label.set_line_wrap(True)
746 | label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
747 | label.set_max_width_chars(8)
748 | label.set_ellipsize(Pango.EllipsizeMode.END)
749 | label.set_yalign(0.5)
750 |
751 | self.pack_start(icon, False, False, 0)
752 | self.pack_start(label, False, False, 0)
753 |
754 | def get_name(self):
755 | """Get the name of the icon.
756 |
757 | :return: Name of the icon.
758 | """
759 | return self._icon_name
760 |
--------------------------------------------------------------------------------
/ezame/__init__.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/ezame/desktop.py:
--------------------------------------------------------------------------------
1 | import os, sys, io, subprocess, tempfile
2 | import gettext
3 | _ = gettext.gettext
4 | from configparser import ConfigParser
5 |
6 | langs = []
7 | languages = []
8 | for envar in ('LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG'):
9 | val = os.environ.get(envar)
10 | if val:
11 | languages = val.split(':')
12 | break
13 | if languages:
14 | for lang in languages:
15 | pos = lang.find('.')
16 | if pos >= 0:
17 | lang = lang[:pos]
18 | if not(lang in langs): langs.append(lang)
19 | pos = lang.find('@')
20 | if pos >= 0:
21 | lang = lang[:pos]
22 | if not(lang in langs): langs.append(lang)
23 | pos = lang.find('_')
24 | if pos >= 0:
25 | lang = lang[:pos]
26 | if not(lang in langs): langs.append(lang)
27 | languages = None
28 |
29 | class DE(object):
30 | def __init__(self, filename = None):
31 | self.filename = filename
32 | self.default_section = "Desktop Entry"
33 | self.content = ConfigParser(strict = False, comment_prefixes = ('#'), inline_comment_prefixes = None, delimiters = ('='), interpolation=None, default_section = None)
34 | self.content.BOOLEAN_STATES = {'true': True, 'false': False}
35 | self.content.optionxform = str
36 | self.content.add_section(self.default_section)
37 | if filename and os.path.exists(filename):
38 | try:
39 | self.content.read([filename])
40 | except:
41 | df = open(filename, "r")
42 | self.faulty_text = df.read()
43 | #filename, ext = os.path.splitext(filename)
44 | #print(self.filename)
45 |
46 | def get(self, key, group = None, locale = False):
47 | if not group: group = self.default_section
48 | if locale:
49 | try:
50 | for lang in langs:
51 | langkey = "%s[%s]" % (key, lang)
52 | for (k, v) in self.content.items(group, raw = True):
53 | if langkey == k:
54 | key = langkey
55 | raise
56 | except: pass
57 | try:
58 | value = self.content.get(group, key, raw = True)
59 | if value == "": return ""
60 | if self.get('X-Ubuntu-Gettext-Domain')!="": #for Ubuntu systems
61 | gettext.textdomain(self.get('X-Ubuntu-Gettext-Domain'))
62 | if isinstance(_(value), str): #gettext can return a info list
63 | return _(value)
64 | else:
65 | return value
66 | except: return ""
67 | else:
68 | try: return self.content.get(group, key, raw = True)
69 | except: return ""
70 |
71 | def getboolean(self, key, group = None):
72 | if not group: group = self.default_section
73 | try: return self.content.getboolean(group, key, raw = True)
74 | except: return False
75 |
76 | def getlist(self, key, group = None, locale = False):
77 | if not group: group = self.default_section
78 | try: return [x for x in self.get(key, group, locale).split(";") if x]
79 | except: return []
80 |
81 | def set(self, key, text, group = None, locale = False):
82 | if not group: group = self.default_section
83 | if locale:
84 | for lang in langs:
85 | langkey = "%s[%s]" % (key, lang)
86 | if langkey in self.content.items(group, raw = True):
87 | key = langkey
88 | break
89 | self.content.set(group, key, text)
90 |
91 | def read(self, filename = None):
92 | self.__init__(filename)
93 |
94 | def read_string(self, string):
95 | self.content.read_string(string)
96 |
97 | def as_string(self):
98 | text = ""
99 | if self.items():
100 | for group in self.items():
101 | text += "[%s]\n" % (group)
102 | for (key, value) in self.items(group):
103 | text += "%s=%s\n" % (key, value)
104 | text += "\n"
105 | return text
106 |
107 | def items(self, section = None):
108 | if section: return self.content.items(section, raw = True)
109 | else: return self.content.sections()
110 |
111 | def removeKey(self, key, group = None):
112 | if not group: group = self.default_section
113 | self.content.remove_option(group, key)
114 |
115 | def write(self, filename = None):
116 | if filename:
117 | self.filename = filename
118 | if self.filename:
119 | for group in self.items():
120 | for key, value in self.items(group):
121 | if not value: self.content.remove_option(group, key)
122 | td = tempfile.TemporaryDirectory()
123 | f = open(os.path.join(td.name, os.path.basename(self.filename)), "w")
124 | self.content.write(f, space_around_delimiters=False)
125 | f.close()
126 | command = ["desktop-file-validate", f.name]
127 | p = subprocess.Popen(command, stdout=subprocess.PIPE)
128 | if p.wait() == 0:
129 | command = ["desktop-file-install", "--dir="+ os.path.dirname(self.filename), f.name]
130 | p = subprocess.Popen(command)
131 | if p.wait() != 0:
132 | command = ["pkexec", "desktop-file-install", "--dir=" + os.path.dirname(self.filename), f.name]
133 | p = subprocess.Popen(command)
134 | p.wait()
135 | else:
136 | return '\n'.join(line.split(": ", maxsplit=1)[-1] for line in p.communicate()[0].decode("utf-8").split('\n'))
137 | os.remove(f.name)
138 |
--------------------------------------------------------------------------------
/ezame/main.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | import gi
4 | gi.require_version('Gtk', '3.0')
5 | import os, sys, fnmatch
6 | import xml.etree.ElementTree as ET
7 | import subprocess, tempfile
8 | import gettext
9 | from gi.repository import Gtk, Gdk, GdkPixbuf, Pango
10 | from configparser import ConfigParser
11 | local = (len(sys.argv) > 1) and (sys.argv[1] == "local")
12 | if local:
13 | from desktop import DE
14 | from ThemedIconChooser import IconChooserDialog
15 | import ThemedIconChooser
16 | glade_path = "ezame.glade"
17 | else:
18 | from ezame.desktop import DE
19 | from ezame.ThemedIconChooser import IconChooserDialog
20 | glade_path = os.path.join(sys.prefix, "share", "ezame", "ezame.glade")
21 | LOCALE_DOMAIN = "ezame"
22 | gettext.textdomain(LOCALE_DOMAIN)
23 | _ = gettext.gettext
24 |
25 | #files
26 | i_filename = 0
27 | i_local = 1
28 | i_system = 2
29 |
30 | #desktop
31 | d_item = 0
32 | d_sort = 1
33 | d_icon = 2
34 | d_local_path = 3
35 | d_system_path = 4
36 | d_local_icon = 5
37 | d_display = 6
38 | d_display_visible = 7
39 | d_menu_name = 8
40 |
41 | class MyTreeBuilder(ET.TreeBuilder):
42 | def __init__(self):
43 | self.start("root", {})
44 | def comment(self, data):
45 | self.start(ET.Comment, {})
46 | self.data(data)
47 | self.end(ET.Comment)
48 |
49 | class MyElementBuilder(ET.TreeBuilder):
50 | def comment(self, data):
51 | self.start(ET.Comment, {})
52 | self.data(data)
53 | self.end(ET.Comment)
54 |
55 | class Ezame(object):
56 |
57 | def prettystring(self, tree, level=0):
58 | def indent(elem, level=0):
59 | i = "\n" + level*"\t"
60 | if len(elem):
61 | if not elem.text or not elem.text.strip():
62 | try: n = elem.text.count("\n")
63 | except:
64 | n = 1
65 | pass
66 | elem.text = n* "\n" + (level + 1)*"\t"
67 | if not elem.tail or not elem.tail.strip():
68 | try: n = elem.tail.count("\n")
69 | except:
70 | n = 1
71 | pass
72 | elem.tail = n* "\n" + level*"\t"
73 | for elem in elem:
74 | indent(elem, level+1)
75 | if not elem.tail or not elem.tail.strip():
76 | try: n = elem.tail.count("\n")
77 | except:
78 | n = 1
79 | pass
80 | elem.tail = n* "\n" + level*"\t"
81 | else:
82 | if level and (not elem.tail or not elem.tail.strip()):
83 | try: n = elem.tail.count("\n")
84 | except:
85 | n = 1
86 | pass
87 | elem.tail = n* "\n" + level*"\t"
88 |
89 | elem = ET.XML(ET.tostring(tree, encoding = "unicode"), parser=ET.XMLParser(target=MyElementBuilder()))
90 | indent(elem)
91 | return '\n'.join(line[1:] for line in ET.tostring(elem, encoding="unicode").split('\n')[1:-2])
92 |
93 | def gtk_main_quit(self, *args):
94 | self.config["window"] = {"width": self.window.get_size()[0], "height": self.window.get_size()[1]}
95 | self.config["paned"] = {"position": self.paned.get_position()}
96 | if not os.path.exists(os.path.dirname(self.config_file)): os.mkdir(os.path.dirname(self.config_file))
97 | with open(self.config_file, "w") as config_file: self.config.write(config_file)
98 | self.desktree.disconnect(self.id_desktree_cursor_changed)
99 | Gtk.main_quit(*args)
100 |
101 | def on_Ruser_clicked(self, obj):
102 | if obj.get_active():
103 | if self.deskstore[self.desktree.get_cursor()[0]][d_local_path] == "":
104 | dirs = []
105 | subdir = ""
106 | if "/applications/" in self.deskstore[self.desktree.get_cursor()[0]][d_system_path]: folder = "applications"
107 | else: folder = "desktop-directories"
108 | head, filename = os.path.split(self.deskstore[self.desktree.get_cursor()[0]][d_system_path])
109 | head, tail = os.path.split(head)
110 | while tail != folder:
111 | dirs.insert(0, tail)
112 | head, tail = os.path.split(head)
113 | if dirs: subdir = os.sep.join(dirs)
114 | directory = os.path.join(self.data_home, folder, subdir)
115 | if not os.path.exists(directory): os.makedirs(directory)
116 | new_file = os.path.join(directory, os.path.basename(self.deskstore[self.desktree.get_cursor()[0]][d_system_path]))
117 | self.Entry.write(new_file)
118 | self.deskstore[self.desktree.get_cursor()[0]][d_local_path] = new_file
119 | self.deskstore[self.desktree.get_cursor()[0]][d_local_icon] = self.load_icon("user-home")
120 | self.change_tree("update")
121 | self.update_info()
122 |
123 | def on_Rsystem_clicked(self, obj):
124 | if obj.get_active():
125 | self.update_info()
126 |
127 | def on_Bundo_clicked(self, obj):
128 | if self.pagenum < 4:
129 | menu_string = self.config.get("menus", self.menu_filename)
130 | td = tempfile.TemporaryDirectory()
131 | f = open(os.path.join(td.name, os.path.basename(self.menu_filename)), "w")
132 | f.write(menu_string)
133 | f.close()
134 | command = ["cp", f.name, self.menu_filename]
135 | p = subprocess.Popen(command)
136 | if p.wait() != 0:
137 | command = ["pkexec", "cp", f.name, self.menu_filename]
138 | p = subprocess.Popen(command)
139 | p.wait()
140 | self.load_menu()
141 | else:
142 | self.update_info()
143 |
144 | def on_Bsave_clicked(self, obj):
145 | if self.pagenum < 4:
146 | self.on_menu_view_focus_out_event(self.menu_view, None)
147 | self.on_menu_view_focus_out_event(self.appdir_view, None)
148 | self.on_menu_view_focus_out_event(self.directorydir_view, None)
149 | self.on_menu_view_focus_out_event(self.mergedir_view, None)
150 | self.on_menu_view_focus_out_event(self.mergefile_view, None)
151 | self.on_menu_view_focus_out_event(self.legacydir_view, None)
152 | self.on_menu_view_focus_out_event(self.include_view, None)
153 | self.on_menu_view_focus_out_event(self.exclude_view, None)
154 | self.on_menu_view_focus_out_event(self.defaultlayout_view, None)
155 | self.on_menu_view_focus_out_event(self.layout_view, None)
156 |
157 | menu_string ="\n\n" + self.prettystring(self.menu.getroot())
158 | td = tempfile.TemporaryDirectory()
159 | f = open(os.path.join(td.name, os.path.basename(self.menu_filename)), "w")
160 | f.write(menu_string)
161 | f.close()
162 | command = ["cp", f.name, self.menu_filename]
163 | p = subprocess.Popen(command)
164 | if p.wait() != 0:
165 | command = ["pkexec", "cp", f.name, self.menu_filename]
166 | p = subprocess.Popen(command)
167 | p.wait()
168 | else:
169 | if self.buffer_changed: self.on_desktop_view_focus_out_event(None, None)
170 | r = self.Entry.write()
171 | if r:
172 | md = Gtk.MessageDialog(type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.CLOSE)
173 | md.set_property("text", r)
174 | md.run()
175 | md.destroy()
176 | self.update_info()
177 |
178 | def on_Entry_changed(self, obj):
179 | if obj.is_focus():
180 | locale = getattr(obj, "locale", False)
181 | group = getattr(obj, "group", None)
182 | self.Entry.set(obj.key, obj.get_text(), group, locale)
183 | self.update_objects()
184 |
185 | def on_Switch_notify(self, obj, active):
186 | if self.Entry:
187 | self.Entry.set(obj.key, str(obj.get_active()).lower())
188 | self.update_objects()
189 |
190 | def on_menu_Entry_changed(self, obj):
191 | if obj.is_focus():
192 | tag = getattr(obj, "tag", None)
193 | try:
194 | self.selected_menu.find(tag).text=obj.get_text()
195 | if tag == "Name": self.deskstore[self.desktree.get_cursor()[0]][d_menu_name] = obj.get_text()
196 | except: pass
197 | self.update_menu_objects()
198 |
199 | def on_menu_Switch_notify(self, obj, active):
200 | if obj.get_active():
201 | if self.selected_menu.find(obj.tag) == None: ET.SubElement(self.selected_menu, obj.tag)
202 | else:
203 | for el in self.selected_menu.findall(obj.tag): self.selected_menu.remove(el)
204 | self.update_menu_objects()
205 |
206 | def on_Bactionadd_clicked(self, obj):
207 | dialog = NewAction()
208 | dialog.Waction.set_transient_for(self.window)
209 | response = dialog.Waction.run()
210 | if response == Gtk.ResponseType.OK:
211 | dialog.Waction.hide()
212 | action = dialog.Eaction.get_text()
213 | self.Entry.content.add_section(" ".join(("Desktop Action", action)))
214 | actions = self.Entry.getlist("Actions")
215 | actions.append(action)
216 | self.Entry.set("Actions", ";".join(actions))
217 | dialog.Waction.destroy()
218 | self.update_objects(True, True)
219 |
220 | def on_Bactionremove_clicked(self, obj):
221 | try:
222 | sel_action = self.Nactions.get_tab_label_text(self.Nactions.get_nth_page(self.Nactions.get_current_page()))
223 | self.Entry.content.remove_section(" ".join(("Desktop Action", sel_action)))
224 | actions = self.Entry.getlist("Actions")
225 | self.Entry.set("Actions", ";".join(action for action in actions if action != sel_action))
226 | except: pass
227 | self.update_objects(True, True)
228 |
229 | def on_BFileChooser_clicked(self, obj):
230 | def add_filters(dialog):
231 | filter_text = Gtk.FileFilter()
232 | filter_text.set_name(_("Image files")) #Imagens
233 | filter_text.add_mime_type("image/*")
234 | dialog.add_filter(filter_text)
235 | filter_any = Gtk.FileFilter()
236 | filter_any.set_name(_("Any files")) #Todos os Ficheiros
237 | dialog.add_filter(filter_any)
238 | gettext.textdomain(LOCALE_DOMAIN)
239 | dialog = Gtk.FileChooserDialog(obj.msg, self.window, obj.action, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
240 | if obj == self.Bicon: add_filters(dialog)
241 | response = dialog.run()
242 | if response == Gtk.ResponseType.OK:
243 | obj.entry.grab_focus()
244 | obj.entry.set_text(dialog.get_filename())
245 | dialog.destroy()
246 |
247 | def on_BIconChooser_clicked(self, obj):
248 | dialog = IconChooserDialog()
249 | dialog.set_transient_for(self.window)
250 | selection = dialog.run()
251 | dialog.destroy()
252 | if selection:
253 | obj.entry.grab_focus()
254 | obj.entry.set_text(selection)
255 |
256 | def on_categtreecellrenderertoggle_toggled(self, cell, path, model, *ignore):
257 | model[model.get_iter(path)][0] = not model[model.get_iter(path)][0]
258 | categories = self.Entry.getlist("Categories")
259 | if model[model.get_iter(path)][0]:
260 | categs = eval(model[model.get_iter(path)][3])
261 | for categ in categs: categories.append(categ)
262 | categs = eval(model[model.get_iter(path)][4])
263 | for categ in categs:
264 | if categ in categories: categories.remove(categ)
265 | else:
266 | categs = eval(model[model.get_iter(path)][3])
267 | for categ in categs:
268 | if categ in categories: categories.remove(categ)
269 | if len(categories) == 0:
270 | self.Entry.set("Categories","")
271 | else:
272 | self.Entry.set("Categories",";".join(categories)+";")
273 | self.update_objects()
274 |
275 | def save_des(self):
276 | if self.Ronlyshowin.get_active():
277 | show_selected = "OnlyShowIn"
278 | show_removed = "NotShowIn"
279 | else:
280 | show_selected = "NotShowIn"
281 | show_removed = "OnlyShowIn"
282 | showin = ";".join(row[1] for row in self.destore if row[0]) + ";"
283 | if showin == ";":
284 | showin = "";
285 | self.Entry.set(show_selected, showin)
286 | self.Entry.removeKey(show_removed)
287 | self.update_objects()
288 |
289 | def on_Rshowin__clicked(self, obj):
290 | if obj.is_focus():
291 | self.save_des()
292 |
293 | def on_Mnew_activate(self, obj):
294 | def iterate(treeiter, filename):
295 | found = None
296 | while treeiter != None:
297 | if self.deskstore.iter_has_child(treeiter):
298 | childiter = self.deskstore.iter_children(treeiter)
299 | cursor = iterate(childiter, filename)
300 | if cursor != None: found = cursor
301 | if self.deskstore[treeiter][d_local_path] == filename:
302 | found = treeiter
303 | break
304 | treeiter = self.deskstore.iter_next(treeiter)
305 | return found
306 | gettext.textdomain(LOCALE_DOMAIN)
307 | dialog = NewEntry()
308 | dialog.Winput.set_transient_for(self.window)
309 | if self.desktop == "Menu":
310 | dialog.Winput.set_title(_("New Directory"))
311 | dialog.Cinputtype.append_text(_("Directory"))
312 | else:
313 | dialog.Cinputtype.append_text(_("Application"))
314 | dialog.Cinputtype.append_text(_("Link"))
315 | dialog.Cinputtype.set_active(0)
316 | response = dialog.Winput.run()
317 | if response == Gtk.ResponseType.OK:
318 | dialog.Winput.hide()
319 | filetype = dialog.Cinputtype.get_active()
320 | if self.desktop == "Menu":
321 | ext = "directory"
322 | type = "Directory"
323 | folder = "desktop-directories"
324 | item = self.selected_menu
325 | tree = ET.fromstring("".join([""]))
326 | for node in tree:
327 | item.append(node)
328 | self.on_Bsave_clicked(None)
329 | else:
330 | if filetype == 0:
331 | ext = "desktop"
332 | type = "Application"
333 | folder = "applications"
334 | else:
335 | ext = "desktop"
336 | type = "Link"
337 | folder = "applications"
338 | filename = os.path.join(os.path.join(self.data_home, folder), os.path.splitext(os.path.basename(dialog.Einputfile.get_text()))[0] + "." + ext)
339 | self.Entry = DE(filename)
340 | self.Entry.set("Name", os.path.splitext(os.path.basename(dialog.Einputfile.get_text()))[0])
341 | self.Entry.set("Type", type)
342 |
343 | self.Entry.write()
344 | os.chmod(filename, 0o755)
345 | self.load_menu()
346 | try:
347 | rootiter = self.deskstore.get_iter_first()
348 | found = iterate(rootiter, filename)
349 | path = self.deskstore.get_path(found)
350 | self.desktree.expand_to_path(path)
351 | self.desktree.set_cursor(path)
352 | self.desktree.scroll_to_cell(path)
353 | except: pass
354 | dialog.Winput.destroy()
355 |
356 | def on_Mdelete_activate(self, obj):
357 | os.remove(self.deskstore[self.desktree.get_cursor()[0]][d_local_path])
358 | # if self.desktop == "Menu":
359 | # item = self.selected_menu
360 | # item.clear() #Not working - stays
361 | # self.on_Bsave_clicked(None)
362 | if not(self.desktop == "Menu"):
363 | if self.deskstore[self.desktree.get_cursor()[0]][d_system_path] == "":
364 | self.change_tree("delete")
365 | else:
366 | self.deskstore[self.desktree.get_cursor()[0]][d_local_path] = ""
367 | self.deskstore[self.desktree.get_cursor()[0]][d_local_icon] = None
368 | self.change_tree("update")
369 | self.update_info()
370 |
371 | def on_Mvalidate_activate(self, obj):
372 | command = ["desktop-file-validate", self.Entry.filename]
373 | p = subprocess.Popen(command, stdout=subprocess.PIPE)
374 | if p.wait() == 0:
375 | r = _("No Warnings")
376 | else:
377 | r = '\n'.join(line.split(": ", maxsplit=1)[-1] for line in p.communicate()[0].decode("utf-8").split('\n'))
378 | md = Gtk.MessageDialog(type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.CLOSE)
379 | md.set_property("text", r)
380 | md.run()
381 | md.destroy()
382 |
383 | def on_Mrefresh_activate(self, obj):
384 | self.load_menu()
385 |
386 | def on_Mclipboard_activate(self, obj):
387 | focused = self.window.get_focus()
388 | try:
389 | if obj == self.Mcut: focused.cut_clipboard()
390 | elif obj == self.Mcopy: focused.copy_clipboard()
391 | elif obj == self.Mpaste: focused.paste_clipboard()
392 | except: pass
393 |
394 | def on_Mpreferences_activate(self, obj):
395 | dialog = Preferences()
396 | dialog.Wpreferences.set_transient_for(self.window)
397 | dialog.Rubuntu.set_visible(os.environ.get('XDG_CURRENT_DESKTOP') == "Unity")
398 | if self.desktop == "Unity": dialog.Rubuntu.set_active(True)
399 | elif self.desktop == "Apps": dialog.Rapps.set_active(True)
400 | else: dialog.Rmenu.set_active(True)
401 | response = dialog.Wpreferences.run()
402 | if response == Gtk.ResponseType.OK:
403 | if dialog.Rubuntu.get_active(): self.desktop = "Unity"
404 | elif dialog.Rapps.get_active(): self.desktop = "Apps"
405 | else: self.desktop = "Menu"
406 | dialog.Wpreferences.hide()
407 | while Gtk.events_pending(): Gtk.main_iteration()
408 | self.load_menu()
409 | dialog.Wpreferences.destroy()
410 |
411 | def on_Mabout_activate(self, obj):
412 | builder = Gtk.Builder()
413 | builder.set_translation_domain(LOCALE_DOMAIN)
414 | builder.add_from_file(glade_path)
415 | self.Wabout = builder.get_object("Wabout")
416 | self.Wabout.run()
417 | self.Wabout.destroy()
418 |
419 | def on_showtreecellrenderertoggle_toggled(self, cell, path, model, *ignore):
420 | model[model.get_iter(path)][0] = not model[model.get_iter(path)][0]
421 | self.save_des()
422 |
423 | def on_desktop_buffer_changed(self, obj):
424 | if self.desktop_view.is_focus(): self.buffer_changed = True
425 |
426 | def on_menu_buffer_changed(self, obj):
427 | if obj.view.is_focus(): obj.view.buffer_changed = True
428 |
429 | def on_desktop_view_focus_out_event(self, obj, event):
430 | if self.buffer_changed:
431 | self.Entry.content.clear()
432 | self.Entry.read_string(self.desktop_buffer.get_text(self.desktop_buffer.get_start_iter(), self.desktop_buffer.get_end_iter(), False))
433 | self.update_objects(False, True)
434 |
435 | def on_menu_view_focus_out_event(self, obj, event):
436 | if obj.buffer_changed:
437 | tag = getattr(obj, "tag", None)
438 | obj_buffer = obj.get_buffer()
439 | if tag in ["Include", "Exclude", "Layout", "DefaultLayout"]:
440 | try: item = self.selected_menu.findall(tag)[-1]
441 | except:
442 | item = ET.SubElement(self.selected_menu, tag)
443 | pass
444 | #catch = self.selected_menu.find(tag)
445 | tree = ET.fromstring("".join(["",obj_buffer.get_text(obj_buffer.get_start_iter(), obj_buffer.get_end_iter(), False),""]))
446 | #root = tree.getroot()
447 | item.clear()
448 | for node in tree:
449 | item.append(node)
450 | #except: pass
451 | elif tag == "MenuEditor":
452 | tree = ET.fromstring("".join(["",obj_buffer.get_text(obj_buffer.get_start_iter(), obj_buffer.get_end_iter(), False),""]))
453 | self.selected_menu.clear()
454 | for node in tree:
455 | self.selected_menu.append(node)
456 | else:
457 | tags = self.selected_menu.findall(tag)
458 | tags_text = [line.strip() for line in obj_buffer.get_text(obj_buffer.get_start_iter(), obj_buffer.get_end_iter(), False).split("\n")]
459 | for text in tags_text:
460 | try:
461 | tags[tags_text.index(text)].text = text
462 | except:
463 | item = ET.SubElement(self.selected_menu, tag)
464 | item.text = text
465 | pass
466 |
467 | obj.buffer_changed = False
468 | self.update_menu_objects()
469 |
470 | def on_notebook_switch_page(self, widget, dummy, pagenum):
471 | self.pagenum = pagenum
472 | self.update_objects()
473 |
474 | def on_desktree_cursor_changed(self, widget):
475 | self.desktree.grab_focus()
476 | if self.deskstore[self.desktree.get_cursor()[0]][d_local_path] == "":
477 | self.Rsystem.set_active(True)
478 | else:
479 | self.Ruser.set_active(True)
480 | self.update_info()
481 |
482 | def update_info(self):
483 | if self.menu:
484 | if not self.deskstore[self.desktree.get_cursor()[0]][d_menu_name]: self.Entry = None
485 | node = self.deskstore.get_iter([self.desktree.get_cursor()[0]])
486 | while self.deskstore.iter_parent(node): #or self.deskstore[parent][d_menu_name]:
487 | node = self.deskstore.iter_parent(node)
488 | if self.menu_filename != self.deskstore[node][d_system_path]:
489 | self.menu_filename = self.deskstore[node][d_system_path]
490 | self.menu = ET.parse(self.menu_filename, parser=ET.XMLParser(target=MyTreeBuilder()))
491 | self.menu.getroot().set("filename", self.deskstore[node][d_system_path])
492 | if not self.deskstore[self.desktree.get_cursor()[0]][d_menu_name]:
493 | self.selected_menu = self.menu.getroot()
494 | else:
495 | for menu in self.menu.iter("Menu"):
496 | try:
497 | if menu.find("Name").text == self.deskstore[self.desktree.get_cursor()[0]][d_menu_name]:
498 | self.selected_menu = menu
499 | except: pass
500 | self.update_menu_objects()
501 | if not self.menu or self.deskstore[self.desktree.get_cursor()[0]][d_menu_name]:# != None:
502 | if self.Rsystem.get_active():
503 | desktop_file_path = self.deskstore[self.desktree.get_cursor()[0]][d_system_path]
504 | else:
505 | desktop_file_path = self.deskstore[self.desktree.get_cursor()[0]][d_local_path]
506 | self.Rsystem.set_sensitive(not self.deskstore[self.desktree.get_cursor()[0]][d_system_path] == "")
507 | if desktop_file_path == "": self.Entry = None
508 | else: self.Entry = DE(desktop_file_path)
509 | self.update_objects(True, True)
510 |
511 | #def getMenu(self, menu, path):
512 | #array = path.split("/", 1)
513 | #for submenu in menu.Submenus:
514 | #if (submenu.getName()) == array[0]:
515 | #if len(array) > 1:
516 | #return self.getMenu(submenu, array[1])
517 | #else:
518 | #return submenu
519 |
520 | def update_objects(self, update_editor=True, update_actions=False):
521 | def insert_action(self, group):
522 | gettext.textdomain(LOCALE_DOMAIN)
523 | label = Gtk.Label(" ".join(group.split()[2:]))
524 | Laname = Gtk.Label(_("Name"), halign=Gtk.Align.START)
525 | Laexec = Gtk.Label(_("Exec"), halign=Gtk.Align.START)
526 | Laicon = Gtk.Label(_("Icon"), halign=Gtk.Align.START)
527 | Eaname = Gtk.Entry()
528 | Eaname.key = "Name"
529 | Eaname.group = group
530 | Eaname.locale = True
531 | Eaname.set_hexpand(True)
532 | Eaname.set_text(self.Entry.get("Name", group, locale = True))
533 | self.id_Eaname_changed = Eaname.connect("changed", self.on_Entry_changed)
534 | Eaexec = Gtk.Entry()
535 | Eaexec.key = "Exec"
536 | Eaexec.group = group
537 | Eaexec.set_hexpand(True)
538 | Eaexec.set_text(self.Entry.get("Exec", group))
539 | self.id_Eaexec_changed = Eaexec.connect("changed", self.on_Entry_changed)
540 | Baexec = Gtk.Button(stock = "gtk-open")
541 | Baexec.set_always_show_image(True)
542 | Baexec.msg = _("Choose a file")
543 | Baexec.action = Gtk.FileChooserAction.OPEN
544 | Baexec.entry = Eaexec
545 | self.id_Baexec_clicked = Baexec.connect("clicked", self.on_BFileChooser_clicked)
546 | boxexec = Gtk.Box()
547 | boxexec.pack_start(Eaexec, True, True, 0)
548 | boxexec.pack_start(Baexec, False, False, 0)
549 | Eaicon = Gtk.Entry()
550 | Eaicon.key = "Icon"
551 | Eaicon.group = group
552 | Eaicon.locale = True
553 | Eaicon.set_hexpand(True)
554 | Eaicon.set_text(self.Entry.get("Icon", group, locale = True))
555 | self.id_Eaicon_changed = Eaicon.connect("changed", self.on_Entry_changed)
556 | Baicon = Gtk.Button(stock = "gtk-open")
557 | Baicon.set_always_show_image(True)
558 | Baicon.msg = _("Choose a file")
559 | Baicon.action = Gtk.FileChooserAction.OPEN
560 | Baicon.entry = Eaicon
561 | self.id_Baicon_clicked = Baicon.connect("clicked", self.on_BFileChooser_clicked)
562 | boxicon = Gtk.Box()
563 | boxicon.pack_start(Eaicon, True, True, 0)
564 | boxicon.pack_start(Baicon, False, False, 0)
565 | grid = Gtk.Grid(halign=Gtk.Align.FILL)
566 | grid.set_row_spacing(4)
567 | grid.set_column_spacing(4)
568 | grid.set_border_width(4)
569 | grid.set_hexpand(True)
570 | grid.add(Laname)
571 | grid.attach(Laexec, 0, 1, 1, 1)
572 | grid.attach(Laicon, 0, 2, 1, 1)
573 | grid.attach(Eaname, 1, 0, 1, 1)
574 | grid.attach(boxexec, 1, 1, 1, 1)
575 | grid.attach(boxicon, 1, 2, 1, 1)
576 | self.Nactions.append_page(grid, label)
577 |
578 | def enable_all(self):
579 | self.scrolledwindoweditor.set_sensitive(True)
580 | self.scrolledwindowmore.set_sensitive(True)
581 | self.scrolledwindowprop.set_sensitive(True)
582 | self.categtree.set_sensitive(True)
583 | self.gridshow.set_sensitive(True)
584 | self.Rnotshowin.set_sensitive(True)
585 | self.Ronlyshowin.set_sensitive(True)
586 | #self.Box_buttons.set_sensitive(True)
587 | self.Ruser.set_sensitive(True)
588 | self.Rsystem.set_sensitive(True)
589 | self.Bundo.set_sensitive(True)
590 | self.Bsave.set_sensitive(True)
591 | self.Mundo.set_sensitive(True)
592 | self.Msave.set_sensitive(True)
593 | app = self.Entry.get("Type") == "Application"
594 | link = self.Entry.get("Type") == "Link"
595 | self.scrolledwindowactions.set_sensitive(app)
596 | self.Eurl.set_visible(link)
597 | self.Lurl.set_visible(link)
598 | self.Eexec.set_visible(app)
599 | self.Lexec.set_visible(app)
600 | self.Bexec.set_visible(app)
601 | self.Epath.set_visible(app)
602 | self.Lpath.set_visible(app)
603 | self.Bpath.set_visible(app)
604 | self.categtree.set_sensitive(app)
605 | self.Etryexec.set_visible(app) #more
606 | self.Ltryexec.set_visible(app)
607 | self.Btryexec.set_visible(app)
608 | self.Sterminal.set_visible(app)
609 | self.Lterminal.set_visible(app)
610 | self.Lmimetypes.set_visible(app)
611 | self.Emimetypes.set_visible(app)
612 | self.Lkeywords.set_visible(app)
613 | self.Ekeywords.set_visible(app)
614 | self.Lstartupnotify.set_visible(app)
615 | self.Sstartupnotify.set_visible(app)
616 | self.Lstartupwmclass.set_visible(app)
617 | self.Estartupwmclass.set_visible(app)
618 |
619 | def disable_all(self):
620 | self.scrolledwindoweditor.set_sensitive(False)
621 | self.scrolledwindowactions.set_sensitive(False)
622 | self.scrolledwindowmore.set_sensitive(False)
623 | self.scrolledwindowprop.set_sensitive(False)
624 | self.categtree.set_sensitive(False)
625 | self.gridshow.set_sensitive(False)
626 | self.Rnotshowin.set_sensitive(False)
627 | self.Ronlyshowin.set_sensitive(False)
628 | #self.Box_buttons.set_sensitive(False)
629 | self.Ruser.set_sensitive(False)
630 | self.Rsystem.set_sensitive(False)
631 | self.Bundo.set_sensitive(False)
632 | self.Bsave.set_sensitive(False)
633 | self.Mundo.set_sensitive(False)
634 | self.Msave.set_sensitive(False)
635 | self.Mdelete.set_sensitive(False)
636 | self.desktop_buffer.set_text("")
637 | self.Efile.set_text("")
638 | self.Ltype.set_text("")
639 | self.Ename.set_text("")
640 | self.Egenericname.set_text("")
641 | self.Snodisplay.set_active(False)
642 | self.Eexec.set_text("")
643 | self.Epath.set_text("")
644 | self.Eicon.set_text("")
645 | self.Ecomment.set_text("")
646 | self.Eurl.set_text("")
647 | self.Rnotshowin.set_active(False)
648 | self.Ronlyshowin.set_active(False)
649 | self.Eversion.set_text("") #more
650 | self.Shidden.set_active(False)
651 | self.Etryexec.set_text("")
652 | self.Sterminal.set_active(False)
653 | self.Emimetypes.set_text("")
654 | self.Ekeywords.set_text("")
655 | self.Sstartupnotify.set_active(False)
656 | self.Estartupwmclass.set_text("")
657 | for categ in self.categstore: categ[0] = False
658 | self.Ronlyshowin.set_active(True)
659 | for de in self.destore: de[0] = False
660 |
661 | if not self.Entry:
662 | disable_all(self)
663 | else:
664 | self.buffer_changed = False
665 | Entry = self.Entry
666 | enable_all(self)
667 | self.Mdelete.set_sensitive(self.Ruser.get_active())
668 | self.Efile.set_text(Entry.filename)
669 | gettext.textdomain(LOCALE_DOMAIN)
670 | self.Ltype.set_text(_(Entry.get("Type"))) #translate Application/Directory
671 | self.Ename.set_text(Entry.get("Name", locale = True))
672 | self.Egenericname.set_text(Entry.get("GenericName", locale = True))
673 | self.Snodisplay.set_active(Entry.getboolean("NoDisplay"))
674 | try: self.deskstore[self.desktree.get_cursor()[0]][d_item] = Entry.get("Name", locale = True)
675 | except: pass
676 | try: self.deskstore[self.desktree.get_cursor()[0]][d_icon] = self.load_icon(Entry.get("Icon", locale = True))
677 | except: pass
678 | try: self.deskstore[self.desktree.get_cursor()[0]][d_display] = not self.Snodisplay.get_active()
679 | except: pass
680 | self.Eexec.set_text(Entry.get("Exec"))
681 | self.Epath.set_text(Entry.get("Path"))
682 | self.Eicon.set_text(Entry.get("Icon", locale = True))
683 | self.Ecomment.set_text(Entry.get("Comment", locale = True))
684 | self.Eurl.set_text(Entry.get("URL"))
685 |
686 | categories = Entry.getlist("Categories")
687 | for row in self.categstore: row[0] = eval(row[2])
688 |
689 | if Entry.getlist("NotShowIn"):
690 | self.Rnotshowin.set_active(True)
691 | des = Entry.getlist("NotShowIn")
692 | elif Entry.getlist("OnlyShowIn"):
693 | self.Ronlyshowin.set_active(True)
694 | des = Entry.getlist("OnlyShowIn")
695 | else:
696 | self.Ronlyshowin.set_active(True)
697 | des = []
698 | self.destore.clear()
699 | for de in self.de_list: self.destore.append([False, de])
700 | for de in des:
701 | exist = False
702 | for row in self.destore:
703 | if de == row[1]: exist = True
704 | if not exist: self.destore.append([False, de])
705 | for row in self.destore: row[0] = row[1] in des
706 |
707 | self.Eversion.set_text(Entry.get("Version"))
708 | self.Shidden.set_active(Entry.getboolean("Hidden"))
709 | self.Etryexec.set_text(Entry.get("TryExec"))
710 | self.Sterminal.set_active(Entry.getboolean("Terminal"))
711 | self.Emimetypes.set_text(Entry.get("MimeType"))
712 | self.Ekeywords.set_text(Entry.get("Keywords", locale = True))
713 | self.Sstartupnotify.set_active(Entry.getboolean("StartupNotify"))
714 | self.Estartupwmclass.set_text(Entry.get("StartupWMClass"))
715 |
716 | if update_editor:
717 | if hasattr(Entry, 'faulty_text'):
718 | self.desktop_buffer.set_text(Entry.faulty_text)
719 | self.Ltype.set_text("")
720 | self.scrolledwindowactions.set_sensitive(False)
721 | self.scrolledwindowmore.set_sensitive(False)
722 | self.scrolledwindowprop.set_sensitive(False)
723 | self.categtree.set_sensitive(False)
724 | self.gridshow.set_sensitive(False)
725 | else:
726 | try:
727 | self.desktop_buffer.set_text(Entry.as_string())
728 | except: pass
729 |
730 | if update_actions:
731 | for child in self.Nactions.get_children(): self.Nactions.remove(child)
732 | for group in self.Entry.items():
733 | if "Desktop Action" in group:
734 | insert_action(self, group)
735 | self.Nactions.show_all()
736 | if self.pagenum < 4:
737 | self.Ruser.set_sensitive(False)
738 | self.Rsystem.set_sensitive(False)
739 | self.Bundo.set_sensitive(True)
740 | self.Bsave.set_sensitive(True)
741 | self.Mundo.set_sensitive(True)
742 | self.Msave.set_sensitive(True)
743 |
744 | def update_menu_objects(self):
745 | def disable_menu_objects(self):
746 | self.scrolledwindowmenu.set_sensitive(False)
747 | self.scrolledwindowinclude.set_sensitive(False)
748 | self.scrolledwindowlayout.set_sensitive(False)
749 | #self.scrolledwindowmenueditor.set_sensitive(False)
750 |
751 | if not self.menu:
752 | disable_menu_objects(self)
753 | else:
754 | self.scrolledwindowmenu.set_sensitive(True)
755 | self.scrolledwindowinclude.set_sensitive(True)
756 | self.scrolledwindowlayout.set_sensitive(True)
757 | #self.scrolledwindowmenueditor.set_sensitive(True)
758 | try:self.Emfile.set_text(self.menu.getroot().get("filename"))
759 | except: pass
760 | try:self.Emname.set_text(self.selected_menu.findtext("Name"))
761 | except:
762 | self.Emname.set_text("")
763 | pass
764 | try: self.Emdirectory.set_text(self.selected_menu.findall("Directory")[-1].text)
765 | except:
766 | self.Emdirectory.set_text("")
767 | pass
768 | try: self.Sdefaultappdirs.set_active(self.selected_menu.find("DefaultAppDirs") != None)
769 | except:
770 | self.Sdefaultappdirs.set_active(False)
771 | pass
772 | try: self.Sdefaultdirectorydirs.set_active(self.selected_menu.find("DefaultDirectoryDirs") != None)
773 | except:
774 | self.Sdefaultdirectorydirs.set_active(False)
775 | pass
776 | try: self.Sdefaultmergedirs.set_active(self.selected_menu.find("DefaultMergeDirs") != None)
777 | except:
778 | self.Sdefaultmergedirs.set_active(False)
779 | pass
780 | try: self.Skdelegacydirs.set_active(self.selected_menu.find("KDELegacyDirs") != None)
781 | except:
782 | self.Skdelegacydirs.set_active(False)
783 | pass
784 | try: self.Sonlyunallocated.set_active(self.selected_menu.find("OnlyUnallocated") != None)
785 | except:
786 | self.Sonlyunallocated.set_active(False)
787 | pass
788 | try: self.appdir_buffer.set_text("\n".join(elem.text for elem in self.selected_menu.findall("AppDir")))
789 | except:
790 | self.appdir_buffer.set_text("")
791 | pass
792 | try: self.directorydir_buffer.set_text("\n".join(elem.text for elem in self.selected_menu.findall("DirectoryDir")))
793 | except:
794 | self.directorydir_buffer.set_text("")
795 | pass
796 | try: self.mergedir_buffer.set_text("\n".join(elem.text for elem in self.selected_menu.findall("MergeDir")))
797 | except:
798 | self.mergedir_buffer.set_text("")
799 | pass
800 | try: self.mergefile_buffer.set_text("\n".join(elem.text for elem in self.selected_menu.findall("MergeFile")))
801 | except:
802 | self.mergefile_buffer.set_text("")
803 | pass
804 | try: self.legacydir_buffer.set_text("\n".join(elem.text for elem in self.selected_menu.findall("LegacyDir")))
805 | except:
806 | self.legacydir_buffer.set_text("")
807 | pass
808 | self.include_buffer.set_text("")
809 | try:
810 | root = self.selected_menu.findall("Include")[-1]
811 | self.include_buffer.set_text(self.prettystring(root))
812 | #for node in root:
813 | # self.include_buffer.insert(self.include_buffer.get_end_iter(), ET.tostring(node, encoding="unicode"))
814 | except:
815 | pass
816 | self.exclude_buffer.set_text("")
817 | try:
818 | root = self.selected_menu.findall("Exclude")[-1]
819 | self.exclude_buffer.set_text(self.prettystring(root))
820 | #for node in root:
821 | # self.exclude_buffer.insert(self.exclude_buffer.get_end_iter(), ET.tostring(node, encoding="unicode"))
822 | except:
823 | pass
824 | self.layout_buffer.set_text("")
825 | try:
826 | root = self.selected_menu.findall("Layout")[-1]
827 | self.layout_buffer.set_text(self.prettystring(root))
828 | #for node in root:
829 | # self.layout_buffer.insert(self.layout_buffer.get_end_iter(), ET.tostring(node, encoding="unicode"))
830 | except:
831 | pass
832 | self.defaultlayout_buffer.set_text("")
833 | try:
834 | root = self.selected_menu.findall("DefaultLayout")[-1]
835 | self.defaultlayout_buffer.set_text(self.prettystring(root))
836 | #for node in root:
837 | # self.defaultlayout_buffer.insert(self.defaultlayout_buffer.get_end_iter(), ET.tostring(node, encoding="unicode"))
838 | except:
839 | pass
840 | self.menu_buffer.set_text("")
841 | if self.selected_menu.tag == "Menu":
842 | self.menu_buffer.set_text(self.prettystring(self.selected_menu))
843 | else:
844 | self.menu_buffer.set_text(self.prettystring(self.menu.getroot()))
845 | disable_menu_objects(self)
846 | self.scrolledwindowmenueditor.set_sensitive(True)
847 |
848 | def change_tree(self, action):
849 | def iterate(treeiter, filename, action):
850 | while treeiter != None:
851 | deleted = False
852 | if self.deskstore.iter_has_child(treeiter):
853 | childiter = self.deskstore.iter_children(treeiter)
854 | iterate(childiter, filename, action)
855 | if self.deskstore[treeiter][d_local_path] == filename or self.deskstore[treeiter][d_system_path] == filename:
856 | if action == "update":
857 | self.deskstore[treeiter] = self.deskstore[self.desktree.get_cursor()[0]][:]
858 | elif action == "delete":
859 | self.deskstore.remove(treeiter)
860 | deleted = True
861 | if not deleted: treeiter = self.deskstore.iter_next(treeiter)
862 |
863 | path = self.desktree.get_cursor()[0]
864 | rootiter = self.deskstore.get_iter_first()
865 | if self.deskstore[self.desktree.get_cursor()[0]][d_system_path] == "":
866 | filename = self.deskstore[self.desktree.get_cursor()[0]][d_local_path]
867 | else:
868 | filename = self.deskstore[self.desktree.get_cursor()[0]][d_system_path]
869 | iterate(rootiter, filename, action)
870 | try: self.desktree.set_cursor(path)
871 | except: pass
872 |
873 | def read_entry(self, desk_file):
874 | if desk_file[i_local] == "":
875 | Entry = DE(desk_file[i_system])
876 | local_icon = None
877 | else:
878 | Entry = DE(desk_file[i_local])
879 | local_icon = self.load_icon("user-home")
880 | return Entry, local_icon
881 |
882 | def load_icon(self, icon):
883 | pixbuf = None
884 | if self.default_theme.lookup_icon(icon, self.icon_size, 0):
885 | try: pixbuf = self.default_theme.load_icon(icon, self.icon_size, 0).scale_simple(self.icon_size, self.icon_size, GdkPixbuf.InterpType.BILINEAR)
886 | except: pixbuf = None
887 | elif os.path.isfile(icon):
888 | try: pixbuf = GdkPixbuf.Pixbuf.new_from_file(icon).scale_simple(self.icon_size, self.icon_size, GdkPixbuf.InterpType.BILINEAR)
889 | except: pixbuf = None
890 | else:
891 | try:
892 | for path in self.xdg_data_dirs:
893 | for folder in ("pixmaps", "app-install/icons"):
894 | icon_path = os.path.join(path, folder, icon)
895 | if os.path.isfile(icon_path):
896 | try: pixbuf = GdkPixbuf.Pixbuf.new_from_file(icon_path).scale_simple(self.icon_size, self.icon_size, GdkPixbuf.InterpType.BILINEAR)
897 | except: pixbuf = None
898 | raise
899 | except: pass
900 | return pixbuf
901 |
902 | def load_menu(self):
903 | def load_unity_menu(self):
904 | menus = {
905 | "Accessories": ["'Utility' in categories and not 'Accessibility' in categories", "['Utility']", "['Accessibility']"],
906 | "Education": ["'Education' in categories and not 'Science' in categories", "['Education']", "['Science']"],
907 | "Games": ["'Game' in categories", "['Game']", "[]"],
908 | "Graphics": ["'Graphics' in categories", "['Graphics']", "[]"],
909 | "Internet": ["'Network' in categories", "['Network']", "[]"],
910 | "Fonts": ["'Fonts' in categories", "['Fonts']", "[]"],
911 | "Office": ["'Office' in categories", "['Office']", "[]"],
912 | "Media": ["'AudioVideo' in categories", "['AudioVideo']", "[]"],
913 | "Customization": ["'Settings' in categories", "['Settings']", "[]"],
914 | "Accessibility": ["'Accessibility' in categories and not 'Settings' in categories", "['Accessibility']", "['Settings']"],
915 | "Developer": ["'Development' in categories", "['Development']", "[]"],
916 | "Science & Engineering": ["'Science' in categories or 'Engineering' in categories", "['Science', 'Engineering']", "[]"],
917 | "System": ["'System' in categories or 'Security' in categories", "['System', 'Security']", "[]"]
918 | }
919 |
920 | desk_files = self.load_deskfiles()
921 | gettext.textdomain("unity")
922 | menuname = "All"
923 | rootiter = self.deskstore.append(None, [_(menuname), "0", self.load_icon("applications-other"), "", "", None, True, False, _(menuname)])
924 | for desk_file in desk_files:
925 | try:
926 | Entry, local_icon = self.read_entry(desk_file)
927 | name = Entry.get("Name", locale = True)
928 | treeiter = self.deskstore.append(rootiter,[name, name, self.load_icon(Entry.get("Icon", locale = True)), desk_file[i_local], desk_file[i_system], local_icon, not Entry.getboolean("NoDisplay"), True, desk_file[i_filename]])
929 | except: pass
930 | for menuname in menus:
931 | gettext.textdomain("unity-lens-applications")
932 | self.categstore.append([False, _(menuname), menus[menuname][0], menus[menuname][1], menus[menuname][2]])
933 | menuiter = self.deskstore.append(None, [_(menuname), _(menuname), self.load_icon("applications-other"), "", "", None, True, False, _(menuname)])
934 | for desk_file in desk_files:
935 | try:
936 | Entry, local_icon = self.read_entry(desk_file)
937 | categories = Entry.getlist("Categories")
938 | if eval(menus[menuname][0]): treeiter = self.deskstore.append(menuiter, [Entry.get("Name", locale = True), Entry.get("Name", locale = True), self.load_icon(Entry.get("Icon", locale = True)), desk_file[i_local], desk_file[i_system], local_icon, not Entry.getboolean("NoDisplay"), True, desk_file[i_filename]])
939 | except: pass
940 | gettext.textdomain(LOCALE_DOMAIN)
941 | self.deskstore.set_sort_column_id(1, Gtk.SortType.ASCENDING)
942 |
943 | def load_apps(self):
944 | menus = {
945 | "AudioVideo": ["'AudioVideo' in categories", "['AudioVideo']", "[]"],
946 | "Audio": ["'Audio' in categories and 'AudioVideo' in categories", "['Audio', 'AudioVideo']", "[]"],
947 | "Video": ["'Video' in categories and 'AudioVideo' in categories", "['Video', 'AudioVideo']", "[]"],
948 | "Development": ["'Development' in categories", "['Development']", "[]"],
949 | "Education": ["'Education' in categories", "['Education']", "[]"],
950 | "Game": ["'Game' in categories", "['Game']", "[]"],
951 | "Graphics": ["'Graphics' in categories", "['Graphics']", "[]"],
952 | "Network": ["'Network' in categories", "['Network']", "[]"],
953 | "Office": ["'Office' in categories", "['Office']", "[]"],
954 | "Science": ["'Science' in categories", "['Science']", "[]"],
955 | "Settings": ["'Settings' in categories", "['Settings']", "[]"],
956 | "System": ["'System' in categories", "['System']", "[]"],
957 | "Utility": ["'Utility' in categories", "['Utility']", "[]"]
958 | }
959 |
960 | desk_files = self.load_deskfiles()
961 | for desk_file in desk_files:
962 | try:
963 | Entry, local_icon = self.read_entry(desk_file)
964 | name = Entry.get("Name", locale = True)
965 | treeiter = self.deskstore.append(None,[name, name, self.load_icon(Entry.get("Icon", locale = True)), desk_file[i_local], desk_file[i_system], local_icon, not Entry.getboolean("NoDisplay"), True, desk_file[i_filename]])
966 | except: pass
967 | for menuname in menus:
968 | gettext.textdomain("unity-lens-applications")
969 | self.categstore.append([False, _(menuname), menus[menuname][0], menus[menuname][1], menus[menuname][2]])
970 | gettext.textdomain(LOCALE_DOMAIN)
971 | self.deskstore.set_sort_column_id(1, Gtk.SortType.ASCENDING)
972 |
973 | def load_freedesktop(self):
974 | def load_dirfiles(self):
975 | dirfilenames = []
976 | dir_system = []
977 | dir_user = []
978 | dir_files = []
979 | for data_dir in self.xdg_data_dirs:
980 | data_dir = os.path.join(data_dir, "desktop-directories")
981 | if "/." in data_dir:
982 | for path, dirnames, filenames in os.walk(data_dir):
983 | for filename in fnmatch.filter(filenames, "*.directory"):
984 | dir_user.append(os.path.join(path, filename))
985 | else:
986 | for path, dirnames, filenames in os.walk(data_dir):
987 | for filename in fnmatch.filter(filenames, "*.directory"):
988 | dir_file = os.path.join(path, filename)
989 | dirfilename = os.path.basename(dir_file)
990 | if not dirfilename in dirfilenames:
991 | dir_system.append(dir_file)
992 | dirfilenames.append(dirfilename)
993 | for user_file in dir_user:
994 | try:
995 | for system_file in dir_system:
996 | if os.path.basename(system_file) == os.path.basename(user_file):
997 | dir_files.append([os.path.basename(user_file), user_file, system_file])
998 | dir_system.remove(system_file)
999 | raise
1000 | dir_files.append([os.path.basename(user_file), user_file, ""])
1001 | except: pass
1002 | for system_file in dir_system: dir_files.append([os.path.basename(system_file), "", system_file])
1003 | return dir_files
1004 |
1005 | def load_menufiles(self):
1006 | menufilenames = []
1007 | menu_system = []
1008 | menu_user = []
1009 | menu_files = []
1010 | for data_dir in self.xdg_config_dirs:
1011 | data_dir = os.path.join(data_dir, "menus")
1012 | for path, dirnames, filenames in os.walk(data_dir):
1013 | for filename in fnmatch.filter(filenames, "*.menu"):
1014 | menu_files.append(os.path.join(path, filename))
1015 | return menu_files
1016 |
1017 | def load_tree(root, parent):
1018 | treeroot = None
1019 | if root.tag == "root":
1020 | if "/." in root.get("filename"): local_icon = self.load_icon("user-home")
1021 | else: local_icon = None
1022 | treeroot = self.deskstore.append(parent,[os.path.basename(root.get("filename")), os.path.basename(root.get("filename")), None, root.get("filename"), root.get("filename"), local_icon, True, False, None])
1023 | else:
1024 | Name = root.findtext("Name")
1025 | Directory = None
1026 | if root.findall("Directory"): Directory = root.findall("Directory")[-1].text
1027 | if Directory:
1028 | for dir_file in dir_files:
1029 | if Directory == dir_file[i_filename]:
1030 | try:
1031 | Entry, local_icon = self.read_entry(dir_file)
1032 | treeroot = self.deskstore.append(parent,[Entry.get("Name", locale = True), Entry.get("Name", locale = True), self.load_icon(Entry.get("Icon", locale = True)), dir_file[i_local], dir_file[i_system], local_icon, not Entry.getboolean("NoDisplay"), parent, Name])
1033 | except: pass
1034 | break
1035 | else:
1036 | treeroot = self.deskstore.append(parent,[Name, Name, None, "", "", None, True, parent, Name])
1037 | if not treeroot: treeroot = self.deskstore.append(parent,[Name, Name, None, "", "", None, True, False, Name])
1038 | Menus = root.findall("Menu")
1039 | for menu in Menus:
1040 | #try:
1041 | load_tree(menu, treeroot)
1042 | #except:bpass
1043 |
1044 | menu_files = load_menufiles(self)
1045 | dir_files = load_dirfiles(self)
1046 | try: self.config.add_section("menus")
1047 | except: pass
1048 | for menu_file in menu_files:
1049 | try:
1050 | if not(self.config.has_option("menus", menu_file)):
1051 | with open(menu_file, "r") as menu: data=menu.read()
1052 | self.config.set("menus", menu_file, data)
1053 | if not os.path.exists(os.path.dirname(self.config_file)): os.mkdir(os.path.dirname(self.config_file))
1054 | with open(self.config_file, "w") as config_file: self.config.write(config_file)
1055 | try:
1056 | self.menu_filename = menu_file
1057 | self.menu = ET.parse(self.menu_filename, parser=ET.XMLParser(target=MyTreeBuilder()))
1058 | self.menu.getroot().set("filename", menu_file)
1059 | load_tree(self.menu.getroot(), None)
1060 | except: pass
1061 | except: pass
1062 |
1063 | self.desktree.grab_focus()
1064 | load = Loading()
1065 | load.Wloading.set_transient_for(self.window)
1066 | load.Wloading.show()
1067 | while Gtk.events_pending(): Gtk.main_iteration()
1068 | self.desktree.disconnect(self.id_desktree_cursor_changed)
1069 | self.desktree.freeze_child_notify()
1070 | self.desktree.set_model(None)
1071 | self.desktree.set_visible(False)
1072 | self.deskstore.clear()
1073 | self.categstore.clear()
1074 | self.deskstore.set_default_sort_func(lambda *unused: 0)
1075 | self.deskstore.set_sort_column_id(-1, Gtk.SortType.ASCENDING)
1076 | self.categstore.set_sort_column_id(1, Gtk.SortType.ASCENDING)
1077 | self.Entry = None
1078 | self.menu = None
1079 | self.menu_filename = None
1080 | self.update_objects()
1081 | self.update_menu_objects()
1082 | if self.desktop == "Unity": load_unity_menu(self)
1083 | elif self.desktop == "Apps": load_apps(self)
1084 | else: load_freedesktop(self)
1085 | self.desktree.set_model(self.deskstore)
1086 | self.desktree.set_visible(True)
1087 | self.desktree.thaw_child_notify()
1088 | self.id_desktree_cursor_changed = self.desktree.connect("cursor-changed", self.on_desktree_cursor_changed)
1089 | load.Wloading.destroy()
1090 | self.scrolledwindowmenu.set_visible(self.menu != None)
1091 | self.scrolledwindowinclude.set_visible(self.menu != None)
1092 | self.scrolledwindowlayout.set_visible(self.menu != None)
1093 | self.scrolledwindowmenueditor.set_visible(self.menu != None)
1094 | self.categtree.set_visible(self.menu == None)
1095 | self.scrolledwindowactions.set_visible(self.menu == None)
1096 |
1097 | def load_deskfiles(self):
1098 | def get_desktopfileid(self, desktop_file_path):
1099 | head, desktopfileid = os.path.split(desktop_file_path)
1100 | while True:
1101 | head, tail = os.path.split(head)
1102 | if tail != "applications" and head != "": desktopfileid = tail + "-" + desktopfileid
1103 | else: break
1104 | return desktopfileid
1105 |
1106 | desktopfileids = []
1107 | desk_system = []
1108 | desk_user = []
1109 | desk_files = []
1110 | for data_dir in self.xdg_data_dirs:
1111 | data_dir = os.path.join(data_dir, "applications")
1112 | if "/." in data_dir:
1113 | for path, dirnames, filenames in os.walk(data_dir):
1114 | for filename in fnmatch.filter(filenames, "*.desktop"):
1115 | desk_user.append(os.path.join(path, filename))
1116 | else:
1117 | for path, dirnames, filenames in os.walk(data_dir):
1118 | for filename in fnmatch.filter(filenames, "*.desktop"):
1119 | desk_file = os.path.join(path, filename)
1120 | desktopfileid = get_desktopfileid(self, desk_file)
1121 | if not desktopfileid in desktopfileids:
1122 | desk_system.append(desk_file)
1123 | desktopfileids.append(desktopfileid)
1124 | for user_file in desk_user:
1125 | try:
1126 | for system_file in desk_system:
1127 | if get_desktopfileid(self, system_file) == get_desktopfileid(self, user_file):
1128 | desk_files.append([get_desktopfileid(self, user_file), user_file, system_file])
1129 | desk_system.remove(system_file)
1130 | raise
1131 | desk_files.append([get_desktopfileid(self, user_file), user_file, ""])
1132 | except: pass
1133 | for system_file in desk_system: desk_files.append([get_desktopfileid(self, system_file), "", system_file])
1134 | return desk_files
1135 |
1136 | def __init__(self):
1137 | def load_objects(self, builder):
1138 | self.window = builder.get_object("window")
1139 | self.deskstore = builder.get_object("deskstore")
1140 | self.destore = builder.get_object("destore")
1141 | self.categstore = builder.get_object("categstore")
1142 | self.desktree = builder.get_object("desktree")
1143 | self.desktreecol1 = builder.get_object("desktreecol1")
1144 | self.desktreecol1.set_resizable(True)
1145 | self.desktreecol2 = builder.get_object("desktreecol2")
1146 | self.categtree = builder.get_object("categtree")
1147 | self.gridshow = builder.get_object("gridshow")
1148 | self.showtree = builder.get_object("showtree")
1149 | self.showtreeselection = builder.get_object("showtreeselection")
1150 | self.paned = builder.get_object("paned")
1151 | #self.desktop = builder.get_object("desktop")
1152 | self.notebook = builder.get_object("notebook")
1153 | self.scrolledwindowmenu = builder.get_object("scrolledwindowmenu")
1154 | self.scrolledwindowinclude = builder.get_object("scrolledwindowinclude")
1155 | self.scrolledwindowlayout = builder.get_object("scrolledwindowlayout")
1156 | self.scrolledwindowmenueditor = builder.get_object("scrolledwindowmenueditor")
1157 | self.scrolledwindowprop = builder.get_object("scrolledwindowprop")
1158 | self.scrolledwindowmore = builder.get_object("scrolledwindowmore")
1159 | self.scrolledwindowactions = builder.get_object("scrolledwindowactions")
1160 | self.scrolledwindoweditor = builder.get_object("scrolledwindoweditor")
1161 | self.desktop_buffer = builder.get_object("desktop_buffer")
1162 | self.Efile = builder.get_object("Efile")
1163 | self.Ltype = builder.get_object("Ltype")
1164 | self.Ename = builder.get_object("Ename")
1165 | self.Ename.key = "Name"
1166 | self.Ename.locale = "True"
1167 | self.Egenericname = builder.get_object("Egenericname")
1168 | self.Egenericname.key = "GenericName"
1169 | self.Egenericname.locale = "True"
1170 | self.Snodisplay = builder.get_object("Snodisplay")
1171 | self.Snodisplay.key = "NoDisplay"
1172 | self.Eexec = builder.get_object("Eexec")
1173 | self.Eexec.key = "Exec"
1174 | self.Lexec = builder.get_object("Lexec")
1175 | self.Epath = builder.get_object("Epath")
1176 | self.Epath.key = "Path"
1177 | self.Lpath = builder.get_object("Lpath")
1178 | self.Eicon = builder.get_object("Eicon")
1179 | self.Eicon.key = "Icon"
1180 | self.Eicon.locale = "True"
1181 | self.Licon = builder.get_object("Eicon")
1182 | self.Bexec = builder.get_object("Bexec")
1183 | self.Bexec.msg = _("Choose a file")
1184 | self.Bexec.action = Gtk.FileChooserAction.OPEN
1185 | self.Bexec.entry = self.Eexec
1186 | self.Bpath = builder.get_object("Bpath")
1187 | self.Bpath.msg = _("Choose a folder")
1188 | self.Bpath.action = Gtk.FileChooserAction.SELECT_FOLDER
1189 | self.Bpath.entry = self.Epath
1190 | self.Bicon = builder.get_object("Bicon")
1191 | self.Bicon.msg = _("Choose an icon file")
1192 | self.Bicon.action = Gtk.FileChooserAction.OPEN
1193 | self.Bicon.entry = self.Eicon
1194 | self.Bicon1 = builder.get_object("Bicon1")
1195 | self.Bicon1.msg = _("Choose a system icon")
1196 | self.Bicon1.entry = self.Eicon
1197 | self.Ecomment = builder.get_object("Ecomment")
1198 | self.Ecomment.key = "Comment"
1199 | self.Ecomment.locale = "Comment"
1200 | self.Eurl = builder.get_object("Eurl")
1201 | self.Eurl.key = "URL"
1202 | self.Lurl = builder.get_object("Lurl")
1203 | self.Ronlyshowin = builder.get_object("Ronlyshowin")
1204 | self.Rnotshowin = builder.get_object("Rnotshowin")
1205 | self.categtreecellrenderertoggle = builder.get_object("categtreecellrenderertoggle")
1206 | self.showtreecellrenderertoggle = builder.get_object("showtreecellrenderertoggle")
1207 | self.Eversion = builder.get_object("Eversion") #more
1208 | self.Eversion.key = "Version"
1209 | self.Shidden = builder.get_object("Shidden")
1210 | self.Shidden.key = "Hidden"
1211 | self.Etryexec = builder.get_object("Etryexec")
1212 | self.Etryexec.key = "TryExec"
1213 | self.Ltryexec = builder.get_object("Ltryexec")
1214 | self.Btryexec = builder.get_object("Btryexec")
1215 | self.Btryexec.msg = _("Choose a file")
1216 | self.Btryexec.action = Gtk.FileChooserAction.OPEN
1217 | self.Btryexec.entry = self.Etryexec
1218 | self.Sterminal = builder.get_object("Sterminal")
1219 | self.Sterminal.key = "Terminal"
1220 | self.Lterminal = builder.get_object("Lterminal")
1221 | self.Lmimetypes = builder.get_object("Lmimetypes")
1222 | self.Emimetypes = builder.get_object("Emimetypes")
1223 | self.Emimetypes.key = "MimeType"
1224 | self.Lkeywords = builder.get_object("Lkeywords")
1225 | self.Ekeywords = builder.get_object("Ekeywords")
1226 | self.Ekeywords.key = "Keywords"
1227 | self.Lstartupnotify = builder.get_object("Lstartupnotify")
1228 | self.Sstartupnotify = builder.get_object("Sstartupnotify")
1229 | self.Sstartupnotify.key = "StartupNotify"
1230 | self.Lstartupwmclass = builder.get_object("Lstartupwmclass")
1231 | self.Estartupwmclass = builder.get_object("Estartupwmclass")
1232 | self.Estartupwmclass.key = "StartupWMClass"
1233 | self.desktop_view = builder.get_object("desktop_view")
1234 | self.desktop_buffer = builder.get_object("desktop_buffer")
1235 | self.Box_buttons = builder.get_object("Box_buttons")
1236 | self.Ruser = builder.get_object("Ruser")
1237 | self.Rsystem = builder.get_object("Rsystem")
1238 | self.Bundo = builder.get_object("Bundo")
1239 | self.Bsave = builder.get_object("Bsave")
1240 | self.Mnew = builder.get_object("Mnew")
1241 | self.Msave = builder.get_object("Msave")
1242 | self.Mdelete = builder.get_object("Mdelete")
1243 | self.Mvalidate = builder.get_object("Mvalidate")
1244 | self.Mrefresh = builder.get_object("Mrefresh")
1245 | self.Mquit = builder.get_object("Mquit")
1246 | self.Mundo = builder.get_object("Mundo")
1247 | self.Mcut = builder.get_object("Mcut")
1248 | self.Mcopy = builder.get_object("Mcopy")
1249 | self.Mpaste = builder.get_object("Mpaste")
1250 | self.Mpreferences = builder.get_object("Mpreferences")
1251 | self.Mabout = builder.get_object("Mabout")
1252 | self.Bactionadd = builder.get_object("Bactionadd")
1253 | self.Bactionremove = builder.get_object("Bactionremove")
1254 | self.Nactions = builder.get_object("Nactions")
1255 |
1256 | self.Emfile = builder.get_object("Emfile")
1257 | self.Emname = builder.get_object("Emname")
1258 | self.Emname.tag = "Name"
1259 | self.Emdirectory = builder.get_object("Emdirectory")
1260 | self.Emdirectory.tag = "Directory"
1261 | self.Sdefaultappdirs = builder.get_object("Sdefaultappdirs")
1262 | self.Sdefaultappdirs.tag = "DefaultAppDirs"
1263 | self.Sdefaultdirectorydirs = builder.get_object("Sdefaultdirectorydirs")
1264 | self.Sdefaultdirectorydirs.tag = "DefaultDirectoryDirs"
1265 | self.Sdefaultmergedirs = builder.get_object("Sdefaultmergedirs")
1266 | self.Sdefaultmergedirs.tag = "DefaultMergeDirs"
1267 | self.Skdelegacydirs = builder.get_object("Skdelegacydirs")
1268 | self.Skdelegacydirs.tag = "KDELegacyDirs"
1269 | self.Sonlyunallocated = builder.get_object("Sonlyunallocated")
1270 | self.Sonlyunallocated.tag = "OnlyUnallocated"
1271 | self.appdir_view = builder.get_object("appdir_view")
1272 | self.appdir_view.tag = "AppDir"
1273 | self.appdir_view.buffer_changed = False
1274 | self.appdir_buffer = builder.get_object("appdir_buffer")
1275 | self.appdir_buffer.view = self.appdir_view
1276 | self.directorydir_view = builder.get_object("directorydir_view")
1277 | self.directorydir_view.tag = "DirectoryDir"
1278 | self.directorydir_view.buffer_changed = False
1279 | self.directorydir_buffer = builder.get_object("directorydir_buffer")
1280 | self.directorydir_buffer.view = self.directorydir_view
1281 | self.mergedir_view = builder.get_object("mergedir_view")
1282 | self.mergedir_view.tag = "MergeDir"
1283 | self.mergedir_view.buffer_changed = False
1284 | self.mergedir_buffer = builder.get_object("mergedir_buffer")
1285 | self.mergedir_buffer.view = self.mergedir_view
1286 | self.mergefile_view = builder.get_object("mergefile_view")
1287 | self.mergefile_view.tag = "MergeFile"
1288 | self.mergefile_view.buffer_changed = False
1289 | self.mergefile_buffer = builder.get_object("mergefile_buffer")
1290 | self.mergefile_buffer.view = self.mergefile_view
1291 | self.legacydir_view = builder.get_object("legacydir_view")
1292 | self.legacydir_view.tag = "LegacyDir"
1293 | self.legacydir_view.buffer_changed = False
1294 | self.legacydir_buffer = builder.get_object("legacydir_buffer")
1295 | self.legacydir_buffer.view = self.legacydir_view
1296 | self.include_view = builder.get_object("include_view")
1297 | self.include_view.tag = "Include"
1298 | self.include_view.buffer_changed = False
1299 | self.include_buffer = builder.get_object("include_buffer")
1300 | self.include_buffer.view = self.include_view
1301 | self.exclude_view = builder.get_object("exclude_view")
1302 | self.exclude_view.tag = "Exclude"
1303 | self.exclude_view.buffer_changed = False
1304 | self.exclude_buffer = builder.get_object("exclude_buffer")
1305 | self.exclude_buffer.view = self.exclude_view
1306 | self.layout_view = builder.get_object("layout_view")
1307 | self.layout_view.tag = "Layout"
1308 | self.layout_view.buffer_changed = False
1309 | self.layout_buffer = builder.get_object("layout_buffer")
1310 | self.layout_buffer.view = self.layout_view
1311 | self.defaultlayout_view = builder.get_object("defaultlayout_view")
1312 | self.defaultlayout_view.tag = "DefaultLayout"
1313 | self.defaultlayout_view.buffer_changed = False
1314 | self.defaultlayout_buffer = builder.get_object("defaultlayout_buffer")
1315 | self.defaultlayout_buffer.view = self.defaultlayout_view
1316 | self.menu_view = builder.get_object("menu_view")
1317 | self.menu_view.buffer_changed = False
1318 | self.menu_view.tag = "MenuEditor"
1319 | self.menu_buffer = builder.get_object("menu_buffer")
1320 | self.menu_buffer.view = self.menu_view
1321 |
1322 | def load_prefs(self):
1323 | self.de_list = ["GNOME", "KDE", "LXDE", "MATE", "Razor", "ROX", "TDE", "Unity", "XFCE", "Cinnamon", "Old"]
1324 | self.desktop = os.environ.get('XDG_CURRENT_DESKTOP')
1325 | if self.desktop != "Unity": self.desktop = "Apps"
1326 | self.icon_size = 22
1327 |
1328 | xdg_data_home = os.environ.get("XDG_DATA_HOME") or os.path.join(os.path.expanduser("~"), ".local", "share")
1329 | try:
1330 | self.xdg_data_dirs = os.environ.get("XDG_DATA_DIRS").split(":") + [xdg_data_home]
1331 | except:
1332 | self.xdg_data_dirs = ("/usr/local/share:/usr/share").split(":") + [xdg_data_home]
1333 | pass
1334 |
1335 | xdg_config_home = os.environ.get("XDG_CONFIG_HOME") or os.path.join(os.path.expanduser("~"), ".config")
1336 | try:
1337 | self.xdg_config_dirs = os.environ.get("XDG_CONFIG_DIRS").split(":") + [xdg_config_home]
1338 | except:
1339 | self.xdg_config_dirs = ["/etc/xdg"] + [xdg_config_home]
1340 | pass
1341 |
1342 | self.xdg_data_dirs.reverse()
1343 | self.xdg_config_dirs.reverse()
1344 | self.data_home = xdg_data_home
1345 | for path in self.xdg_data_dirs:
1346 | if not "/." in path:
1347 | if os.path.isdir(os.path.join(path, "applications")) and os.path.isdir(os.path.join(path, "desktop-directories")):
1348 | self.data_dir = path
1349 | break
1350 |
1351 | self.default_theme = Gtk.IconTheme.get_default()
1352 |
1353 | for path in self.xdg_config_dirs:
1354 | if "/." in path: self.config_file = os.path.join(os.path.join(path, "ezame"), "preferences")
1355 | self.config = ConfigParser()
1356 | try:
1357 | self.config.read(self.config_file)
1358 | self.window.resize(int(self.config.get("window","width")), int(self.config.get("window","height")))
1359 | self.paned.set_position(int(self.config.get("paned","position")))
1360 | except: pass
1361 |
1362 | def load_signals(self):
1363 | self.window.connect("delete-event", self.gtk_main_quit)
1364 | self.id_desktree_cursor_changed = self.desktree.connect("cursor-changed", self.on_desktree_cursor_changed)
1365 | self.id_notebook_switch_page = self.notebook.connect("switch_page", self.on_notebook_switch_page)
1366 | self.id_Ename_changed = self.Ename.connect("changed", self.on_Entry_changed)
1367 | self.id_Egenericname_changed = self.Egenericname.connect("changed", self.on_Entry_changed)
1368 | self.id_Snodisplay_notify = self.Snodisplay.connect("notify::active", self.on_Switch_notify)
1369 | self.id_Eexec_changed = self.Eexec.connect("changed", self.on_Entry_changed)
1370 | self.id_Epath_changed = self.Epath.connect("changed", self.on_Entry_changed)
1371 | self.id_Eicon_changed = self.Eicon.connect("changed", self.on_Entry_changed)
1372 | self.id_Ecomment_changed = self.Ecomment.connect("changed", self.on_Entry_changed)
1373 | self.id_Eurl_changed = self.Eurl.connect("changed", self.on_Entry_changed)
1374 | self.id_Eversion_changed = self.Eversion.connect("changed", self.on_Entry_changed) #More...
1375 | self.id_Shidden_notify = self.Shidden.connect("notify::active", self.on_Switch_notify)
1376 | self.id_Etryexec_changed = self.Etryexec.connect("changed", self.on_Entry_changed)
1377 | self.id_Sterminal_notify = self.Sterminal.connect("notify::active", self.on_Switch_notify)
1378 | self.id_Emymetypes_changed = self.Emimetypes.connect("changed", self.on_Entry_changed)
1379 | self.id_Ekeywords_changed = self.Ekeywords.connect("changed", self.on_Entry_changed)
1380 | self.id_Sstartupnotify_notify = self.Sstartupnotify.connect("notify::active", self.on_Switch_notify)
1381 | self.id_Estartupwmclass_changed = self.Estartupwmclass.connect("changed", self.on_Entry_changed)
1382 | self.id_Bexec_clicked = self.Bexec.connect("clicked", self.on_BFileChooser_clicked)
1383 | self.id_Bpath_clicked = self.Bpath.connect("clicked", self.on_BFileChooser_clicked)
1384 | self.id_Bicon_clicked = self.Bicon.connect("clicked", self.on_BFileChooser_clicked)
1385 | self.id_Bicon1_clicked = self.Bicon1.connect("clicked", self.on_BIconChooser_clicked)
1386 | self.id_Btryexec_clicked = self.Btryexec.connect("clicked", self.on_BFileChooser_clicked)
1387 | self.id_Ronlyshowin_clicked = self.Ronlyshowin.connect("clicked", self.on_Rshowin__clicked)
1388 | self.id_Rnotshowin_clicked = self.Rnotshowin.connect("clicked", self.on_Rshowin__clicked)
1389 | self.id_categtreecellrenderertoggle_toggled = self.categtreecellrenderertoggle.connect("toggled", self.on_categtreecellrenderertoggle_toggled, self.categstore)
1390 | self.id_showtreecellrenderertoggle_toggled = self.showtreecellrenderertoggle.connect("toggled", self.on_showtreecellrenderertoggle_toggled, self.destore)
1391 | self.id_desktop_buffer_changed = self.desktop_buffer.connect("changed", self.on_desktop_buffer_changed)
1392 | self.id_desktop_view_focus_out_event = self.desktop_view.connect("focus-out-event", self.on_desktop_view_focus_out_event)
1393 | self.id_Ruser_clicked = self.Ruser.connect("clicked", self.on_Ruser_clicked)
1394 | self.id_Rsystem_clicked = self.Rsystem.connect("clicked", self.on_Rsystem_clicked)
1395 | self.id_Bundo_clicked = self.Bundo.connect("clicked", self.on_Bundo_clicked)
1396 | self.id_Bsave_clicked = self.Bsave.connect("clicked", self.on_Bsave_clicked)
1397 | self.id_Mnew_activate = self.Mnew.connect("activate", self.on_Mnew_activate)
1398 | self.id_Msave_activate = self.Msave.connect("activate", self.on_Bsave_clicked)
1399 | self.id_Mdelete_activate = self.Mdelete.connect("activate", self.on_Mdelete_activate)
1400 | self.id_Mvalidate_activate = self.Mvalidate.connect("activate", self.on_Mvalidate_activate)
1401 | self.id_Mrefresh_activate = self.Mrefresh.connect("activate", self.on_Mrefresh_activate)
1402 | self.id_Mquit_activate = self.Mquit.connect("activate", self.gtk_main_quit)
1403 | self.id_Mundo_activate = self.Mundo.connect("activate", self.on_Bundo_clicked)
1404 | self.id_Mcut_activate = self.Mcut.connect("activate", self.on_Mclipboard_activate)
1405 | self.id_Mcopy_activate = self.Mcopy.connect("activate", self.on_Mclipboard_activate)
1406 | self.id_Mpaste_activate = self.Mpaste.connect("activate", self.on_Mclipboard_activate)
1407 | self.id_Mpreferences_activate = self.Mpreferences.connect("activate", self.on_Mpreferences_activate)
1408 | self.id_Mabout_activate = self.Mabout.connect("activate", self.on_Mabout_activate)
1409 | self.id_Bactionadd_clicked = self.Bactionadd.connect("clicked", self.on_Bactionadd_clicked)
1410 | self.id_Bactionremove_clicked = self.Bactionremove.connect("clicked", self.on_Bactionremove_clicked)
1411 |
1412 | self.id_Emname_changed = self.Emname.connect("changed", self.on_menu_Entry_changed)
1413 | self.id_Emdirectory_changed = self.Emdirectory.connect("changed", self.on_menu_Entry_changed)
1414 |
1415 | self.id_Sdefaultappdirs_notify = self.Sdefaultappdirs.connect("notify::active", self.on_menu_Switch_notify)
1416 | self.id_Sdefaultdirectorydirs_notify = self.Sdefaultdirectorydirs.connect("notify::active", self.on_menu_Switch_notify)
1417 | self.id_Sdefaultmergedirs_notify = self.Sdefaultmergedirs.connect("notify::active", self.on_menu_Switch_notify)
1418 | self.id_Skdelegacydirs_notify = self.Skdelegacydirs.connect("notify::active", self.on_menu_Switch_notify)
1419 | self.id_Sonlyunallocated_notify = self.Sonlyunallocated.connect("notify::active", self.on_menu_Switch_notify)
1420 |
1421 | self.id_appdir_buffer_changed = self.appdir_buffer.connect("changed", self.on_menu_buffer_changed)
1422 | self.id_appdir_view_focus_out_event = self.appdir_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1423 | self.id_directorydir_buffer_changed = self.directorydir_buffer.connect("changed", self.on_menu_buffer_changed)
1424 | self.id_directorydir_view_focus_out_event = self.directorydir_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1425 | self.id_mergedir_buffer_changed = self.mergedir_buffer.connect("changed", self.on_menu_buffer_changed)
1426 | self.id_mergedir_view_focus_out_event = self.mergedir_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1427 | self.id_mergefile_buffer_changed = self.mergefile_buffer.connect("changed", self.on_menu_buffer_changed)
1428 | self.id_mergefile_view_focus_out_event = self.mergefile_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1429 | self.id_legacydir_buffer_changed = self.legacydir_buffer.connect("changed", self.on_menu_buffer_changed)
1430 | self.id_legacydir_view_focus_out_event = self.legacydir_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1431 | self.id_include_buffer_changed = self.include_buffer.connect("changed", self.on_menu_buffer_changed)
1432 | self.id_include_view_focus_out_event = self.include_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1433 | self.id_exclude_buffer_changed = self.exclude_buffer.connect("changed", self.on_menu_buffer_changed)
1434 | self.id_exclude_view_focus_out_event = self.exclude_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1435 | self.id_defaultlayout_buffer_changed = self.defaultlayout_buffer.connect("changed", self.on_menu_buffer_changed)
1436 | self.id_defaultlayout_view_focus_out_event = self.defaultlayout_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1437 | self.id_layout_buffer_changed = self.layout_buffer.connect("changed", self.on_menu_buffer_changed)
1438 | self.id_layout_view_focus_out_event = self.layout_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1439 | self.id_menu_buffer_changed = self.menu_buffer.connect("changed", self.on_menu_buffer_changed)
1440 | self.id_menu_view_focus_out_event = self.menu_view.connect("focus-out-event", self.on_menu_view_focus_out_event)
1441 |
1442 | builder = Gtk.Builder()
1443 | builder.set_translation_domain(LOCALE_DOMAIN)
1444 | builder.add_from_file(glade_path)
1445 | load_objects(self, builder)
1446 | load_prefs(self)
1447 | load_signals(self)
1448 | self.pagenum = 4
1449 | self.Entry = None
1450 | self.window.show()
1451 | self.load_menu()
1452 |
1453 | class NewEntry:
1454 | def __init__(self):
1455 | builder = Gtk.Builder()
1456 | builder.set_translation_domain(LOCALE_DOMAIN)
1457 | builder.add_from_file(glade_path)
1458 | self.Winput = builder.get_object("Winput")
1459 | self.Binputok = builder.get_object("Binputok")
1460 | self.Einputfile = builder.get_object("Einputfile")
1461 | self.Cinputtype = builder.get_object("Cinputtype")
1462 | self.id_Einputfile_changed = self.Einputfile.connect("changed", self.on_Einputfile_changed)
1463 |
1464 | def on_Einputfile_changed(self, obj):
1465 | self.Binputok.set_sensitive(not self.Einputfile.get_text() == "")
1466 |
1467 | class NewAction:
1468 | def __init__(self):
1469 | builder = Gtk.Builder()
1470 | builder.set_translation_domain(LOCALE_DOMAIN)
1471 | builder.add_from_file(glade_path)
1472 | self.Waction = builder.get_object("Waction")
1473 | self.Bactionok = builder.get_object("Bactionok")
1474 | self.Eaction = builder.get_object("Eaction")
1475 | self.id_Eaction_changed = self.Eaction.connect("changed", self.on_Eaction_changed)
1476 |
1477 | def on_Eaction_changed(self, obj):
1478 | self.Bactionok.set_sensitive(not self.Eaction.get_text() == "")
1479 |
1480 | class Preferences:
1481 | def __init__(self):
1482 | builder = Gtk.Builder()
1483 | builder.set_translation_domain(LOCALE_DOMAIN)
1484 | builder.add_from_file(glade_path)
1485 | self.Wpreferences = builder.get_object("Wpreferences")
1486 | self.Rubuntu = builder.get_object("Rubuntu")
1487 | self.Rmenu = builder.get_object("Rmenu")
1488 | self.Rapps = builder.get_object("Rapps")
1489 |
1490 | class Loading:
1491 | def __init__(self):
1492 | builder = Gtk.Builder()
1493 | builder.set_translation_domain(LOCALE_DOMAIN)
1494 | builder.add_from_file(glade_path)
1495 | self.Wloading = builder.get_object("Wloading")
1496 |
1497 | class run:
1498 | def __init__(self):
1499 | app = Ezame()
1500 | Gtk.main()
1501 |
1502 | if local:
1503 | app = Ezame()
1504 | Gtk.main()
1505 |
--------------------------------------------------------------------------------
/po/de.po:
--------------------------------------------------------------------------------
1 | # German translations for ezame package.
2 | # Deutsche Übersetzung für ezame.
3 | # Copyright (C)2020 Caldas Lopes
4 | # This file is distributed under the same license as the ezame package.
5 | #
6 | msgid ""
7 | msgstr ""
8 | "Project-Id-Version: ezame\n"
9 | "Report-Msgid-Bugs-To: \n"
10 | "POT-Creation-Date: 2020-10-12 09:34+0100\n"
11 | "PO-Revision-Date: 2013-06-23 15:15+0100\n"
12 | "Last-Translator: Michael Kogan \n"
13 | "Language-Team: \n"
14 | "Language: de\n"
15 | "MIME-Version: 1.0\n"
16 | "Content-Type: text/plain; charset=UTF-8\n"
17 | "Content-Transfer-Encoding: 8bit\n"
18 | "X-Generator: Poedit 1.5.5\n"
19 |
20 | #: ezame.glade:1394
21 | msgid ""
22 | " If a menu has a <DefaultLayout> element then this will override any "
23 | "default-layout specified by a parent menu. The default-layout defines the "
24 | "suggested layout if a <Menu> element does either not have <"
25 | "Layout> element or if it has an empty <Layout> element."
26 | msgstr ""
27 |
28 | #: ezame.glade:1395
29 | msgid ""
30 | " If a menu has a element then this will override any default-"
31 | "layout specified by a parent menu. The default-layout defines the suggested "
32 | "layout if a