Initial push

This commit is contained in:
itdominator 2023-10-22 20:14:19 -05:00
parent f82ac6b67e
commit 8aa3d96617
69 changed files with 3650 additions and 61 deletions

342
LICENSE
View File

@ -1,117 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
The precise terms and conditions for copying, distribution and modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -1,3 +1,16 @@
# GtkCodeThemer
GtkCodeThemer is a source code color scheme editor for GtkSourceView applications such as Gedit, Anjuta, and Scribes.
It is a standalone Python application, not a plugin, and (currently) requires Gtk 3.x.
temp
### Credit
Much of this code was taken, restructured, and fixed (last updated 11 years ago...) from <a href="https://github.com/jonocodes/GtkSourceSchemer">here</a>. It was made more pythonic in addition to being integrated with my personal code template project.
### Requirements
* PyGObject (Gtk introspection library)
* setproctitle (Define process title to search and kill more easily)
### Note
* Will eventually move to Gtk 4.
![GtkCodeThemer](images/pic1.png)

BIN
images/pic1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

4
requirements.txt Normal file
View File

@ -0,0 +1,4 @@
PyGObject
pyxdg
setproctitle
sqlmodel

59
src/__builtins__.py Normal file
View File

@ -0,0 +1,59 @@
# Python imports
import builtins
import threading
import sys
# Lib imports
# Application imports
from utils.event_system import EventSystem
from utils.endpoint_registry import EndpointRegistry
from utils.keybindings import Keybindings
from utils.logger import Logger
from utils.settings_manager.manager import SettingsManager
# NOTE: Threads WILL NOT die with parent's destruction.
def threaded_wrapper(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=False).start()
return wrapper
# NOTE: Threads WILL die with parent's destruction.
def daemon_threaded_wrapper(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True).start()
return wrapper
# NOTE: Just reminding myself we can add to builtins two different ways...
# __builtins__.update({"event_system": Builtins()})
builtins.app_name = "GtkCodeThemer"
builtins.keybindings = Keybindings()
builtins.event_system = EventSystem()
builtins.endpoint_registry = EndpointRegistry()
builtins.settings_manager = SettingsManager()
settings_manager.load_settings()
builtins.settings = settings_manager.settings
builtins.logger = Logger(settings_manager.get_home_config_path(), \
_ch_log_lvl=settings.debugging.ch_log_lvl, \
_fh_log_lvl=settings.debugging.fh_log_lvl).get_logger()
builtins.threaded = threaded_wrapper
builtins.daemon_threaded = daemon_threaded_wrapper
def custom_except_hook(exc_type, exc_value, exc_traceback):
if issubclass(exc_type, KeyboardInterrupt):
sys.__excepthook__(exc_type, exc_value, exc_traceback)
return
logger.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback))
sys.excepthook = custom_except_hook

3
src/__init__.py Normal file
View File

@ -0,0 +1,3 @@
"""
Start of package.
"""

53
src/__main__.py Normal file
View File

@ -0,0 +1,53 @@
#!/usr/bin/python3
# Python imports
import argparse
import faulthandler
import traceback
from setproctitle import setproctitle
import tracemalloc
tracemalloc.start()
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
from __builtins__ import *
from app import Application
if __name__ == "__main__":
''' Set process title, get arguments, and create GTK main thread. '''
try:
setproctitle(f'{app_name}')
faulthandler.enable() # For better debug info
parser = argparse.ArgumentParser()
# Add long and short arguments
parser.add_argument("--debug", "-d", default="false", help="Do extra console messaging.")
parser.add_argument("--trace-debug", "-td", default="false", help="Disable saves, ignore IPC lock, do extra console messaging.")
parser.add_argument("--no-plugins", "-np", default="false", help="Do not load plugins.")
parser.add_argument("--new-tab", "-nt", default="false", help="Opens a 'New Tab' if a handler is set for it.")
parser.add_argument("--file", "-f", default="default", help="JUST SOME FILE ARG.")
# Read arguments (If any...)
args, unknownargs = parser.parse_known_args()
if args.debug == "true":
settings_manager.set_debug(True)
if args.trace_debug == "true":
settings_manager.set_trace_debug(True)
settings_manager.do_dirty_start_check()
Application(args, unknownargs)
Gtk.main()
except Exception as e:
traceback.print_exc()
quit()

59
src/app.py Normal file
View File

@ -0,0 +1,59 @@
# Python imports
import signal
import os
# Lib imports
# Application imports
from utils.debugging import debug_signal_handler
from utils.ipc_server import IPCServer
from core.window import Window
class AppLaunchException(Exception):
...
class Application(IPCServer):
""" docstring for Application. """
def __init__(self, args, unknownargs):
super(Application, self).__init__()
if not settings_manager.is_trace_debug():
self.socket_realization_check()
if not self.is_ipc_alive:
for arg in unknownargs + [args.new_tab,]:
if os.path.isfile(arg):
message = f"FILE|{arg}"
self.send_ipc_message(message)
raise AppLaunchException(f"{app_name} IPC Server Exists: Will send path(s) to it and close...")
self.setup_debug_hook()
Window(args, unknownargs)
def socket_realization_check(self):
try:
self.create_ipc_listener()
except Exception:
self.send_test_ipc_message()
try:
self.create_ipc_listener()
except Exception as e:
...
def setup_debug_hook(self):
try:
# kill -SIGUSR2 <pid> from Linux/Unix or SIGBREAK signal from Windows
signal.signal(
vars(signal).get("SIGBREAK") or vars(signal).get("SIGUSR1"),
debug_signal_handler
)
except ValueError:
# Typically: ValueError: signal only works in main thread
...

3
src/core/__init__.py Normal file
View File

@ -0,0 +1,3 @@
"""
Core Module
"""

75
src/core/controller.py Normal file
View File

@ -0,0 +1,75 @@
# Python imports
import os
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
from .mixins.signals_mixins import SignalsMixins
from .controller_data import ControllerData
from .widgets.transparency_scale import TransparencyScale
class Controller(SignalsMixins, ControllerData):
def __init__(self, args, unknownargs):
self.setup_controller_data()
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
for arg in unknownargs + [args.new_tab,]:
if os.path.isfile(arg):
message = f"FILE|{arg}"
event_system.emit("post_file_to_ipc", message)
logger.info(f"Made it past {self.__class__} loading...")
def _setup_styling(self):
...
def _setup_signals(self):
self.window.connect("focus-out-event", self.unset_keys_and_data)
self.window.connect("key-press-event", self.on_global_key_press_controller)
self.window.connect("key-release-event", self.on_global_key_release_controller)
def _subscribe_to_events(self):
event_system.subscribe("shutting_down", lambda: print("Shutting down..."))
event_system.subscribe("handle_file_from_ipc", self.handle_file_from_ipc)
event_system.subscribe("remove_transparency", self._remove_transparency)
event_system.subscribe("update_transparency", self._update_transparency)
def setup_builder_and_container(self):
self.builder = Gtk.Builder()
self.builder.add_from_file(settings_manager.get_glade_file())
self.builder.expose_object("main_window", self.window)
settings_manager.set_builder(self.builder)
glade_box = self.builder.get_object("glade_box")
self.base_container = glade_box
self.ctx = self.base_container.get_style_context()
self.ctx.add_class(f"mw_transparency_{settings.theming.transparency}")
settings_manager.register_signals_to_builder([self, self.base_container])
TransparencyScale()
self.window.add(glade_box)
def _interactive_debug(self, widget = None, eve = None):
event_system.emit("load_interactive_debug")
def _remove_transparency(self):
self.ctx.remove_class(f"mw_transparency_{settings.theming.transparency}")
def _update_transparency(self):
self.ctx.add_class(f"mw_transparency_{settings.theming.transparency}")
def _close_app(self):
event_system.emit("tear_down")

174
src/core/controller_data.py Normal file
View File

@ -0,0 +1,174 @@
# Python imports
import os
import subprocess
import collections
import tempfile
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GtkSource', '4')
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GtkSource
# Application imports
class ControllerData:
''' ControllerData contains most of the state of the app at ay given time. It also has some support methods. '''
def setup_controller_data(self) -> None:
# Needed hack to get GtkSourceView widget to run from glade file...
GtkSource.View()
self.window = settings_manager.get_main_window()
self.builder = None
self.base_container = None
self.setup_builder_and_container()
self.was_midified_key = False
self.ctrl_down = False
self.shift_down = False
self.alt_down = False
self.language_id = 'c'
self.language_name = 'C'
self.black_color = Gdk.color_parse('#000000');
self.gui_style_ids = [
'bracket-match', 'bracket-mismatch',
'current-line', 'cursor', 'line-numbers',
'secondary-cursor', 'selection',
'selection-unfocused', 'text'
]
self.styles_list = self.builder.get_object('styles_list')
self.languages_list = self.builder.get_object('languages_list')
self.languages_dropdown = self.builder.get_object('languages_dropdown')
self.styles_treeview = self.builder.get_object('styles_treeview')
self.bold_tggle_btn = self.builder.get_object('bold_tggle_btn')
self.italic_tggle_btn = self.builder.get_object('italic_tggle_btn')
self.underline_tggle_btn = self.builder.get_object('underline_tggle_btn')
self.strikethrough_tggle_btn = self.builder.get_object('strikethrough_tggle_btn')
self.fr_check_btn = self.builder.get_object('fr_check_btn')
self.br_check_btn = self.builder.get_object('br_check_btn')
self.fr_color_btn = self.builder.get_object('fr_color_btn')
self.br_color_btn = self.builder.get_object('br_color_btn')
self.reset_btn = self.builder.get_object('reset_btn')
self.name_entry = self.builder.get_object('name_entry')
self.id_entry = self.builder.get_object('id_entry')
self.desc_entry = self.builder.get_object('desc_entry')
self.authr_entry = self.builder.get_object('authr_entry')
self.sample_lbl = self.builder.get_object('sample_lbl')
self.src_buffer = GtkSource.Buffer(max_undo_levels = 0)
self.src_preview = self.builder.get_object('src_preview')
self.scheme_manager = GtkSource.StyleSchemeManager()
self.language_manager = GtkSource.LanguageManager()
self.all_styles_dict = collections.OrderedDict()
self.language = self.language_manager.get_language(self.language_id)
self.current_lang_id = self.language_id
self.current_lang_name = self.language_name
self.orig_scheme_file = None
self.bold_tggl_handler = self.get_handler_id(self.bold_tggle_btn, 'toggled')
self.italic_tggl_handler = self.get_handler_id(self.italic_tggle_btn, 'toggled')
self.underline_tggl_handler = self.get_handler_id(self.underline_tggle_btn, 'toggled')
self.strikethrough_tggl_handler = self.get_handler_id(self.strikethrough_tggle_btn, 'toggled')
self.foreground_tggl_handler = self.get_handler_id(self.fr_check_btn, 'toggled')
self.background_tggl_handler = self.get_handler_id(self.br_check_btn, 'toggled')
# watch temp directory to help the sample viewer
self.scheme_manager.append_search_path( tempfile.gettempdir() )
self.src_preview.set_buffer(self.src_buffer)
self.load_initial_data()
def load_initial_data(self, from_file = None):
if from_file and os.path.isfile(from_file):
self.load_scheme(from_file)
else:
self.load_scheme('cobalt')
languages = self.language_manager.get_language_ids()
languages.sort()
self.lang_map_name_to_id = {}
self.languages_list.append(['Default styles'])
self.lang_map_name_to_id['Default styles'] = 'def'
for lang in languages:
lang_name = self.language_manager.get_language(lang).get_name()
self.lang_map_name_to_id[lang_name] = lang
if lang_name != 'Defaults':
self.languages_list.append([lang_name])
self.styles_treeview_selection = self.styles_treeview.get_selection()
self.styles_treeview_selection.connect('changed', self.on_style_selected)
# select the first language
self.languages_dropdown.set_active(0)
# select the first style
model = self.styles_treeview.get_model()
tree_iter = model.get_iter_first()
self.styles_treeview_selection.select_iter(tree_iter)
self.selected_style_id = model[tree_iter][0]
def get_handler_id(self, obj, signal_name):
signal_id, detail = GObject.signal_parse_name(signal_name, obj, True)
return GObject.signal_handler_find(obj, GObject.SignalMatchType.ID, signal_id, detail, None, None, None)
def get_base_container(self):
return self.base_container
def clear_console(self) -> None:
''' Clears the terminal screen. '''
os.system('cls' if os.name == 'nt' else 'clear')
def call_method(self, _method_name: str, data: type) -> type:
'''
Calls a method from scope of class.
Parameters:
a (obj): self
b (str): method name to be called
c (*): Data (if any) to be passed to the method.
Note: It must be structured according to the given methods requirements.
Returns:
Return data is that which the calling method gives.
'''
method_name = str(_method_name)
method = getattr(self, method_name, lambda data: f"No valid key passed...\nkey={method_name}\nargs={data}")
return method(*data) if data else method()
def has_method(self, obj: type, method: type) -> type:
''' Checks if a given method exists. '''
return callable(getattr(obj, method, None))
def clear_children(self, widget: type) -> None:
''' Clear children of a gtk widget. '''
for child in widget.get_children():
widget.remove(child)
def get_clipboard_data(self, encoding = "utf-8") -> str:
proc = subprocess.Popen(['xclip','-selection', 'clipboard', '-o'], stdout = subprocess.PIPE)
retcode = proc.wait()
data = proc.stdout.read()
return data.decode(encoding).strip()
def set_clipboard_data(self, data: type, encoding = "utf-8") -> None:
proc = subprocess.Popen(['xclip','-selection','clipboard'], stdin = subprocess.PIPE)
proc.stdin.write(data.encode(encoding))
proc.stdin.close()
retcode = proc.wait()

View File

@ -0,0 +1,3 @@
"""
Generic Mixins Module
"""

View File

@ -0,0 +1,3 @@
"""
Signals module
"""

View File

@ -0,0 +1,17 @@
# Python imports
# Lib imports
# Application imports
class IPCSignalsMixin:
""" IPCSignalsMixin handle messages from another starting solarfm process. """
def print_to_console(self, message=None):
logger.debug(message)
def handle_file_from_ipc(self, path: str) -> None:
logger.debug(f"File From IPC: {path}")

View File

@ -0,0 +1,94 @@
# Python imports
import re
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
# Application imports
valid_keyvalue_pat = re.compile(r"[a-z0-9A-Z-_\[\]\(\)\| ]")
class KeyboardSignalsMixin:
""" KeyboardSignalsMixin keyboard hooks controller. """
# TODO: Need to set methods that use this to somehow check the keybindings state instead.
def unset_keys_and_data(self, widget=None, eve=None):
self.ctrl_down = False
self.shift_down = False
self.alt_down = False
def on_global_key_press_controller(self, eve, user_data):
keyname = Gdk.keyval_name(user_data.keyval).lower()
modifiers = Gdk.ModifierType(user_data.get_state() & ~Gdk.ModifierType.LOCK_MASK)
self.was_midified_key = True if modifiers != 0 else False
if keyname.replace("_l", "").replace("_r", "") in ["control", "alt", "shift"]:
if "control" in keyname:
self.ctrl_down = True
if "shift" in keyname:
self.shift_down = True
if "alt" in keyname:
self.alt_down = True
def on_global_key_release_controller(self, widget, event):
""" Handler for keyboard events """
keyname = Gdk.keyval_name(event.keyval).lower()
modifiers = Gdk.ModifierType(event.get_state() & ~Gdk.ModifierType.LOCK_MASK)
if keyname.replace("_l", "").replace("_r", "") in ["control", "alt", "shift"]:
should_return = self.was_midified_key and (self.ctrl_down or self.shift_down or self.alt_down)
if "control" in keyname:
self.ctrl_down = False
if "shift" in keyname:
self.shift_down = False
if "alt" in keyname:
self.alt_down = False
# NOTE: In effect a filter after releasing a modifier and we have a modifier mapped
if should_return:
self.was_midified_key = False
return
mapping = keybindings.lookup(event)
logger.debug(f"on_global_key_release_controller > key > {keyname}")
logger.debug(f"on_global_key_release_controller > keyval > {event.keyval}")
logger.debug(f"on_global_key_release_controller > mapping > {mapping}")
if mapping:
# See if in controller scope
try:
getattr(self, mapping)()
return True
except Exception:
# Must be plugins scope, event call, OR we forgot to add method to controller scope
if "||" in mapping:
sender, eve_type = mapping.split("||")
else:
sender = ""
eve_type = mapping
self.handle_key_event_system(sender, eve_type)
else:
logger.debug(f"on_global_key_release_controller > key > {keyname}")
if self.ctrl_down:
if not keyname in ["1", "kp_1", "2", "kp_2", "3", "kp_3", "4", "kp_4"]:
self.handle_key_event_system(None, mapping)
else:
...
def handle_key_event_system(self, sender, eve_type):
event_system.emit(eve_type)
def keyboard_close_tab(self):
...

View File

@ -0,0 +1,37 @@
# Python imports
# Lib imports
# Application imports
from utils.style_properties import StyleProperties
from .widget_signals.list_signals_mixin import ListSignalsMixin
from .widget_signals.tggle_and_check_box_signals_mixin import TggleAndCheckBoxSignals
from .widget_signals.sourceview_signals_mixin import SourceviewSignalsMixin
from .widget_signals.dialog_signals_mixin import DialogSignalsMixin
class MainSignalsMixin(ListSignalsMixin, TggleAndCheckBoxSignals, SourceviewSignalsMixin, DialogSignalsMixin):
def on_style_changed(self, data):
if self.selected_style_id not in self.all_styles_dict:
self.all_styles_dict[self.selected_style_id] = StyleProperties()
color_scale = 255.0/65535.0
if data == self.br_color_btn:
color = data.get_color()
self.all_styles_dict[self.selected_style_id].background = ('#%02x%02x%02x' % (color.red * color_scale, color.green * color_scale, color.blue * color_scale))
elif data == self.fr_color_btn:
color = data.get_color()
self.all_styles_dict[self.selected_style_id].foreground = ('#%02x%02x%02x' % (color.red * color_scale, color.green * color_scale, color.blue * color_scale))
elif data == self.bold_tggle_btn:
self.all_styles_dict[self.selected_style_id].bold = data.get_active()
elif data == self.italic_tggle_btn:
self.all_styles_dict[self.selected_style_id].italic = data.get_active()
elif data == self.underline_tggle_btn:
self.all_styles_dict[self.selected_style_id].underline = data.get_active()
elif data == self.strikethrough_tggle_btn:
self.all_styles_dict[self.selected_style_id].strikethrough = data.get_active()
self.update_sample_view()

View File

@ -0,0 +1,3 @@
"""
Widget signals module
"""

View File

@ -0,0 +1,139 @@
# Python imports
import os
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
class DialogSignalsMixin():
def on_open_clicked(self, param):
file_chooser = Gtk.FileChooserDialog('Open', self.window, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
file_filter = Gtk.FileFilter()
file_filter.set_name('XML files')
file_filter.add_pattern('*.xml')
file_chooser.add_filter(file_filter)
file_filter = Gtk.FileFilter()
file_filter.set_name('All files')
file_filter.add_pattern('*')
file_chooser.add_filter(file_filter)
file_chooser.set_default_response(Gtk.ResponseType.OK)
file_chooser.set_current_folder(os.path.expanduser('~'))
path = None
response = file_chooser.run()
if response == Gtk.ResponseType.OK:
path = file_chooser.get_filename()
if path and not os.access(path, os.R_OK):
abspath = os.path.abspath(path)
self.message_dialog(Gtk.MessageType.ERROR, ('Could not open file "%s"') % abspath, ('The file "%s" could not be opened. ' 'Permission denied.') % abspath, file_chooser)
path = None
file_chooser.destroy()
if not path: return
self.load_scheme(path)
def on_save_clicked(self, param):
if not self.origSchemeFile:
filename = run_save_as_dialog(self.window, self.entryId.get_text() + '.xml')
if filename and not '.' in os.path.basename(filename):
filename = f"{filename}.xml"
if filename:
self.write_scheme(filename, self.entryId.get_text())
self.origSchemeFile = filename
else:
self.write_scheme(self.origSchemeFile, self.entryId.get_text())
def on_save_as_clicked(self, param):
filename = run_save_as_dialog(self.window, self.entryId.get_text() + '.xml')
if filename and not '.' in os.path.basename(filename):
filename = f"{filename}.xml"
if filename:
self.write_scheme(filename, self.entryId.get_text())
self.origSchemeFile = filename
def message_dialog(
dialog_type,
short_msg,
long_msg = None,
parent = None,
buttons = Gtk.ButtonsType.OK,
additional_buttons = None
):
dialog = Gtk.MessageDialog(parent = parent, flags = Gtk.DialogFlags.MODAL, type = dialog_type, buttons = buttons)
if additional_buttons:
dialog.add_buttons(*additional_buttons)
dialog.set_markup(short_msg)
if long_msg:
if isinstance(long_msg, Gtk.Widget):
widget = long_msg
elif isinstance(long_msg, str):
widget = Gtk.Label()
widget.set_markup(long_msg)
else:
raise TypeError('"long_msg" must be a Gtk.Widget or a string')
expander = Gtk.Expander(label = 'Click here for details')
expander.set_border_width(6)
expander.add(widget)
dialog.vbox.pack_end(expander, True, True, 0)
dialog.show_all()
response = dialog.run()
dialog.destroy()
return response
def run_save_as_dialog(parent, current_name):
file_chooser = Gtk.FileChooserDialog('Save As', parent, Gtk.FileChooserAction.SAVE, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
file_filter = Gtk.FileFilter()
file_filter.set_name('XML files')
file_filter.add_pattern('*.xml')
file_chooser.add_filter(file_filter)
file_filter = Gtk.FileFilter()
file_filter.set_name('All files')
file_filter.add_pattern('*')
file_chooser.add_filter(file_filter)
file_chooser.set_default_response(Gtk.ResponseType.OK)
file_chooser.set_current_folder( os.path.expanduser('~') )
if current_name:
file_chooser.set_current_name(current_name)
file_chooser.set_default_response(Gtk.ResponseType.OK)
path = None
while True:
response = file_chooser.run()
if response != Gtk.ResponseType.OK:
path = None
break
path = file_chooser.get_filename()
if not os.path.exists(path): break
sub_msg_1 = ('A file named "%s" already exists') % os.path.abspath(path)
sub_msg_2 = ('Do you which to replace it with the current project?')
text = '<span weight="bold" size="larger">%s</span>\n\n%s\n' % (sub_msg_1, sub_msg_2)
result = message_dialog(Gtk.MessageType.ERROR, text, parent = parent, buttons = Gtk.ButtonsType.NONE, additional_buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, 'Replace', Gtk.ResponseType.YES))
if result == Gtk.ResponseType.YES: break
file_chooser.destroy()
return path

View File

@ -0,0 +1,107 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gdk
# Application imports
from utils.languages import samples
class ListSignalsMixin:
def on_language_selected(self, combo):
tree_iter = combo.get_active_iter()
if tree_iter:
model = combo.get_model()
self.current_lang_name = model[tree_iter][0]
self.current_lang_id = self.lang_map_name_to_id[self.current_lang_name]
self.styles_list.clear()
remove_len = len(self.current_lang_id) + 1
lang = self.language_manager.get_language(self.current_lang_id)
if lang:
style_ids = lang.get_style_ids()
style_ids.sort()
if self.current_lang_id == 'def':
for style_id in self.gui_style_ids:
self.styles_list.append([style_id])
for style_id in style_ids:
self.styles_list.append([style_id[remove_len:]])
tree_iter = self.styles_treeview.get_model().get_iter_first()
self.styles_treeview_selection.select_iter(tree_iter)
model = self.styles_treeview.get_model()
self.selected_style_id = model[tree_iter][0]
if self.current_lang_id in samples:
self.src_buffer.set_language(lang);
self.src_buffer.set_text(samples[self.current_lang_id])
self.sample_lbl.set_text(f"{self.current_lang_name} sample")
else:
self.src_buffer.set_language(self.language);
self.src_buffer.set_text(samples[self.language_id])
self.sample_lbl.set_text(f"{self.language_name} sample")
def on_style_selected(self, selection):
model, tree_iter = selection.get_selected()
if not tree_iter: return
self.selected_style_id = f"{self.current_lang_id}:{model[tree_iter][0]}"
# handle the special case for GUI styles
if self.selected_style_id not in self.all_styles_dict and self.current_lang_id == 'def':
self.selected_style_id = model[tree_iter][0]
# block all the toggle handlers so they dont get triggered
self.bold_tggle_btn.handler_block(self.bold_tggl_handler)
self.italic_tggle_btn.handler_block(self.italic_tggl_handler)
self.underline_tggle_btn.handler_block(self.underline_tggl_handler)
self.strikethrough_tggle_btn.handler_block(self.strikethrough_tggl_handler)
self.fr_check_btn.handler_block(self.foreground_tggl_handler)
self.br_check_btn.handler_block(self.background_tggl_handler)
if self.selected_style_id in self.all_styles_dict:
this_style = self.all_styles_dict[self.selected_style_id]
# handle foreground and background colors
if this_style.foreground:
self.fr_color_btn.set_color(Gdk.color_parse(this_style.foreground))
self.fr_color_btn.set_sensitive(True)
self.fr_check_btn.set_active(True)
else:
self.fr_color_btn.set_color(self.black_color)
self.fr_color_btn.set_sensitive(False)
self.fr_check_btn.set_active(False)
if this_style.background:
self.br_color_btn.set_color(Gdk.color_parse(this_style.background))
self.br_color_btn.set_sensitive(True)
self.br_check_btn.set_active(True)
else:
self.br_color_btn.set_color(self.black_color)
self.br_color_btn.set_sensitive(False)
self.br_check_btn.set_active(False)
# handle text styling
self.italic_tggle_btn.set_active(this_style.italic)
self.bold_tggle_btn.set_active(this_style.bold)
self.strikethrough_tggle_btn.set_active(this_style.strikethrough)
self.underline_tggle_btn.set_active(this_style.underline)
self.reset_btn.set_sensitive(True)
else:
self.clear_and_disable_style_buttons()
self.bold_tggle_btn.handler_unblock(self.bold_tggl_handler)
self.italic_tggle_btn.handler_unblock(self.italic_tggl_handler)
self.underline_tggle_btn.handler_unblock(self.underline_tggl_handler)
self.strikethrough_tggle_btn.handler_unblock(self.strikethrough_tggl_handler)
self.fr_check_btn.handler_unblock(self.foreground_tggl_handler)
self.br_check_btn.handler_unblock(self.background_tggl_handler)

View File

@ -0,0 +1,107 @@
# Python imports
import os
import tempfile
from xml.etree import ElementTree as ET
# Lib imports
# Application imports
from utils.style_properties import StyleProperties
class SourceviewSignalsMixin:
def update_sample_view(self):
"""
Update the sample shown in the GUI.
To do this we must write the scheme to disk and reload it from there.
"""
self.write_scheme(self.temp_scheme_file, self.temp_scheme_id)
self.scheme_manager.force_rescan()
new_scheme = self.scheme_manager.get_scheme(self.temp_scheme_id)
self.src_buffer.set_style_scheme(new_scheme);
def load_scheme(self, scheme_id_or_file):
xml_tree = None
if os.path.isfile(scheme_id_or_file):
directory = os.path.dirname(scheme_id_or_file)
if directory not in self.scheme_manager.get_search_path():
self.scheme_manager.prepend_search_path(directory)
with open(scheme_id_or_file, 'r') as f:
xml_tree = ET.parse(f)
if xml_tree.getroot().tag == 'style-scheme':
this_scheme = self.scheme_manager.get_scheme( xml_tree.getroot().attrib['id'] )
if not this_scheme: return False
testFilename = this_scheme.get_filename()
if testFilename != scheme_id_or_file:
text = '<span weight="bold" size="larger">There was a problem opening the file</span>\n\nYou appear to have schemes with the same IDs in different directories\n'
self.message_dialog(Gtk.MessageType.ERROR, text, buttons = Gtk.ButtonsType.NONE, additional_buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
return False
self.orig_scheme_file = scheme_id_or_file
else:
this_scheme = self.scheme_manager.get_scheme(scheme_id_or_file)
if not this_scheme: return False
self.currentScheme = this_scheme
self.name_entry.set_text( this_scheme.get_name() )
self.authr_entry.set_text( ', '.join( this_scheme.get_authors() ) )
self.desc_entry.set_text( this_scheme.get_description() )
self.id_entry.set_text( this_scheme.get_id() )
scheme_file = self.currentScheme.get_filename()
with open(scheme_file, 'r') as f:
xml_tree = ET.parse(f)
style_elems = xml_tree.findall('style')
self.all_styles_dict.clear()
for style_elem in style_elems:
this_style = self.currentScheme.get_style(style_elem.attrib['name'])
styleProps = StyleProperties()
styleProps.from_gtk_source_style(this_style)
self.all_styles_dict[style_elem.attrib['name']] = styleProps;
self.src_buffer.set_style_scheme(self.currentScheme);
# set up temp file so the sample view can be updated
self.temp_scheme_id = f"{this_scheme.get_id()}_temp"
self.temp_scheme_file = f"{tempfile.gettempdir()}/{self.temp_scheme_id}.xml"
return True
def write_scheme(self, location, scheme_id):
output = f'<style-scheme name="{self.name_entry.get_text()}" id="{scheme_id}" version="1.0">\n'
output += f' <author> {self.authr_entry.get_text()}</author>\n'
output += f' <description>{self.desc_entry.get_text()}</description>\n\n'
for k, v in self.all_styles_dict.items():
output += f' <style name="{k}"\t'
if (v.foreground): output += f'foreground="{v.foreground}" '
if (v.background): output += f'background="{v.background}" '
if (v.italic): output += 'italic="true" '
if (v.bold): output += 'bold="true" '
if (v.underline): output += 'underline="true" '
if (v.strikethrough): output += 'strikethrough="true" '
output += '/>\n'
output += '</style-scheme>\n'
with open(location, 'w') as f:
try:
f.write(output)
except:
return False
return True

View File

@ -0,0 +1,47 @@
# Python imports
# Lib imports
# Application imports
class TggleAndCheckBoxSignals:
def on_reset_clicked(self, param):
if self.selected_style_id in self.all_styles_dict:
del self.all_styles_dict[self.selected_style_id]
self.clear_and_disable_style_buttons()
self.update_sample_view()
def on_background_toggled(self, param):
if param.get_active():
self.br_color_btn.set_sensitive(True)
self.br_color_btn.activate()
else:
self.br_color_btn.set_sensitive(False)
self.all_styles_dict[self.selected_style_id].background = None;
self.update_sample_view()
def on_foreground_toggled(self, param):
if param.get_active():
self.fr_color_btn.set_sensitive(True)
self.fr_color_btn.activate()
else:
self.fr_color_btn.set_sensitive(False)
self.all_styles_dict[self.selected_style_id].foreground = None;
self.update_sample_view()
def clear_and_disable_style_buttons(self):
self.fr_color_btn.set_color(self.black_color)
self.br_color_btn.set_color(self.black_color)
self.fr_color_btn.set_sensitive(False)
self.fr_check_btn.set_active(False)
self.br_color_btn.set_sensitive(False)
self.br_check_btn.set_active(False)
self.italic_tggle_btn.set_active(False)
self.bold_tggle_btn.set_active(False)
self.strikethrough_tggle_btn.set_active(False)
self.underline_tggle_btn.set_active(False)
self.reset_btn.set_sensitive(False)

View File

@ -0,0 +1,13 @@
# Python imports
# Lib imports
# Application imports
from .signals.ipc_signals_mixin import IPCSignalsMixin
from .signals.keyboard_signals_mixin import KeyboardSignalsMixin
from .signals.main_signals_mixin import MainSignalsMixin
class SignalsMixins(KeyboardSignalsMixin, IPCSignalsMixin, MainSignalsMixin):
...

View File

@ -0,0 +1,3 @@
"""
Widgets Module
"""

View File

@ -0,0 +1,3 @@
"""
Widgets.Controls Module
"""

View File

@ -0,0 +1,58 @@
# Python imports
import os
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Gio
# Application imports
class OpenFileButton(Gtk.Button):
"""docstring for OpenFileButton."""
def __init__(self):
super(OpenFileButton, self).__init__()
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
self._load_widgets()
def _setup_styling(self):
self.set_label("Open File(s)...")
self.set_image( Gtk.Image.new_from_icon_name("gtk-open", 4) )
self.set_always_show_image(True)
self.set_image_position(1) # Left - 0, Right = 1
self.set_hexpand(False)
def _setup_signals(self):
self.connect("button-release-event", self._open_files)
def _subscribe_to_events(self):
event_system.subscribe("open_files", self._open_files)
def _load_widgets(self):
...
def _open_files(self, widget = None, eve = None):
chooser = Gtk.FileChooserDialog("Open File...", None,
Gtk.FileChooserAction.OPEN,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
response = chooser.run()
if response == Gtk.ResponseType.OK:
filename = chooser.get_filename()
if filename:
path = filename if os.path.isabs(filename) else os.path.abspath(filename)
_gfile = Gio.File.new_for_path(path)
event_system.emit("keyboard_open_file", (_gfile,))
chooser.destroy()

View File

@ -0,0 +1,39 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
class SaveAsButton(Gtk.Button):
def __init__(self):
super(SaveAsButton, self).__init__()
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
self._load_widgets()
def _setup_styling(self):
self.set_label("Save As")
self.set_image( Gtk.Image.new_from_icon_name("gtk-save-as", 4) )
self.set_always_show_image(True)
self.set_image_position(1) # Left - 0, Right = 1
self.set_hexpand(False)
def _setup_signals(self):
self.connect("released", self._emit_save_as_eve)
def _subscribe_to_events(self):
...
def _load_widgets(self):
...
def _emit_save_as_eve(self, widget, eve = None):
event_system.emit('keyboard_save_file')

View File

@ -0,0 +1,67 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gio
# Application imports
class SaveFileDialog:
"""docstring for SaveFileDialog."""
def __init__(self):
super(SaveFileDialog, self).__init__()
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
self._load_widgets()
def _setup_styling(self):
...
def _setup_signals(self):
...
def _subscribe_to_events(self):
event_system.subscribe("save_file_dialog", self.save_file_dialog)
def _load_widgets(self):
self._file_filter_text = Gtk.FileFilter()
self._file_filter_text.set_name("XML Files")
for p in settings.filters.xml:
self._file_filter_text.add_pattern(p)
self._file_filter_all = Gtk.FileFilter()
self._file_filter_all.set_name("All Files")
self._file_filter_all.add_pattern("*.*")
def save_file_dialog(self, current_filename: str = "", current_file: Gio.File = None) -> str:
# TODO: Move Chooser logic to own widget
dlg = Gtk.FileChooserDialog(title = "Please choose a file...", parent = None, action = 1)
dlg.add_buttons("Cancel", Gtk.ResponseType.CANCEL, "Save", Gtk.ResponseType.OK)
dlg.set_do_overwrite_confirmation(True)
dlg.add_filter(self._file_filter_text)
dlg.add_filter(self._file_filter_all)
if current_filename == "":
import os
dlg.set_current_name("new.xml")
filechooser.set_current_folder(os.path.expanduser('~'))
else:
dlg.set_current_folder(current_file.get_parent().get_path())
dlg.set_current_name(current_filename)
response = dlg.run()
file = dlg.get_filename() if response == Gtk.ResponseType.OK else ""
dlg.destroy()
return Gio.File.new_for_path(file) if not file == "" else None

View File

@ -0,0 +1,51 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
class TransparencyScale(Gtk.Scale):
def __init__(self):
super(TransparencyScale, self).__init__()
builder = settings_manager.get_builder()
builder.get_object("menu_box").add(self)
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
self._load_widgets()
self.show_all()
def _setup_styling(self):
self.set_digits(0)
self.set_value_pos(Gtk.PositionType.RIGHT)
self.add_mark(0.0, Gtk.PositionType.LEFT, "Transparency")
self.add_mark(50.0, Gtk.PositionType.TOP, "50%")
self.set_hexpand(True)
def _setup_signals(self):
self.connect("value-changed", self._update_transparency)
def _subscribe_to_events(self):
...
def _load_widgets(self):
adjust = self.get_adjustment()
adjust.set_lower(0)
adjust.set_upper(99)
adjust.set_value(settings.theming.transparency)
adjust.set_step_increment(1.0)
def _update_transparency(self, range):
event_system.emit("remove_transparency")
tp = int(range.get_value())
settings.theming.transparency = tp
event_system.emit("update_transparency")

121
src/core/window.py Normal file
View File

@ -0,0 +1,121 @@
# Python imports
import signal
# Lib imports
import gi
import cairo
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
# Application imports
from core.controller import Controller
class ControllerStartExceptiom(Exception):
...
class Window(Gtk.ApplicationWindow):
""" docstring for Window. """
def __init__(self, args, unknownargs):
super(Window, self).__init__()
settings_manager.set_main_window(self)
self._controller = None
self._set_window_data()
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
self._load_widgets(args, unknownargs)
self._set_size_constraints()
self.show()
def _setup_styling(self):
self.set_title(f"{app_name}")
self.set_icon_from_file( settings_manager.get_window_icon() )
self.set_gravity(5) # 5 = CENTER
self.set_position(1) # 1 = CENTER, 4 = CENTER_ALWAYS
ctx = self.get_style_context()
ctx.add_class("main-window")
ctx.add_class(f"mw_transparency_{settings.theming.transparency}")
def _setup_signals(self):
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self._tear_down)
self.connect("delete-event", self._tear_down)
def _subscribe_to_events(self):
event_system.subscribe("tear_down", self._tear_down)
event_system.subscribe("load_interactive_debug", self._load_interactive_debug)
def _load_widgets(self, args, unknownargs):
if settings_manager.is_debug():
self.set_interactive_debugging(True)
self._controller = Controller(args, unknownargs)
if not self._controller:
raise ControllerStartException("Controller exited and doesn't exist...")
self.add( self._controller.get_base_container() )
def _set_size_constraints(self):
_window_x = settings.config.main_window_x
_window_y = settings.config.main_window_y
_min_width = settings.config.main_window_min_width
_min_height = settings.config.main_window_min_height
_width = settings.config.main_window_width
_height = settings.config.main_window_height
self.move(_window_x, _window_y - 28)
self.set_size_request(_min_width, _min_height)
self.set_default_size(_width, _height)
def _set_window_data(self) -> None:
screen = self.get_screen()
visual = screen.get_rgba_visual()
if visual and screen.is_composited() and settings.config.make_transparent == 0:
self.set_visual(visual)
self.set_app_paintable(True)
self.connect("draw", self._area_draw)
# bind css file
cssProvider = Gtk.CssProvider()
cssProvider.load_from_path( settings_manager.get_css_file() )
screen = Gdk.Screen.get_default()
styleContext = Gtk.StyleContext()
styleContext.add_provider_for_screen(screen, cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
def _area_draw(self, widget: Gtk.ApplicationWindow, cr: cairo.Context) -> None:
cr.set_source_rgba( *settings_manager.get_paint_bg_color() )
cr.set_operator(cairo.OPERATOR_SOURCE)
cr.paint()
cr.set_operator(cairo.OPERATOR_OVER)
def _load_interactive_debug(self):
self.set_interactive_debugging(True)
def _tear_down(self, widget = None, eve = None):
event_system.emit("shutting_down")
size = self.get_default_size()
pos = self.get_position()
settings_manager.set_main_window_width(size.width)
settings_manager.set_main_window_height(size.height)
settings_manager.set_main_window_x(pos.root_x)
settings_manager.set_main_window_y(pos.root_y)
settings_manager.save_settings()
settings_manager.clear_pid()
Gtk.main_quit()

3
src/utils/__init__.py Normal file
View File

@ -0,0 +1,3 @@
"""
Utils module
"""

52
src/utils/debugging.py Normal file
View File

@ -0,0 +1,52 @@
# Python imports
# Lib imports
# Application imports
# Break into a Python console upon SIGUSR1 (Linux) or SIGBREAK (Windows:
# CTRL+Pause/Break). To be included in all production code, just in case.
def debug_signal_handler(signal, frame):
del signal
del frame
try:
import rpdb2
logger.debug("\n\nStarting embedded RPDB2 debugger. Password is 'foobar'\n\n")
rpdb2.start_embedded_debugger("foobar", True, True)
rpdb2.setbreak(depth=1)
return
except StandardError:
...
try:
from rfoo.utils import rconsole
logger.debug("\n\nStarting embedded rconsole debugger...\n\n")
rconsole.spawn_server()
return
except StandardError as ex:
...
try:
from pudb import set_trace
logger.debug("\n\nStarting PuDB debugger...\n\n")
set_trace(paused = True)
return
except StandardError as ex:
...
try:
import pdb
logger.debug("\n\nStarting embedded PDB debugger...\n\n")
pdb.Pdb(skip=['gi.*']).set_trace()
return
except StandardError as ex:
...
try:
import code
code.interact()
except StandardError as ex:
logger.debug(f"{ex}, returning to normal program flow...")

View File

@ -0,0 +1,22 @@
# Python imports
# Lib imports
# Application imports
from .singleton import Singleton
class EndpointRegistry(Singleton):
def __init__(self):
self._endpoints = {}
def register(self, rule, **options):
def decorator(f):
self._endpoints[rule] = f
return f
return decorator
def get_endpoints(self):
return self._endpoints

73
src/utils/event_system.py Normal file
View File

@ -0,0 +1,73 @@
# Python imports
from collections import defaultdict
# Lib imports
# Application imports
from .singleton import Singleton
class EventSystem(Singleton):
""" Create event system. """
def __init__(self):
self.subscribers = defaultdict(list)
self._is_paused = False
self._subscribe_to_events()
def _subscribe_to_events(self):
self.subscribe("pause_event_processing", self._pause_processing_events)
self.subscribe("resume_event_processing", self._resume_processing_events)
def _pause_processing_events(self):
self._is_paused = True
def _resume_processing_events(self):
self._is_paused = False
def subscribe(self, event_type, fn):
self.subscribers[event_type].append(fn)
def unsubscribe(self, event_type, fn):
self.subscribers[event_type].remove(fn)
def unsubscribe_all(self, event_type):
self.subscribers.pop(event_type, None)
def emit(self, event_type, data = None):
if self._is_paused and event_type != "resume_event_processing":
return
if event_type in self.subscribers:
for fn in self.subscribers[event_type]:
if data:
if hasattr(data, '__iter__') and not type(data) is str:
fn(*data)
else:
fn(data)
else:
fn()
def emit_and_await(self, event_type, data = None):
if self._is_paused and event_type != "resume_event_processing":
return
""" NOTE: Should be used when signal has only one listener and vis-a-vis """
if event_type in self.subscribers:
response = None
for fn in self.subscribers[event_type]:
if data:
if hasattr(data, '__iter__') and not type(data) is str:
response = fn(*data)
else:
response = fn(data)
else:
response = fn()
if not response in (None, ''):
break
return response

132
src/utils/ipc_server.py Normal file
View File

@ -0,0 +1,132 @@
# Python imports
import os
import threading
import time
from multiprocessing.connection import Client
from multiprocessing.connection import Listener
# Lib imports
# Application imports
from .singleton import Singleton
class IPCServer(Singleton):
""" Create a listener so that other {app_name} instances send requests back to existing instance. """
def __init__(self, ipc_address: str = '127.0.0.1', conn_type: str = "socket"):
self.is_ipc_alive = False
self._ipc_port = 4848
self._ipc_address = ipc_address
self._conn_type = conn_type
self._ipc_authkey = b'' + bytes(f'{app_name}-ipc', 'utf-8')
self._ipc_timeout = 15.0
if conn_type == "socket":
self._ipc_address = f'/tmp/{app_name}-ipc.sock'
elif conn_type == "full_network":
self._ipc_address = '0.0.0.0'
elif conn_type == "full_network_unsecured":
self._ipc_authkey = None
self._ipc_address = '0.0.0.0'
elif conn_type == "local_network_unsecured":
self._ipc_authkey = None
self._subscribe_to_events()
def _subscribe_to_events(self):
event_system.subscribe("post_file_to_ipc", self.send_ipc_message)
def create_ipc_listener(self) -> None:
if self._conn_type == "socket":
if os.path.exists(self._ipc_address) and settings_manager.is_dirty_start():
os.unlink(self._ipc_address)
listener = Listener(address=self._ipc_address, family="AF_UNIX", authkey=self._ipc_authkey)
elif "unsecured" not in self._conn_type:
listener = Listener((self._ipc_address, self._ipc_port), authkey=self._ipc_authkey)
else:
listener = Listener((self._ipc_address, self._ipc_port))
self.is_ipc_alive = True
self._run_ipc_loop(listener)
@daemon_threaded
def _run_ipc_loop(self, listener) -> None:
# NOTE: Not thread safe if using with Gtk. Need to import GLib and use idle_add
while True:
try:
conn = listener.accept()
start_time = time.perf_counter()
self._handle_ipc_message(conn, start_time)
except Exception as e:
logger.debug( repr(e) )
listener.close()
def _handle_ipc_message(self, conn, start_time) -> None:
while True:
msg = conn.recv()
logger.debug(msg)
if "FILE|" in msg:
file = msg.split("FILE|")[1].strip()
if file:
event_system.emit("handle_file_from_ipc", file)
if "DIR|" in msg:
file = msg.split("DIR|")[1].strip()
if file:
event_system.emit("handle_dir_from_ipc", file)
conn.close()
break
if msg in ['close connection', 'close server']:
conn.close()
break
# NOTE: Not perfect but insures we don't lock up the connection for too long.
end_time = time.perf_counter()
if (end_time - start_time) > self._ipc_timeout:
conn.close()
break
def send_ipc_message(self, message: str = "Empty Data...") -> None:
try:
if self._conn_type == "socket":
conn = Client(address=self._ipc_address, family="AF_UNIX", authkey=self._ipc_authkey)
elif "unsecured" not in self._conn_type:
conn = Client((self._ipc_address, self._ipc_port), authkey=self._ipc_authkey)
else:
conn = Client((self._ipc_address, self._ipc_port))
conn.send(message)
conn.close()
except ConnectionRefusedError as e:
logger.error("Connection refused...")
except Exception as e:
logger.error( repr(e) )
def send_test_ipc_message(self, message: str = "Empty Data...") -> None:
try:
if self._conn_type == "socket":
conn = Client(address=self._ipc_address, family="AF_UNIX", authkey=self._ipc_authkey)
elif "unsecured" not in self._conn_type:
conn = Client((self._ipc_address, self._ipc_port), authkey=self._ipc_authkey)
else:
conn = Client((self._ipc_address, self._ipc_port))
conn.send(message)
conn.close()
except ConnectionRefusedError as e:
if self._conn_type == "socket":
logger.error("IPC Socket no longer valid.... Removing.")
os.unlink(self._ipc_address)
except Exception as e:
logger.error( repr(e) )

138
src/utils/keybindings.py Normal file
View File

@ -0,0 +1,138 @@
# Python imports
import re
# Lib imports
import gi
gi.require_version('Gdk', '3.0')
from gi.repository import Gdk
# Application imports
from .singleton import Singleton
def logger(log = ""):
print(log)
class KeymapError(Exception):
""" Custom exception for errors in keybinding configurations """
MODIFIER = re.compile('<([^<]+)>')
class Keybindings(Singleton):
""" Class to handle loading and lookup of Terminator keybindings """
modifiers = {
'ctrl': Gdk.ModifierType.CONTROL_MASK,
'control': Gdk.ModifierType.CONTROL_MASK,
'primary': Gdk.ModifierType.CONTROL_MASK,
'shift': Gdk.ModifierType.SHIFT_MASK,
'alt': Gdk.ModifierType.MOD1_MASK,
'super': Gdk.ModifierType.SUPER_MASK,
'hyper': Gdk.ModifierType.HYPER_MASK,
'mod2': Gdk.ModifierType.MOD2_MASK
}
empty = {}
keys = None
_masks = None
_lookup = None
def __init__(self):
self.keymap = Gdk.Keymap.get_default()
self.configure({})
def print_keys(self):
print(self.keys)
def append_bindings(self, combos):
""" Accept new binding(s) and reload """
for item in combos:
method, keys = item.split(":")
self.keys[method] = keys
self.reload()
def configure(self, bindings):
""" Accept new bindings and reconfigure with them """
self.keys = bindings
self.reload()
def reload(self):
""" Parse bindings and mangle into an appropriate form """
self._lookup = {}
self._masks = 0
for action, bindings in list(self.keys.items()):
if isinstance(bindings, list):
bindings = (*bindings,)
elif not isinstance(bindings, tuple):
bindings = (bindings,)
for binding in bindings:
if not binding or binding == "None":
continue
try:
keyval, mask = self._parsebinding(binding)
# Does much the same, but with worse error handling.
# keyval, mask = Gtk.accelerator_parse(binding)
except KeymapError as e:
logger(f"Keybinding reload failed to parse binding '{binding}': {e}")
else:
if mask & Gdk.ModifierType.SHIFT_MASK:
if keyval == Gdk.KEY_Tab:
keyval = Gdk.KEY_ISO_Left_Tab
mask &= ~Gdk.ModifierType.SHIFT_MASK
else:
keyvals = Gdk.keyval_convert_case(keyval)
if keyvals[0] != keyvals[1]:
keyval = keyvals[1]
mask &= ~Gdk.ModifierType.SHIFT_MASK
else:
keyval = Gdk.keyval_to_lower(keyval)
self._lookup.setdefault(mask, {})
self._lookup[mask][keyval] = action
self._masks |= mask
def _parsebinding(self, binding):
""" Parse an individual binding using Gtk's binding function """
mask = 0
modifiers = re.findall(MODIFIER, binding)
if modifiers:
for modifier in modifiers:
mask |= self._lookup_modifier(modifier)
key = re.sub(MODIFIER, '', binding)
if key == '':
raise KeymapError('No key found!')
keyval = Gdk.keyval_from_name(key)
if keyval == 0:
raise KeymapError(f"Key '{key}' is unrecognised...")
return (keyval, mask)
def _lookup_modifier(self, modifier):
""" Map modifier names to gtk values """
try:
return self.modifiers[modifier.lower()]
except KeyError:
raise KeymapError(f"Unhandled modifier '<{modifier}>'")
def lookup(self, event):
""" Translate a keyboard event into a mapped key """
try:
_found, keyval, _egp, _lvl, consumed = self.keymap.translate_keyboard_state(
event.hardware_keycode,
Gdk.ModifierType(event.get_state() & ~Gdk.ModifierType.LOCK_MASK),
event.group)
except TypeError:
logger(f"Keybinding lookup failed to translate keyboard event: {dir(event)}")
return None
mask = (event.get_state() & ~consumed) & self._masks
return self._lookup.get(mask, self.empty).get(keyval, None)

258
src/utils/languages.py Normal file
View File

@ -0,0 +1,258 @@
#!/usr/bin/python
# please keep these in alphabetical order so it is easy to follow
# see available languages: /usr/share/gtksourceview-3.0/language-specs
# or run in python >>> GtkSource.LanguageManager().get_language_ids()
samples = {}
samples['ada'] = """
with Ada.Text_Io; use Ada.Text_Io;
procedure Doors is
type Door_State is (Closed, Open);
type Door_List is array(Positive range 1..100) of Door_State;
The_Doors : Door_List := (others => Closed);
begin
for I in 1..100 loop
for J in The_Doors'range loop
if J mod I = 0 then
if The_Doors(J) = Closed then
The_Doors(J) := Open;
else
The_Doors(J) := Closed;
end if;
end if;
end loop;
end loop;
for I in The_Doors'range loop
Put_Line(Integer'Image(I) & " is " & Door_State'Image(The_Doors(I)));
end loop;
end Doors;
"""
samples['asp'] = """
<html>
<body>
<form action="demo_reqquery.asp" method="get">
Your name: <input type="text" name="fname" size="20" />
<input type="submit" value="Submit" />
</form>
<%
dim fname
fname=Request.QueryString("fname")
If fname<>"" Then
Response.Write("Hello " & fname & "!<br />")
Response.Write("How are you today?")
End If
%>
</body>
</html>
"""
# samples['automake'] = """
samples['awk'] = """
BEGIN {
for(i=1; i <= 100; i++) {
doors[i] = 0 # close the doors
}
for(i=1; i <= 100; i++) {
if ( int(sqrt(i)) == sqrt(i) ) {
doors[i] = 1
}
}
for(i=1; i <= 100; i++)
{
print i, doors[i] ? "open" : "close"
}
}
"""
# samples['bennugd'] = """
# samples['bibtex'] = """
# samples['boo'] = """
# do not remove this language since it is the fallback entry
samples['c'] = """
/* Some comments */
#include <stdio.h>
int main()
{
int square = 1, increment = 3, door;
for (door = 1; door <= 100; ++door)
{
printf("door #%d", door);
if (door == square)
{
printf(" is open.");
square += increment;
increment += 2;
}
else
printf(" is closed.");
}
return 0;
}
"""
samples['c-sharp'] ="""
// Creates and initializes a new integer Array
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
//same as
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
//same as
int[] intArray = { 1, 2, 3, 4, 5 };
//Arrays are zero-based
string[] stringArr = new string[5];
stringArr[0] = "string";
"""
# samples['cg'] = """
# samples['changelog'] = """
# samples['chdr'] = """
# samples['cmake'] = """
# samples['cobol'] = """
# samples['cpp'] = """
# samples['css'] = """
# samples['cuda'] = """
# samples['d'] = """
# samples['def'] = """
# samples['desktop'] = """
samples['diff'] = """
--- xinetd.d/tftp 2003-12-17 13:11:20.000000000 -0500
+++ ./tftp 2004-01-22 11:46:14.479497688 -0500
@@ -10,7 +10,7 @@
wait = yes
user = root
server = /usr/sbin/in.tftpd
- server_args = -s /tftpboot
+ server_args = -p -u tftpd -s /tftpboot
disable = yes
per_source = 11
cps = 100 2
"""
# samples['docbook'] = """
# samples['dosbatch'] = """
# samples['dot'] = """
# samples['dpatch'] = """
# samples['dtd'] = """
# samples['eiffel'] = """
# samples['erlang'] = """
# samples['fcl'] = """
# samples['forth'] = """
# samples['fortran'] = """
# samples['fsharp'] = """
# samples['gap'] = """
# samples['gdb-log'] = """
# samples['gettext-translation'] = """
# samples['glsl'] = """
# samples['go'] = """
# samples['gtk-doc'] = """
# samples['gtkrc'] = """
# samples['haddock'] = """
# samples['haskell'] = """
# samples['haskell-literate'] = """
samples['html'] = """
<html>
<body>
<table border="1">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
</body>
</html>
"""
# samples['idl'] = """
# samples['imagej'] = """
# samples['ini'] = """
# samples['java'] = """
# samples['js'] = """
# samples['json'] = """
# samples['latex'] = """
# samples['libtool'] = """
# samples['lua'] = """
# samples['m4'] = """
# samples['makefile'] = """
# samples['mallard'] = """
# samples['markdown'] = """
# samples['matlab'] = """
# samples['nemerle'] = """
# samples['nsis'] = """
# samples['objc'] = """
# samples['objective-caml'] = """
# samples['objj'] = """
# samples['ocl'] = """
# samples['octave'] = """
# samples['ooc'] = """
# samples['opal'] = """
# samples['opencl'] = """
# samples['pascal'] = """
# samples['perl'] = """
samples['php'] = """
/* ygtyuy */
print 'hello world';
"""
# samples['pkgconfig'] = """
# samples['prolog'] = """
# samples['proto'] = """
samples['python'] = """
def on_save_clicked(self, param):
if not self.currentSchemeFile:
filename = runSaveAsDialog(self.window, self.entryId.get_text() + '.xml')
if filename and not '.' in os.path.basename(filename):
filename = filename + '.xml'
if filename:
self.write_scheme(filename, self.entryId.get_text())
self.currentSchemeFile = filename
else:
self.write_scheme(self.currentSchemeFile, self.entryId.get_text())
# TODO handle case where there is a permissions issue
"""
# samples['r'] = """
# samples['rpmspec'] = """
# samples['ruby'] = """
# samples['scheme'] = """
# samples['scilab'] = """
# samples['sh'] = """
# samples['sml'] = """
# samples['sparql'] = """
# samples['sql'] = """
# samples['systemverilog'] = """
# samples['t2t'] = """
# samples['tcl'] = """
# samples['texinfo'] = """
# samples['vala'] = """
# samples['vbnet'] = """
# samples['verilog'] = """
# samples['vhdl'] = """
# samples['xml'] = """
# samples['xslt'] = """
# samples['yacc'] = """

61
src/utils/logger.py Normal file
View File

@ -0,0 +1,61 @@
# Python imports
import os
import logging
# Lib imports
# Application imports
from .singleton import Singleton
class Logger(Singleton):
"""
Create a new logging object and return it.
:note:
NOSET # Don't know the actual log level of this... (defaulting or literally none?)
Log Levels (From least to most)
Type Value
CRITICAL 50
ERROR 40
WARNING 30
INFO 20
DEBUG 10
:param loggerName: Sets the name of the logger object. (Used in log lines)
:param createFile: Whether we create a log file or just pump to terminal
:return: the logging object we created
"""
def __init__(self, config_path: str, _ch_log_lvl = logging.CRITICAL, _fh_log_lvl = logging.INFO):
self._CONFIG_PATH = config_path
self.global_lvl = logging.DEBUG # Keep this at highest so that handlers can filter to their desired levels
self.ch_log_lvl = _ch_log_lvl # Prety much the only one we ever change
self.fh_log_lvl = _fh_log_lvl
def get_logger(self, loggerName: str = "NO_LOGGER_NAME_PASSED", createFile: bool = True) -> logging.Logger:
log = logging.getLogger(loggerName)
log.setLevel(self.global_lvl)
# Set our log output styles
fFormatter = logging.Formatter('[%(asctime)s] %(pathname)s:%(lineno)d %(levelname)s - %(message)s', '%m-%d %H:%M:%S')
cFormatter = logging.Formatter('%(pathname)s:%(lineno)d] %(levelname)s - %(message)s')
ch = logging.StreamHandler()
ch.setLevel(level=self.ch_log_lvl)
ch.setFormatter(cFormatter)
log.addHandler(ch)
if createFile:
folder = self._CONFIG_PATH
file = f"{folder}/application.log"
if not os.path.exists(folder):
os.mkdir(folder)
fh = logging.FileHandler(file)
fh.setLevel(level=self.fh_log_lvl)
fh.setFormatter(fFormatter)
log.addHandler(fh)
return log

View File

@ -0,0 +1,4 @@
"""
Settings module
"""
from .manager import SettingsManager

View File

@ -0,0 +1,190 @@
# Python imports
import signal
import io
import json
import inspect
import zipfile
from os import path
from os import mkdir
# Lib imports
# Application imports
from ..singleton import Singleton
from .start_check_mixin import StartCheckMixin
from .options.settings import Settings
class MissingConfigError(Exception):
pass
class SettingsManager(StartCheckMixin, Singleton):
def __init__(self):
self._SCRIPT_PTH = path.dirname(path.realpath(__file__))
self._USER_HOME = path.expanduser('~')
self._HOME_CONFIG_PATH = f"{self._USER_HOME}/.config/{app_name.lower()}"
self._USR_PATH = f"/usr/share/{app_name.lower()}"
self._USR_CONFIG_FILE = f"{self._USR_PATH}/settings.json"
self._PLUGINS_PATH = f"{self._HOME_CONFIG_PATH}/plugins"
self._DEFAULT_ICONS = f"{self._HOME_CONFIG_PATH}/icons"
self._CONFIG_FILE = f"{self._HOME_CONFIG_PATH}/settings.json"
self._GLADE_FILE = f"{self._HOME_CONFIG_PATH}/Main_Window.glade"
self._CSS_FILE = f"{self._HOME_CONFIG_PATH}/stylesheet.css"
self._KEY_BINDINGS_FILE = f"{self._HOME_CONFIG_PATH}/key-bindings.json"
self._PID_FILE = f"{self._HOME_CONFIG_PATH}/{app_name.lower()}.pid"
self._UI_WIDEGTS_PATH = f"{self._HOME_CONFIG_PATH}/ui_widgets"
self._CONTEXT_MENU = f"{self._HOME_CONFIG_PATH}/contexct_menu.json"
self._WINDOW_ICON = f"{self._DEFAULT_ICONS}/{app_name.lower()}.png"
# self._USR_CONFIG_FILE = f"{self._USR_PATH}/settings.json"
# self._PLUGINS_PATH = f"plugins"
# self._CONFIG_FILE = f"settings.json"
# self._GLADE_FILE = f"Main_Window.glade"
# self._CSS_FILE = f"stylesheet.css"
# self._KEY_BINDINGS_FILE = f"key-bindings.json"
# self._PID_FILE = f"{app_name.lower()}.pid"
# self._WINDOW_ICON = f"{app_name.lower()}.png"
# self._UI_WIDEGTS_PATH = f"ui_widgets"
# self._CONTEXT_MENU = f"contexct_menu.json"
# self._DEFAULT_ICONS = f"icons"
# with zipfile.ZipFile("files.zip", mode="r", allowZip64=True) as zf:
# with io.TextIOWrapper(zf.open("text1.txt"), encoding="utf-8") as f:
if not path.exists(self._HOME_CONFIG_PATH):
mkdir(self._HOME_CONFIG_PATH)
if not path.exists(self._PLUGINS_PATH):
mkdir(self._PLUGINS_PATH)
if not path.exists(self._DEFAULT_ICONS):
self._DEFAULT_ICONS = f"{self._USR_PATH}/icons"
if not path.exists(self._DEFAULT_ICONS):
raise MissingConfigError("Unable to find the application icons directory.")
if not path.exists(self._GLADE_FILE):
self._GLADE_FILE = f"{self._USR_PATH}/Main_Window.glade"
if not path.exists(self._GLADE_FILE):
raise MissingConfigError("Unable to find the application Glade file.")
if not path.exists(self._KEY_BINDINGS_FILE):
self._KEY_BINDINGS_FILE = f"{self._USR_PATH}/key-bindings.json"
if not path.exists(self._KEY_BINDINGS_FILE):
raise MissingConfigError("Unable to find the application Keybindings file.")
if not path.exists(self._CSS_FILE):
self._CSS_FILE = f"{self._USR_PATH}/stylesheet.css"
if not path.exists(self._CSS_FILE):
raise MissingConfigError("Unable to find the application Stylesheet file.")
if not path.exists(self._WINDOW_ICON):
self._WINDOW_ICON = f"{self._USR_PATH}/icons/{app_name.lower()}.png"
if not path.exists(self._WINDOW_ICON):
raise MissingConfigError("Unable to find the application icon.")
if not path.exists(self._UI_WIDEGTS_PATH):
self._UI_WIDEGTS_PATH = f"{self._USR_PATH}/ui_widgets"
if not path.exists(self._CONTEXT_MENU):
self._CONTEXT_MENU = f"{self._USR_PATH}/contexct_menu.json"
try:
with open(self._KEY_BINDINGS_FILE) as file:
bindings = json.load(file)["keybindings"]
keybindings.configure(bindings)
except Exception as e:
print( f"Settings Manager: {self._KEY_BINDINGS_FILE}\n\t\t{repr(e)}" )
try:
with open(self._CONTEXT_MENU) as file:
self._context_menu_data = json.load(file)
except Exception as e:
print( f"Settings Manager: {self._CONTEXT_MENU}\n\t\t{repr(e)}" )
self.settings: Settings = None
self._main_window = None
self._builder = None
self.PAINT_BG_COLOR = (0, 0, 0, 0.0)
self._trace_debug = False
self._debug = False
self._dirty_start = False
def register_signals_to_builder(self, classes=None):
handlers = {}
for c in classes:
methods = None
try:
methods = inspect.getmembers(c, predicate=inspect.ismethod)
handlers.update(methods)
except Exception as e:
...
self._builder.connect_signals(handlers)
def set_main_window(self, window): self._main_window = window
def set_builder(self, builder) -> any: self._builder = builder
def get_monitor_data(self) -> list:
screen = self._main_window.get_screen()
monitors = []
for m in range(screen.get_n_monitors()):
monitors.append(screen.get_monitor_geometry(m))
print("{}x{}+{}+{}".format(monitor.width, monitor.height, monitor.x, monitor.y))
return monitors
def get_main_window(self) -> any: return self._main_window
def get_builder(self) -> any: return self._builder
def get_paint_bg_color(self) -> any: return self.PAINT_BG_COLOR
def get_glade_file(self) -> str: return self._GLADE_FILE
def get_ui_widgets_path(self) -> str: return self._UI_WIDEGTS_PATH
def get_context_menu_data(self) -> str: return self._context_menu_data
def get_plugins_path(self) -> str: return self._PLUGINS_PATH
def get_icon_theme(self) -> str: return self._ICON_THEME
def get_css_file(self) -> str: return self._CSS_FILE
def get_home_config_path(self) -> str: return self._HOME_CONFIG_PATH
def get_window_icon(self) -> str: return self._WINDOW_ICON
def get_home_path(self) -> str: return self._USER_HOME
def is_trace_debug(self) -> str: return self._trace_debug
def is_debug(self) -> str: return self._debug
def call_method(self, target_class = None, _method_name = None, data = None):
method_name = str(_method_name)
method = getattr(target_class, method_name, lambda data: f"No valid key passed...\nkey={method_name}\nargs={data}")
return method(data) if data else method()
def set_main_window_x(self, x = 0): self.settings.config.main_window_x = x
def set_main_window_y(self, y = 0): self.settings.config.main_window_y = y
def set_main_window_width(self, width = 800): self.settings.config.main_window_width = width
def set_main_window_height(self, height = 600): self.settings.config.main_window_height = height
def set_main_window_min_width(self, width = 720): self.settings.config.main_window_min_width = width
def set_main_window_min_height(self, height = 480): self.settings.config.main_window_min_height = height
def set_trace_debug(self, trace_debug):
self._trace_debug = trace_debug
def set_debug(self, debug):
self._debug = debug
def load_settings(self):
if not path.exists(self._CONFIG_FILE):
self.settings = Settings()
return
with open(self._CONFIG_FILE) as file:
data = json.load(file)
data["load_defaults"] = False
self.settings = Settings(**data)
def save_settings(self):
with open(self._CONFIG_FILE, 'w') as outfile:
json.dump(self.settings.as_dict(), outfile, separators=(',', ':'), indent=4)

View File

@ -0,0 +1,8 @@
"""
Options module
"""
from .settings import Settings
from .config import Config
from .filters import Filters
from .theming import Theming
from .debugging import Debugging

View File

@ -0,0 +1,39 @@
# Python imports
from dataclasses import dataclass, field
# Lib imports
# Application imports
@dataclass
class Config:
base_of_home: str = ""
hide_hidden_files: str = "true"
thumbnailer_path: str = "ffmpegthumbnailer"
blender_thumbnailer_path: str = ""
go_past_home: str = "true"
lock_folder: str = "false"
locked_folders: list = field(default_factory=lambda: [ "venv", "flasks" ])
mplayer_options: str = "-quiet -really-quiet -xy 1600 -geometry 50%:50%",
music_app: str = "/opt/deadbeef/bin/deadbeef"
media_app: str = "mpv"
image_app: str = "mirage"
office_app: str = "libreoffice"
pdf_app: str = "evince"
code_app: str = "atom"
text_app: str = "leafpad"
file_manager_app: str = "solarfm"
terminal_app: str = "terminator"
remux_folder_max_disk_usage: str = "8589934592"
make_transparent: int = 0
main_window_x: int = 721
main_window_y: int = 465
main_window_min_width: int = 720
main_window_min_height: int = 480
main_window_width: int = 800
main_window_height: int = 600
application_dirs: list = field(default_factory=lambda: [
"/usr/share/applications",
f"{settings_manager.get_home_path()}/.local/share/applications"
])

View File

@ -0,0 +1,12 @@
# Python imports
from dataclasses import dataclass
# Lib imports
# Application imports
@dataclass
class Debugging:
ch_log_lvl: int = 10
fh_log_lvl: int = 20

View File

@ -0,0 +1,13 @@
# Python imports
from dataclasses import dataclass, field
# Lib imports
# Application imports
@dataclass
class Filters:
xml: list = field(default_factory=lambda: [
".xml"
])

View File

@ -0,0 +1,31 @@
# Python imports
from dataclasses import dataclass, field
from dataclasses import asdict
# Gtk imports
# Application imports
from .config import Config
from .filters import Filters
from .theming import Theming
from .debugging import Debugging
@dataclass
class Settings:
load_defaults: bool = True
config: Config = field(default_factory=lambda: Config())
filters: Filters = field(default_factory=lambda: Filters())
theming: Theming = field(default_factory=lambda: Theming())
debugging: Debugging = field(default_factory=lambda: Debugging())
def __post_init__(self):
if not self.load_defaults:
self.load_defaults = False
self.config = Config(**self.config)
self.filters = Filters(**self.filters)
self.theming = Theming(**self.theming)
self.debugging = Debugging(**self.debugging)
def as_dict(self):
return asdict(self)

View File

@ -0,0 +1,14 @@
# Python imports
from dataclasses import dataclass
# Lib imports
# Application imports
@dataclass
class Theming:
transparency: int = 64
success_color: str = "#88cc27"
warning_color: str = "#ffa800"
error_color: str = "#ff0000"

View File

@ -0,0 +1,51 @@
# Python imports
import os
import json
import inspect
# Lib imports
# Application imports
class StartCheckMixin:
def is_dirty_start(self) -> bool: return self._dirty_start
def clear_pid(self): self._clean_pid()
def do_dirty_start_check(self):
if not os.path.exists(self._PID_FILE):
self._write_new_pid()
else:
with open(self._PID_FILE, "r") as _pid:
pid = _pid.readline().strip()
if pid not in ("", None):
self._check_alive_status(int(pid))
else:
self._write_new_pid()
""" Check For the existence of a unix pid. """
def _check_alive_status(self, pid):
print(f"PID Found: {pid}")
try:
os.kill(pid, 0)
except OSError:
print(f"{app_name} is starting dirty...")
self._dirty_start = True
self._write_new_pid()
return
print("PID is alive... Let downstream errors (sans debug args) handle app closure propigation.")
def _write_new_pid(self):
pid = os.getpid()
self._write_pid(pid)
print(f"{app_name} PID: {pid}")
def _clean_pid(self):
os.unlink(self._PID_FILE)
def _write_pid(self, pid):
with open(self._PID_FILE, "w") as _pid:
_pid.write(f"{pid}")

24
src/utils/singleton.py Normal file
View File

@ -0,0 +1,24 @@
# Python imports
# Lib imports
# Application imports
class SingletonError(Exception):
pass
class Singleton:
ccount = 0
def __new__(cls, *args, **kwargs):
obj = super(Singleton, cls).__new__(cls)
cls.ccount += 1
if cls.ccount == 2:
raise SingletonError(f"Exceeded {cls.__name__} instantiation limit...")
return obj

View File

@ -0,0 +1,34 @@
# Python imports
import os
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
# Application imports
class StyleProperties:
def __init__(self):
self.background: str = None
self.foreground: str = None
self.italic: bool = False
self.bold: bool = False
self.strikethrough: bool = False
self.underline: bool = False
def from_gtk_source_style(self, style):
self.background = style.props.background
self.foreground = style.props.foreground
self.italic = style.props.italic
self.bold = style.props.bold
self.underline = style.props.underline_set
self.strikethrough = style.props.strikethrough
if self.foreground and self.foreground[0] != '#':
self.foreground = f"#{self.foreground}"
if self.background and self.background[0] != '#':
self.background = f"#{self.background}"

23
user_config/bin/code-themer Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# . CONFIG.sh
# set -o xtrace ## To debug scripts
# set -o errexit ## To exit on error
# set -o errunset ## To exit if a variable is referenced but not set
function main() {
call_path=`pwd`
path=""
if [[ ! "${1::1}" == /* ]]; then
path="${call_path}/${1}"
else
path="${1}"
fi
cd "/opt/"
python /opt/gtk-code-themer.zip "$@"
}
main "$@";

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=<change_me>
GenericName=<change_me>
Comment=<change_me>
Exec=/bin/<change_me> %F
Icon=/usr/share/<change_me>/icons/<change_me>.png
Type=Application
StartupNotify=true
Categories=System;FileTools;Utility;Core;GTK;FileManager;
MimeType=
Terminal=false

View File

@ -0,0 +1,650 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<requires lib="gtksourceview" version="4.0"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<object class="GtkListStore" id="languages_list">
<columns>
<!-- column-name Languages -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="styles_list">
<columns>
<!-- column-name Styles -->
<column type="gchar"/>
</columns>
</object>
<object class="GtkBox" id="glade_box">
<property name="width-request">600</property>
<property name="height-request">800</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkMenuBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_File</property>
<property name="use-underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-open</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
<signal name="activate" handler="on_open_clicked" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-save</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
<signal name="activate" handler="on_save_clicked" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-save-as</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
<signal name="activate" handler="on_save_as_clicked" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Debug</property>
<property name="use-underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImageMenuItem">
<property name="label">Interactive Debug</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="image">image1</property>
<property name="use-stock">False</property>
<signal name="activate" handler="_interactive_debug" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">Transparancy Controls</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="image">image2</property>
<property name="use-stock">False</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
<signal name="activate" handler="_close_app" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Help</property>
<property name="use-underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImageMenuItem">
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="use-underline">True</property>
<property name="use-stock">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox">
<property name="width-request">165</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkComboBox" id="languages_dropdown">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="model">languages_list</property>
<signal name="changed" handler="on_language_selected" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="styles_treeview">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">styles_list</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Styles</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">12</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">10</property>
<property name="layout-style">start</property>
<child>
<object class="GtkToggleButton" id="bold_tggle_btn">
<property name="use-action-appearance">False</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="has-tooltip">True</property>
<property name="tooltip-markup" translatable="yes">Bold</property>
<property name="tooltip-text" translatable="yes">Bold</property>
<property name="margin-top">1</property>
<property name="relief">none</property>
<signal name="toggled" handler="on_style_changed" swapped="no"/>
<child>
<object class="GtkImage" id="image30">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-bold</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="italic_tggle_btn">
<property name="use-action-appearance">False</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="has-tooltip">True</property>
<property name="tooltip-markup" translatable="yes">Italic</property>
<property name="tooltip-text" translatable="yes">Italic</property>
<property name="relief">none</property>
<signal name="toggled" handler="on_style_changed" swapped="no"/>
<child>
<object class="GtkImage" id="image31">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-italic</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="underline_tggle_btn">
<property name="use-action-appearance">False</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="has-tooltip">True</property>
<property name="tooltip-markup" translatable="yes">Underline</property>
<property name="tooltip-text" translatable="yes">Underline</property>
<property name="relief">none</property>
<signal name="toggled" handler="on_style_changed" swapped="no"/>
<child>
<object class="GtkImage" id="image32">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-underline</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="strikethrough_tggle_btn">
<property name="use-action-appearance">False</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="has-tooltip">True</property>
<property name="tooltip-markup" translatable="yes">Strikethrough</property>
<property name="tooltip-text" translatable="yes">Strikethrough</property>
<property name="relief">none</property>
<signal name="toggled" handler="on_style_changed" swapped="no"/>
<child>
<object class="GtkImage" id="image33">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-strikethrough</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="n-rows">2</property>
<property name="n-columns">2</property>
<property name="column-spacing">12</property>
<property name="row-spacing">12</property>
<child>
<object class="GtkCheckButton" id="fr_check_btn">
<property name="label" translatable="yes">Foreground</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
<signal name="toggled" handler="on_foreground_toggled" swapped="no"/>
</object>
</child>
<child>
<object class="GtkCheckButton" id="br_check_btn">
<property name="label" translatable="yes">Background</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
<signal name="toggled" handler="on_background_toggled" swapped="no"/>
</object>
<packing>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="fr_color_btn">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="br_color_btn">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="right-attach">2</property>
<property name="top-attach">1</property>
<property name="bottom-attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="reset_btn">
<property name="use-action-appearance">False</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_reset_clicked" swapped="no"/>
<child>
<object class="GtkAlignment" id="alignment7">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkHBox" id="hbox37">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage" id="image34">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-undo</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label41">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Clear </property>
<property name="use-underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Name</property>
<property name="xalign">0.019999999552965164</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="name_entry">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Id</property>
<property name="xalign">0.019999999552965164</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="id_entry">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Description</property>
<property name="xalign">0.019999999552965164</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="desc_entry">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Author</property>
<property name="xalign">0.019999999552965164</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="authr_entry">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="source-container">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="sample_lbl">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Sample</property>
<property name="xalign">0.019999999552965164</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSourceView" id="src_preview">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="left-margin">2</property>
<property name="right-margin">2</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="center-container"/>
</style>
</object>
</interface>

View File

@ -0,0 +1,16 @@
{
"Open Actions": {
"Open": ["STOCK_OPEN", "open"],
"Open With": ["STOCK_OPEN", "open_with"],
"Execute": ["STOCK_EXECUTE", "execute"],
"Execute in Terminal": ["STOCK_EXECUTE", "execute_in_terminal"]
},
"File Actions": {
"New": ["STOCK_ADD", "create"],
"Rename": ["STOCK_EDIT", "rename"],
"Cut": ["STOCK_CUT", "cut"],
"Copy": ["STOCK_COPY", "copy"],
"Paste": ["STOCK_PASTE", "paste"]
},
"Plugins": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,23 @@
{
"keybindings": {
"help" : "F1",
"rename_files" : ["F2", "<Control>e"],
"open_terminal" : "F4",
"refresh_tab" : ["F5", "<Control>r"],
"delete_files" : "Delete",
"tggl_top_main_menubar" : "Alt_L",
"trash_files" : "<Shift><Control>t",
"tear_down" : "<Control>q",
"go_up" : "<Control>Up",
"go_home" : "<Control>slash",
"grab_focus_path_entry" : "<Control>l",
"open_files" : "<Control>o",
"show_hide_hidden_files" : "<Control>h",
"keyboard_create_tab" : "<Control>t",
"keyboard_close_tab" : "<Control>w",
"keyboard_copy_files" : "<Control>c",
"keyboard_cut_files" : "<Control>x",
"paste_files" : "<Control>v",
"show_new_file_menu" : "<Control>n"
}
}

View File

@ -0,0 +1,130 @@
.base-container {
margin: 10px;
}
/* * selection {
background-color: rgba(116, 0, 0, 0.65);
color: rgba(255, 255, 255, 0.5);
} */
/* Rubberband coloring */
/* .rubberband,
rubberband,
flowbox rubberband,
treeview.view rubberband,
.content-view rubberband,
.content-view .rubberband,
XfdesktopIconView.view .rubberband {
border: 1px solid #6c6c6c;
background-color: rgba(21, 158, 167, 0.57);
}
XfdesktopIconView.view:active {
background-color: rgba(172, 102, 21, 1);
} */
.mw_transparency_1 { background: rgba(39, 43, 52, 0.1); }
.mw_transparency_2 { background: rgba(39, 43, 52, 0.2); }
.mw_transparency_3 { background: rgba(39, 43, 52, 0.3); }
.mw_transparency_4 { background: rgba(39, 43, 52, 0.4); }
.mw_transparency_5 { background: rgba(39, 43, 52, 0.5); }
.mw_transparency_6 { background: rgba(39, 43, 52, 0.6); }
.mw_transparency_7 { background: rgba(39, 43, 52, 0.7); }
.mw_transparency_8 { background: rgba(39, 43, 52, 0.8); }
.mw_transparency_9 { background: rgba(39, 43, 52, 0.9); }
.mw_transparency_10 { background: rgba(39, 43, 52, 0.10); }
.mw_transparency_11 { background: rgba(39, 43, 52, 0.11); }
.mw_transparency_12 { background: rgba(39, 43, 52, 0.12); }
.mw_transparency_13 { background: rgba(39, 43, 52, 0.13); }
.mw_transparency_14 { background: rgba(39, 43, 52, 0.14); }
.mw_transparency_15 { background: rgba(39, 43, 52, 0.15); }
.mw_transparency_16 { background: rgba(39, 43, 52, 0.16); }
.mw_transparency_17 { background: rgba(39, 43, 52, 0.17); }
.mw_transparency_18 { background: rgba(39, 43, 52, 0.18); }
.mw_transparency_19 { background: rgba(39, 43, 52, 0.19); }
.mw_transparency_20 { background: rgba(39, 43, 52, 0.20); }
.mw_transparency_21 { background: rgba(39, 43, 52, 0.21); }
.mw_transparency_22 { background: rgba(39, 43, 52, 0.22); }
.mw_transparency_23 { background: rgba(39, 43, 52, 0.23); }
.mw_transparency_24 { background: rgba(39, 43, 52, 0.24); }
.mw_transparency_25 { background: rgba(39, 43, 52, 0.25); }
.mw_transparency_26 { background: rgba(39, 43, 52, 0.26); }
.mw_transparency_27 { background: rgba(39, 43, 52, 0.27); }
.mw_transparency_28 { background: rgba(39, 43, 52, 0.28); }
.mw_transparency_29 { background: rgba(39, 43, 52, 0.29); }
.mw_transparency_30 { background: rgba(39, 43, 52, 0.30); }
.mw_transparency_31 { background: rgba(39, 43, 52, 0.31); }
.mw_transparency_32 { background: rgba(39, 43, 52, 0.32); }
.mw_transparency_33 { background: rgba(39, 43, 52, 0.33); }
.mw_transparency_34 { background: rgba(39, 43, 52, 0.34); }
.mw_transparency_35 { background: rgba(39, 43, 52, 0.35); }
.mw_transparency_36 { background: rgba(39, 43, 52, 0.36); }
.mw_transparency_37 { background: rgba(39, 43, 52, 0.37); }
.mw_transparency_38 { background: rgba(39, 43, 52, 0.38); }
.mw_transparency_39 { background: rgba(39, 43, 52, 0.39); }
.mw_transparency_40 { background: rgba(39, 43, 52, 0.40); }
.mw_transparency_41 { background: rgba(39, 43, 52, 0.41); }
.mw_transparency_42 { background: rgba(39, 43, 52, 0.42); }
.mw_transparency_43 { background: rgba(39, 43, 52, 0.43); }
.mw_transparency_44 { background: rgba(39, 43, 52, 0.44); }
.mw_transparency_45 { background: rgba(39, 43, 52, 0.45); }
.mw_transparency_46 { background: rgba(39, 43, 52, 0.46); }
.mw_transparency_47 { background: rgba(39, 43, 52, 0.47); }
.mw_transparency_48 { background: rgba(39, 43, 52, 0.48); }
.mw_transparency_49 { background: rgba(39, 43, 52, 0.49); }
.mw_transparency_50 { background: rgba(39, 43, 52, 0.50); }
.mw_transparency_51 { background: rgba(39, 43, 52, 0.51); }
.mw_transparency_52 { background: rgba(39, 43, 52, 0.52); }
.mw_transparency_53 { background: rgba(39, 43, 52, 0.53); }
.mw_transparency_54 { background: rgba(39, 43, 52, 0.54); }
.mw_transparency_55 { background: rgba(39, 43, 52, 0.55); }
.mw_transparency_56 { background: rgba(39, 43, 52, 0.56); }
.mw_transparency_57 { background: rgba(39, 43, 52, 0.57); }
.mw_transparency_58 { background: rgba(39, 43, 52, 0.58); }
.mw_transparency_59 { background: rgba(39, 43, 52, 0.59); }
.mw_transparency_60 { background: rgba(39, 43, 52, 0.60); }
.mw_transparency_61 { background: rgba(39, 43, 52, 0.61); }
.mw_transparency_62 { background: rgba(39, 43, 52, 0.62); }
.mw_transparency_63 { background: rgba(39, 43, 52, 0.63); }
.mw_transparency_64 { background: rgba(39, 43, 52, 0.64); }
.mw_transparency_65 { background: rgba(39, 43, 52, 0.65); }
.mw_transparency_66 { background: rgba(39, 43, 52, 0.66); }
.mw_transparency_67 { background: rgba(39, 43, 52, 0.67); }
.mw_transparency_68 { background: rgba(39, 43, 52, 0.68); }
.mw_transparency_69 { background: rgba(39, 43, 52, 0.69); }
.mw_transparency_70 { background: rgba(39, 43, 52, 0.70); }
.mw_transparency_71 { background: rgba(39, 43, 52, 0.71); }
.mw_transparency_72 { background: rgba(39, 43, 52, 0.72); }
.mw_transparency_73 { background: rgba(39, 43, 52, 0.73); }
.mw_transparency_74 { background: rgba(39, 43, 52, 0.74); }
.mw_transparency_75 { background: rgba(39, 43, 52, 0.75); }
.mw_transparency_76 { background: rgba(39, 43, 52, 0.76); }
.mw_transparency_77 { background: rgba(39, 43, 52, 0.77); }
.mw_transparency_78 { background: rgba(39, 43, 52, 0.78); }
.mw_transparency_79 { background: rgba(39, 43, 52, 0.79); }
.mw_transparency_80 { background: rgba(39, 43, 52, 0.80); }
.mw_transparency_81 { background: rgba(39, 43, 52, 0.81); }
.mw_transparency_82 { background: rgba(39, 43, 52, 0.82); }
.mw_transparency_83 { background: rgba(39, 43, 52, 0.83); }
.mw_transparency_84 { background: rgba(39, 43, 52, 0.84); }
.mw_transparency_85 { background: rgba(39, 43, 52, 0.85); }
.mw_transparency_86 { background: rgba(39, 43, 52, 0.86); }
.mw_transparency_87 { background: rgba(39, 43, 52, 0.87); }
.mw_transparency_88 { background: rgba(39, 43, 52, 0.88); }
.mw_transparency_89 { background: rgba(39, 43, 52, 0.89); }
.mw_transparency_90 { background: rgba(39, 43, 52, 0.90); }
.mw_transparency_91 { background: rgba(39, 43, 52, 0.91); }
.mw_transparency_92 { background: rgba(39, 43, 52, 0.92); }
.mw_transparency_93 { background: rgba(39, 43, 52, 0.93); }
.mw_transparency_94 { background: rgba(39, 43, 52, 0.94); }
.mw_transparency_95 { background: rgba(39, 43, 52, 0.95); }
.mw_transparency_96 { background: rgba(39, 43, 52, 0.96); }
.mw_transparency_97 { background: rgba(39, 43, 52, 0.97); }
.mw_transparency_98 { background: rgba(39, 43, 52, 0.98); }
.mw_transparency_99 { background: rgba(39, 43, 52, 0.99); }