Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to python3 anf GTK3 #31

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9eae571
migrate to python3
stokito Oct 1, 2023
72f73f3
migrate to GTK3
stokito Oct 1, 2023
88df004
core.py migrate dialog to GTK3
stokito Oct 1, 2023
52f075c
main.glade rollback control mask
stokito Oct 1, 2023
73a3459
core.py migrate window
stokito Oct 1, 2023
1b25070
core.py disable fonts
stokito Oct 1, 2023
608782a
cfg.py use assets from the current dir
stokito Oct 1, 2023
92ce2fd
shebang
stokito Oct 1, 2023
015f6ad
migrate colors
stokito Oct 1, 2023
2ccf454
fix bytes to str conversion
stokito Oct 1, 2023
4505dc1
Fix Font
stokito Oct 1, 2023
5748987
Fix prefs window
stokito Oct 1, 2023
fea1d3b
glade files: migrate to Gtk3
stokito Oct 1, 2023
2b82eed
README.md update
stokito Oct 1, 2023
38cc108
Automatically reformat
stokito Oct 24, 2023
84ffe87
Fix FILE_CHOOSER_CONFIRMATION_*
stokito Oct 24, 2023
607f90b
GPG now is anyway GPG2
stokito Oct 24, 2023
89e3ed9
core.py optimize
stokito Oct 24, 2023
147172f
core.py migrate GLib.IO_*
stokito Oct 24, 2023
25eef71
core.py remove ----
stokito Oct 28, 2023
4180a28
README.md simplify
stokito Oct 28, 2023
a5c785b
core.py fix PEP warnings
stokito Oct 28, 2023
85314de
crypt_interface.py fix PEP issues
stokito Oct 28, 2023
c9b4891
crypt_interface.py fix get_gpg_default_key()
stokito Oct 28, 2023
f6efab6
GPG_BINARY is always gpg
stokito Oct 28, 2023
cf47292
core.py gpg2
stokito Oct 28, 2023
b3cf5e7
fix_msgtxtview_color
stokito Oct 28, 2023
d6c5298
fix test_file_isbinary and negate to test_file_is_plain_text
stokito Oct 28, 2023
be2ae50
cleanup file headers
stokito Oct 28, 2023
5e9ab4c
Remove fixed bug with Drug and Drop
stokito Oct 28, 2023
dad7b10
README.md put Features first and remove Background
stokito Oct 28, 2023
6c4f142
v2.0.0
stokito Oct 28, 2023
950b52e
core.py simplify
stokito Oct 28, 2023
28ecbec
core.py simplify
stokito Oct 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 49 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,68 @@ Pyrite - Python/GTK+ encryption/signing frontend for GnuPG and OpenSSL

![](http://b19.org/linux/pyrite/1enc_txt.png)

## FEATURES

FEDORA/RHEL7 INSTALLATION
-------------------------
There's an RPM (and yum repository) @ [people.redhat.com/rsawhill/rpms](http://people.redhat.com/rsawhill/rpms/). To configure it and install Pyrite, simply run the following as root:
Pyrite acts as a frontend for GnuPG, doing symmetric or asymmetric encrypting/decrypting, as well as signing and verifying.
Additionally, it can use OpenSSL for simple symmetric encryption/decryption.

Pyrite can operate on text input or can take input and output filenames (text or binary) to pass directly to the backend program (i.e., gpg or openssl).

As you can see from the screenshots, Pyrite can utilize virtually all the encrypting features of GnuPG -- you can mix and match passphrase & public-key encryption & signing with one file, just like gpg, which will require interacting with your gpg-agent.
Or you can keep it simple and just use a passphrase as a shared key, in which case gpg-agent is bypassed and you only have to type the passphrase once.

Also shown in the screenshots is a Sign/Verify mode, where you can choose between the three types of signing: normal (Pyrite calls it "embedded"), where a signed copy of the message is created; clearsign, where the message is wrapped with a plaintext ASCII sig; or detached-sign, where a separate sig file is created.

If you're operating directly on files (in sign or encrypt mode) instead of ASCII text in the Pyrite window, you can choose what kind of output you want -- ASCII-armored (base64-encoded) text or normal binary output.

Not shown in the screenshots is drag & drop. You can drag text files onto the Message area and they are loaded up and you can drag text or binary files onto the *Input File For Direct Operation* button to set that.

If you end up working on very large input, you'll get a chance to *really* see the progress bar + pause/cancel buttons.
At the moment the progress bar doesn't report actual progress (that's coming), but the buttons do what they advertise, pausing or canceling the backend processing.

To top it all off, everything is configurable.
There's a preferences dialog that lets you play with all the settings, from tweaking gpg verbosity to setting the default operating mode to choosing your favorite cipher to configuring font size/color and window opacity.

If you find yourself wondering about a particular feature, just hover your mouse over its widget -- there are detailed tooltips for everything.


## FEDORA/RHEL7 INSTALLATION
There's an RPM (and yum repository) @ [people.redhat.com/rsawhill/rpms](https://people.redhat.com/rsawhill/rpms/). To configure it and install Pyrite, simply run the following as root:

```
yum install http://people.redhat.com/rsawhill/rpms/latest-rsawaroha-release.rpm
yum install https://people.redhat.com/rsawhill/rpms/latest-rsawaroha-release.rpm
yum install pyrite
```

Requirements and package names:

- gtk2 >= v2.24: `gtk2`
- python2 >= v2.7: `python`
- pygtk: `pygtk2`
- gpg/openssl: `gnupg2` or `gnupg` or `openssl`

*As per above, Pyrite is not compatible with RHEL6.*
- GTK3: `gtk3`
- Python3: `python3`
- `python3-gi`, `python3-gi-cairo`
- PGP `gnupg2` or OpenSSL `openssl`


DEBIAN/UBUNTU/OTHER LINUX INSTALLATION
--------------------------------------
There is a simple interactive shell installer. Before using it, ensure you have the following on your Linux system (Ubuntu package names):
## DEBIAN/UBUNTU/OTHER LINUX INSTALLATION

- gtk2 >= v2.24: `libgtk2.0-bin`
- python2 >= v2.7: `python`
- pygtk: `python-gtk2`
- gpg/openssl: `gnupg2` or (`gnupg` and `gnupg-agent`) or `openssl`
There is a simple interactive shell installer.

If requirements are met, clone the Pyrite repo with `git clone git://github.com/ryran/pyrite.git` **OR** [download a zip of the source](https://github.com/ryran/pyrite/archive/master.zip).
If requirements are met, clone the Pyrite repo with `git clone https://github.com/ryran/pyrite.git` **OR** [download a zip of the source](https://github.com/ryran/pyrite/archive/master.zip).

From the root source folder execute the interactive `INSTALL` script.


MORE SCREENSHOTS (v1.0.1):
-------------------------------
## MORE SCREENSHOTS (v1.0.1):

![](http://b19.org/linux/pyrite/2clearsign_txt.png)
![](http://b19.org/linux/pyrite/3enc_prog.png)
![](http://b19.org/linux/pyrite/4dec_txt.png)
![](http://b19.org/linux/pyrite/5openssl_txt.png)
![](http://b19.org/linux/pyrite/6prefs.png)

**`pyrite` command-line options:**

## `pyrite` command-line options
Type `pyrite --help`:
```
[rsaw:~]$ pyrite --help
usage: pyrite [-h] [-d | -t] [-e | -s] [-c] [-r RECIP] [-k KEYUID]
[-b {gpg,openssl}]
[INPUT]
Expand All @@ -75,48 +91,16 @@ optional arguments:
```


FEATURES
----------
Pyrite acts as a frontend for GnuPG, doing symmetric or asymmetric encrypting/decrypting, as well as signing and verifying. Additionally, it can use OpenSSL for simple symmetric encryption/decryption.

Pyrite can operate on text input or can take input and output filenames (text or binary) to pass directly to the backend program (i.e., gpg/gpg2 or openssl).

As you can see from the screenshots, Pyrite can utilize virtually all of the encrypting features of GnuPG -- you can mix and match passphrase & public-key encryption & signing with one file, just like gpg, which will require interacting with your gpg-agent. Or you can keep it simple and just use a passphrase as a shared key, in which case gpg-agent is bypassed and you only have to type the passphrase once.

Also shown in the screenshots is a Sign/Verify mode, where you can choose between the three types of signing: normal (Pyrite calls it "embedded"), where a signed copy of the message is created; clearsign, where the message is wrapped with a plaintext ASCII sig; or detached-sign, where a separate sig file is created.

If you're operating directly on files (in sign or encrypt mode) instead of ASCII text in the Pyrite window, you can choose what kind of output you want -- ASCII-armored (base64-encoded) text or normal binary output.

Not shown in the screenshots is drag & drop. You can drag text files onto the Message area and they are loaded up and you can drag text or binary files onto the *Input File For Direct Operation* button to set that.

If you end up working on very large input, you'll get a chance to *really* see the progress bar + pause/cancel buttons. At the moment the progress bar doesn't report actual progress (that's coming), but the buttons do what they advertise, pausing or canceling the backend processing.

To top it all off, everything is configurable. There's a preferences dialog that lets you play with all the settings, from tweaking gpg verbosity to setting the default operating mode to choosing your favorite cipher to configuring font size/color and window opacity.

If you find yourself wondering about a particular feature, just hover your mouse over its widget -- there are detailed tooltips for everything.

## BUGS and TODO

BUGS
----------
1) After launching Pyrite, the **first** drag/drop of a file onto the *Input File For Direct Operation* GtkFileChooserButton fails. After that the button works properly. I've been seeking out expertise on this weird bug but I haven't gotten anywhere. If you have any hints, hit me up, or check out [my post about it on stackoverflow](http://stackoverflow.com/questions/9047844/pygtk-troubles-with-drag-and-drop-file-to-gtkfilechooserbutton).

2) No undo. It wasn't a top priority at the beginning, but I think it's pretty essential for an application that basically contains a text editor to have an undo/redo stack. I'll do it eventually.


BACKGROUND
----------

The original goal of this project was to make symmetric {en,de}cryption more accessible and easy to use. While GPG rocks if you're comfortable on the commandline (for both symmetric & public-key), and there are GUI encryption options for public-key encryption (seahorse-plugins for nautilus being the best, in my opinion), there's not much out there for people who need to do the simplest kind of encryption -- with a shared passphrase.

After creating a few simple apps with BASH scripting, I decided it was time to learn Python. After the first few days I was in love.

Long story short, after a couple weeks of learning, I released my first version of this project in January 2012, quickly added public-key encryption, signing, & verifying, and have been improving it ever since. This being my first learning experience with GTK+, I have lots more to learn, but I'm damn proud of Pyrite.
- No undo. It wasn't a top priority at the beginning, but I think it's pretty essential for an application that basically contains a text editor to have an undo/redo stack. I'll do it eventually.
- Icons for encrypt, decrypt, sign, verify buttons, application
- Update notifications

PLEASE contact me (or [post a new issue on the tracker](/ryran/pyrite/issues)) with any suggestions, feedback, bug reports, or questions!


AUTHORS
-------
## AUTHORS

As far as direct contributions go, so far it's just me, [ryran](/ryran), aka rsaw, aka [Ryan Sawhill Aroha](http://b19.org).

Expand All @@ -125,8 +109,7 @@ The project could really use a little assistance from an artist -- it doesn't ha



LICENSE
-------
## LICENSE

Copyright (C) 2012, 2013 [Ryan Sawhill Aroha](http://b19.org)

Expand All @@ -138,19 +121,17 @@ the Free Software Foundation, either version 3 of the License, or
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 @[gnu.org/licenses/gpl.html](http://gnu.org/licenses/gpl.html>) for more details.


General Public License @[gnu.org/licenses/gpl.html](https://gnu.org/licenses/gpl.html>) for more details.


--------


Hmmmm. You're still here?

Oh. You must be wondering why the name [*Pyrite*](http://en.wikipedia.org/wiki/Pyrite), eh?
Oh. You must be wondering why the name [*Pyrite*](https://en.wikipedia.org/wiki/Pyrite), eh?

Well, I'll let my friend River--who came up with the name--explain it to you:
Well, I'll let my friend River who came up with the name explain it to you:

*"It should be 'Pyrite', because people think they are getting your data, but really it's just gibberish to them. Fool's gold."*
> It should be 'Pyrite', because people think they are getting your data, but really it's just gibberish to them.
> Fool's gold.

46 changes: 23 additions & 23 deletions modules/cfg.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of Pyrite.
# Last file mod: 2013/09/15
# Latest version at <http://github.com/ryran/pyrite>
#!/usr/bin/env python3
# Copyright 2012, 2013 Ryan Sawhill Aroha <[email protected]>
#
# License:
Expand All @@ -20,28 +15,33 @@
#
# You should have received a copy of the GNU General Public License
# along with Pyrite. If not, see <http://gnu.org/licenses/gpl.html>.
#
#------------------------------------------------------------------------------

import gtk
import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from os import getenv

# Important variables
VERSION = 'v1.0.2'
ASSETDIR = '/usr/share/pyrite/'
USERPREF_FILE = getenv('HOME') + '/.pyrite'
USERPREF_FORMAT_INFO = {'version':'Must6fa'}
VERSION = 'v2.0.0'
ASSETDIR = './'
USERPREF_FILE = getenv('HOME') + '/.pyrite'
USERPREF_FORMAT_INFO = {'version': 'Must6fa'}

# List of possible Infobar message types
MSGTYPES = [0,
gtk.MESSAGE_INFO, # 1
gtk.MESSAGE_QUESTION, # 2
gtk.MESSAGE_WARNING, # 3
gtk.MESSAGE_ERROR] # 4
MSGTYPES = [
0,
Gtk.MessageType.INFO, # 1
Gtk.MessageType.QUESTION, # 2
Gtk.MessageType.WARNING, # 3
Gtk.MessageType.ERROR # 4
]

# List of possible images to show in Infobar
IMGTYPES = [gtk.STOCK_APPLY, # 0
gtk.STOCK_DIALOG_INFO, # 1
gtk.STOCK_DIALOG_QUESTION, # 2
gtk.STOCK_DIALOG_WARNING, # 3
gtk.STOCK_DIALOG_ERROR] # 4
IMGTYPES = [
Gtk.STOCK_APPLY, # 0
Gtk.STOCK_DIALOG_INFO, # 1
Gtk.STOCK_DIALOG_QUESTION, # 2
Gtk.STOCK_DIALOG_WARNING, # 3
Gtk.STOCK_DIALOG_ERROR # 4
]
Loading