From 9aeeff0fbd5479eed83bd1f115ab91c68295ee27 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Mon, 6 Apr 2020 22:44:41 -0700 Subject: [PATCH] Formatting, removed unused affinit option --- fah/ClientConfig.py | 6 +- fah/Connection.py | 15 ++-- fah/FAHControl.glade | 166 +------------------------------------------ fah/FAHControl.py | 24 +++---- 4 files changed, 25 insertions(+), 186 deletions(-) diff --git a/fah/ClientConfig.py b/fah/ClientConfig.py index 1694203..ea32253 100644 --- a/fah/ClientConfig.py +++ b/fah/ClientConfig.py @@ -361,8 +361,8 @@ class ClientConfig: try: set_widget_str_value(widget, self.options[name]) - except: # Don't let one bad widget kill everything - print ('WARNING: failed to set widget "%s"' % name) + except Exception as e: # Don't let one bad widget kill everything + print('WARNING: failed to set widget "%s": %s' % (name, e)) # Setup passkey and password entries app.passkey_validator.set_good() @@ -619,7 +619,7 @@ class ClientConfig: else: options[name] = value except Exception as e: # Don't let one bad widget kill everything - print ('WARNING: failed to save widget "%s": %s' % (name, e)) + print('WARNING: failed to save widget "%s": %s' % (name, e)) # Removed options for name in self.options: diff --git a/fah/Connection.py b/fah/Connection.py index 740845d..8178953 100644 --- a/fah/Connection.py +++ b/fah/Connection.py @@ -129,14 +129,14 @@ class Connection: def connection_lost(self): - print ('Connection lost') + print('Connection lost') self.close() self.fail_reason = 'closed' raise Exception('Lost connection') def connection_error(self, err, msg): - print ('Connection Error: %d: %s' % (err, msg)) + print('Connection Error: %d: %s' % (err, msg)) self.close() if err == errno.ECONNREFUSED: self.fail_reason = 'refused' elif err in [errno.ETIMEDOUT, errno.ENETDOWN, errno.ENETUNREACH]: @@ -194,7 +194,7 @@ class Connection: def queue_command(self, command): - if debug: print ('command: ' + command) + if debug: print('command: ' + command) self.writeBuf += command + '\n' @@ -205,7 +205,7 @@ class Connection: self.messages.append((version, type, msg)) self.last_message = time.time() except Exception as e: - print ('ERROR parsing PyON message: %s: %s' + print('ERROR parsing PyON message: %s: %s' % (str(e), data.encode('string_escape'))) @@ -261,12 +261,13 @@ class Connection: else: raise except Exception as e: - print ('ERROR on connection to %s:%d: %s' % (self.address, self.port, e)) + print('ERROR on connection to %s:%d: %s' % ( + self.address, self.port, e)) # Timeout connection if self.connected and self.last_message and \ self.last_message + 10 < time.time(): - print ('Connection timed out') + print('Connection timed out') self.close() @@ -281,7 +282,7 @@ if __name__ == '__main__': conn.update() for version, type, data in conn.messages: - print ('PyON %d %s:\n' % (version, type), data) + print('PyON %d %s:\n' % (version, type), data) conn.messages = [] time.sleep(0.1) diff --git a/fah/FAHControl.glade b/fah/FAHControl.glade index 959df4c..1d8b1b7 100644 --- a/fah/FAHControl.glade +++ b/fah/FAHControl.glade @@ -1788,7 +1788,7 @@ Warning, changes you make here may render your client inaccessible even from the False 0 0 - If you set a password here clients will be required to enter this password to gain access to the console client. Otherwise, only clients which are listed in the Passwordless IP Addresses section will be allowed to access this client. + If you set a password here clients will be required to enter this password to gain access to the console client. False @@ -2175,135 +2175,6 @@ The following range specification matches all IP address: 3 - - - True - False - 0 - - - True - False - 12 - - - True - False - 8 - - - 1 - True - False - 0 - 0 - These fields accept the same format as above however, the IP address filter created by these fields will allowed to access the client with out a password. - -Great care should be taken when modifying these fields. Normally, only the local IP address 127.0.0.1 should be allowed unless your network is protected by other means and you would like more convenient access to this client. - -Addresses listed here also need to be listed above to allow access. - - - False - True - 0 - - - - - True - False - 2 - 2 - 4 - - - True - True - - False - False - True - True - - - 1 - 2 - GTK_FILL - - - - - True - True - - False - False - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - False - 1 - <b>Allow</b> - True - - - GTK_FILL - GTK_FILL - - - - - True - False - 1 - <b>Deny</b> - True - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - 1 - - - - - - - - - True - False - <b>Passwordless IP Address Restriction</b> - True - - - - - False - True - 4 - - @@ -3259,20 +3130,6 @@ Addresses listed here also need to be listed above to allow access. - - False - True - True - False - True - - - 1 - 2 - GTK_FILL - - - 100 True @@ -3286,22 +3143,6 @@ Addresses listed here also need to be listed above to allow access. 2 - - - 100 - True - False - 0 - 0 - Try to lock cores to a specific CPU. Also known as CPU affinity locking. - - - 1 - 2 - 1 - 2 - - @@ -5667,9 +5508,6 @@ WARNING, changing these values can make your GPU folding slot fail. Disable highly optimized assembly code. Useful if core fails to run because of unsupported instructions. - - Try to lock cores to a specific CPU. Also known as CPU affinity locking. - Pause work while on battery power. This is useful for laptops. @@ -5716,7 +5554,7 @@ WARNING, changing these values can make your GPU folding slot fail. This application allows you to monitor and control one or more Folding@home version 7 or newer console clients. - If you set a password here clients will be required to enter this password to gain access to the console client. Otherwise, only clients which are listed in the Passwordless IP Addresses section will be allowed to access this client. + If you set a password here clients will be required to enter this password to gain access to the console client. The options in this section can be used to configure remote access to Folding@home clients. This is mainly only useful to expert users running multiple clients which they would like to monitor and control from another computer. These options may be safely ignored as the defaults are safe and will not allow any remote access. diff --git a/fah/FAHControl.py b/fah/FAHControl.py index d87cdb8..28b7dd8 100644 --- a/fah/FAHControl.py +++ b/fah/FAHControl.py @@ -79,7 +79,7 @@ def osx_version(): try: ver = tuple([int(x) for x in platform.mac_ver()[0].split('.')]) except Exception as e: - print (e) + print(e) darwin_ver = platform.release().split('.') ver = (10, int(darwin_ver[0]) - 4, int(darwin_ver[1])) return ver @@ -104,7 +104,7 @@ def osx_add_GtkApplicationDelegate_methods(): signature = sig1) ]) except Exception as e: - print (e) + print(e) def osx_accel_window_close(accel_group, acceleratable, keyval, modifier): @@ -175,7 +175,7 @@ class FAHControl(SingleAppServer): self.db = load_fahcontrol_db() except Exception as e: - print (e) + print(e) sys.exit(1) # OSX integration @@ -542,7 +542,7 @@ class FAHControl(SingleAppServer): osx_accel_window_minimize) self.window.add_accel_group(ag) except Exception as e: - print (e) + print(e) gtk.main() @@ -606,7 +606,7 @@ class FAHControl(SingleAppServer): try: subprocess.Popen(cmd) except Exception as e: - print (e, ':', ' '.join(cmd)) + print(e, ':', ' '.join(cmd)) def connect_option_cell(self, name, model, col): @@ -712,7 +712,7 @@ class FAHControl(SingleAppServer): try: self.db.flush_queued() except Exception as e: - print (e) + print(e) sys.exit(0) # Force shutdown @@ -744,7 +744,7 @@ class FAHControl(SingleAppServer): def load_theme(self, theme): for name, rc in self.theme_list: if theme == name: - print ('Loading theme %r' % theme) + print('Loading theme %r' % theme) settings = gtk.settings_get_default() @@ -953,7 +953,7 @@ class FAHControl(SingleAppServer): self.client_list.row_changed(path, iter) iter = self.client_list.iter_next(iter) except Exception as e: - print (e) + print(e) return False # no timer repeat @@ -971,7 +971,7 @@ class FAHControl(SingleAppServer): name = client.name i = ibyname_old.get(name) if i is None: - print ('unable to resort client list: unknown name %s' % name) + print('unable to resort client list: unknown name %s' % name) return new_order.append(i) self.client_list.reorder(new_order) @@ -1246,7 +1246,7 @@ class FAHControl(SingleAppServer): # log to terminal window if sys.exc_info()[2]: traceback.print_exc() - print ('ERROR: %s' % message) + print('ERROR: %s' % message) # Don't open more than one if self.error_dialog is not None: return False @@ -1353,7 +1353,7 @@ class FAHControl(SingleAppServer): if slot is not None: cmd.append('--slot=%d' % slot.id) debug = True - if debug: print (cmd) + if debug: print(cmd) try: if sys.platform == 'darwin': @@ -1395,7 +1395,7 @@ class FAHControl(SingleAppServer): def on_window_is_active(self, window, *args): try: if window.is_active(): self.update_client_list() - except Exception as e: print (e) + except Exception as e: print(e) # Preferences signals