Formatting, removed unused affinit option

This commit is contained in:
Joseph Coffland 2020-04-06 22:44:41 -07:00
parent 21a7d38002
commit 9aeeff0fbd
4 changed files with 25 additions and 186 deletions

View File

@ -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:

View File

@ -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)

View File

@ -1788,7 +1788,7 @@ Warning, changes you make here may render your client inaccessible even from the
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">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.</property>
<property name="label" translatable="yes">If you set a password here clients will be required to enter this password to gain access to the console client.</property>
</object>
<packing>
<property name="expand">False</property>
@ -2175,135 +2175,6 @@ The following range specification matches all IP address:
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame40">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkAlignment" id="alignment42">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox36">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="wlabel20">
<property name="width_request">1</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">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.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="table9">
<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">4</property>
<child>
<object class="GtkEntry" id="command_allow_no_pass_option">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="command_deny_no_pass_option">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">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>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label74">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">&lt;b&gt;Allow&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label75">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">&lt;b&gt;Deny&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label65">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Passwordless IP Address Restriction&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
</object>
@ -3259,20 +3130,6 @@ Addresses listed here also need to be listed above to allow access.</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cpu_affinity_option">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="wlabel28">
<property name="width_request">100</property>
<property name="visible">True</property>
@ -3286,22 +3143,6 @@ Addresses listed here also need to be listed above to allow access.</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="wlabel29">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="label" translatable="yes">Try to lock cores to a specific CPU. Also known as CPU affinity locking.</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>
</child>
</object>
@ -5667,9 +5508,6 @@ WARNING, changing these values can make your GPU folding slot fail.</property>
<object class="GtkTextBuffer" id="textbuffer11">
<property name="text" translatable="yes">Disable highly optimized assembly code. Useful if core fails to run because of unsupported instructions.</property>
</object>
<object class="GtkTextBuffer" id="textbuffer12">
<property name="text" translatable="yes">Try to lock cores to a specific CPU. Also known as CPU affinity locking.</property>
</object>
<object class="GtkTextBuffer" id="textbuffer13">
<property name="text" translatable="yes">Pause work while on battery power. This is useful for laptops.</property>
</object>
@ -5716,7 +5554,7 @@ WARNING, changing these values can make your GPU folding slot fail.</property>
<property name="text" translatable="yes">This application allows you to monitor and control one or more Folding@home version 7 or newer console clients.</property>
</object>
<object class="GtkTextBuffer" id="textbuffer27">
<property name="text" translatable="yes">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.</property>
<property name="text" translatable="yes">If you set a password here clients will be required to enter this password to gain access to the console client.</property>
</object>
<object class="GtkTextBuffer" id="textbuffer28">
<property name="text" translatable="yes">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.

View File

@ -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