diff --git a/fah/Client.py b/fah/Client.py index 7c652c5..039909c 100644 --- a/fah/Client.py +++ b/fah/Client.py @@ -24,7 +24,7 @@ import time import re import copy import collections -import gtk +from gi.repository import Gtk import subprocess import time import sys diff --git a/fah/ClientConfig.py b/fah/ClientConfig.py index 5a7084e..19a1e69 100644 --- a/fah/ClientConfig.py +++ b/fah/ClientConfig.py @@ -20,7 +20,7 @@ ############################################################################### import sys -import gtk +from gi.repository import Gtk import traceback import re diff --git a/fah/FAHControl.py b/fah/FAHControl.py index fb2ea4b..d4188c4 100644 --- a/fah/FAHControl.py +++ b/fah/FAHControl.py @@ -29,7 +29,7 @@ import request import urllib.parse import urllib.error -import gtk +from gi.repository import Gtk import glib import pygtk import pango diff --git a/fah/Icon.py b/fah/Icon.py index 9ad1fbc..ddc5e53 100644 --- a/fah/Icon.py +++ b/fah/Icon.py @@ -19,7 +19,7 @@ # # ############################################################################### -import gtk +from gi.repository import Gtk icons = {'tiny': None, 'small': None, 'medium': None, 'large': None} viewer_icons = {'tiny': None, 'small': None, 'medium': None, 'large': None} diff --git a/fah/SlotConfig.py b/fah/SlotConfig.py index 6781831..bc45643 100644 --- a/fah/SlotConfig.py +++ b/fah/SlotConfig.py @@ -19,7 +19,7 @@ # # ############################################################################### -import gtk +from gi.repository import Gtk import gobject import copy diff --git a/fah/WidgetMap.py b/fah/WidgetMap.py index a919e30..880c57b 100644 --- a/fah/WidgetMap.py +++ b/fah/WidgetMap.py @@ -19,7 +19,7 @@ # # ############################################################################### -import gtk +from gi.repository import Gtk class WidgetMap(dict): diff --git a/fah/util/OrderedDict.py b/fah/util/OrderedDict.py index 63cbcf2..313f259 100644 --- a/fah/util/OrderedDict.py +++ b/fah/util/OrderedDict.py @@ -21,6 +21,7 @@ from UserDict import DictMixin + class OrderedDict(dict, DictMixin): def __init__(self, *args, **kwds): diff --git a/fah/util/PasswordValidator.py b/fah/util/PasswordValidator.py index 6e52d93..d00b1b0 100644 --- a/fah/util/PasswordValidator.py +++ b/fah/util/PasswordValidator.py @@ -1,34 +1,37 @@ -################################################################################ -# # -# Folding@Home Client Control (FAHControl) # -# Copyright (C) 2016-2020 foldingathome.org # -# Copyright (C) 2010-2016 Stanford University # -# # -# 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 3 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. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -################################################################################ +############################################################################### +# # +# Folding@Home Client Control (FAHControl) # +# Copyright (C) 2016-2020 foldingathome.org # +# Copyright (C) 2010-2016 Stanford University # +# # +# 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 3 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. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### -import gtk - +from gi.repository import Gtk from fah.util.EntryValidator import EntryValidator class PasswordValidator(EntryValidator): def __init__(self, app, password_entry, reenter_entry, valid_image, - valid_text, pattern = r'^.*$', description = ''): - EntryValidator.__init__(self, app, password_entry, pattern, description) + valid_text, pattern=r'^.*$', description=''): + EntryValidator.__init__(self, + app, + password_entry, + pattern, + description) self.password_entry = password_entry self.reenter_entry = reenter_entry @@ -40,39 +43,38 @@ class PasswordValidator(EntryValidator): password_entry.connect('changed', self.on_changed) reenter_entry.connect('changed', self.on_changed) - def set_good(self): - if not self.is_valid(): self.password_entry.set_text('') + if not self.is_valid(): + self.password_entry.set_text('') password = self.password_entry.get_text() self.reenter_entry.set_text(password) - def is_good(self): return self.entries_match() and self.is_valid() - def entries_match(self): password = self.password_entry.get_text() reenter = self.reenter_entry.get_text() return password == reenter - def update(self): valid = False if self.is_valid(): - if self.entries_match(): valid = True + if self.entries_match(): + valid = True else: self.valid_text.set_text('Entries do not match') - else: self.valid_text.set_text('Entry is invalid') + else: + self.valid_text.set_text('Entry is invalid') if valid: - self.valid_image.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_BUTTON) + self.valid_image.set_from_stock(Gtk.STOCK_YES, + Gtk.ICON_SIZE_BUTTON) self.valid_text.set_text('Entries match') else: - self.valid_image.set_from_stock(gtk.STOCK_DIALOG_ERROR, - gtk.ICON_SIZE_BUTTON) + self.valid_image.set_from_stock(Gtk.STOCK_DIALOG_ERROR, + Gtk.ICON_SIZE_BUTTON) - - def on_changed(self, widget, data = None): + def on_changed(self, widget, data=None): self.update() - return False # Let the signal propagate + return False # Let the signal propagate diff --git a/fah/util/SingleApp.py b/fah/util/SingleApp.py index 9fd66ef..3b57cee 100644 --- a/fah/util/SingleApp.py +++ b/fah/util/SingleApp.py @@ -24,7 +24,7 @@ import socket import threading import socketserver -import gtk +from gi.repository import Gtk from fah.Icon import get_icon diff --git a/fah/util/__init__.py b/fah/util/__init__.py index 723b66d..4ef3aaf 100644 --- a/fah/util/__init__.py +++ b/fah/util/__init__.py @@ -23,7 +23,7 @@ # fah.util import sys import os -import gtk +from gi.repository import Gtk if sys.platform == 'darwin': try: diff --git a/fah/wraplabel.py b/fah/wraplabel.py index 5b5da0c..9016fb4 100644 --- a/fah/wraplabel.py +++ b/fah/wraplabel.py @@ -19,7 +19,7 @@ # # ############################################################################### -import gtk +from gi.repository import Gtk import gobject import pango