Skip to content

Commit

Permalink
Fixed appindicator
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxHeki committed Dec 2, 2021
1 parent df39b90 commit e42400d
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions xmrigui.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get_config(self):
def start_mining(self, profile, save=True):
if save:
self.config[profile]['mine'] = True
self.save('switch', restart=False)
self.save(restart=False)

args = ''
if not self.config[profile]['default_args']:
Expand Down Expand Up @@ -127,21 +127,24 @@ def stop_mining(self, profile, restart=True, save=True):

if save:
self.config[profile]['mine'] = False
self.save('switch', restart=False)
self.save(restart=False)

def save(self, restart=True):
for profile in self.profiles:
self.config[profile]['pool'] = self.widgets[profile]['pool_entry'].get_text()
self.config[profile]['user'] = self.widgets[profile]['user_entry'].get_text()
self.config[profile]['password'] = self.widgets[profile]['pass_entry'].get_text()
self.config[profile]['donate'] = self.widgets[profile]['donate_entry'].get_text()
self.config[profile]['threads'] = self.widgets[profile]['threads_entry'].get_text()
self.config[profile]['cuda'] = self.widgets[profile]['cuda_switch'].get_active()
self.config[profile]['opencl'] = self.widgets[profile]['opencl_switch'].get_active()
self.config[profile]['cpu'] = self.widgets[profile]['cpu_switch'].get_active()
self.config[profile]['args'] = self.widgets[profile]['args_entry'].get_text()
self.config[profile]['default_args'] = self.widgets[profile]['default_args_switch'].get_active()
self.config[profile]['coin'] = self.widgets[profile]['crypto_chooser'].get_active()
try:
for profile in self.profiles:
self.config[profile]['pool'] = self.widgets[profile]['pool_entry'].get_text()
self.config[profile]['user'] = self.widgets[profile]['user_entry'].get_text()
self.config[profile]['password'] = self.widgets[profile]['pass_entry'].get_text()
self.config[profile]['donate'] = self.widgets[profile]['donate_entry'].get_text()
self.config[profile]['threads'] = self.widgets[profile]['threads_entry'].get_text()
self.config[profile]['cuda'] = self.widgets[profile]['cuda_switch'].get_active()
self.config[profile]['opencl'] = self.widgets[profile]['opencl_switch'].get_active()
self.config[profile]['cpu'] = self.widgets[profile]['cpu_switch'].get_active()
self.config[profile]['args'] = self.widgets[profile]['args_entry'].get_text()
self.config[profile]['default_args'] = self.widgets[profile]['default_args_switch'].get_active()
self.config[profile]['coin'] = self.widgets[profile]['crypto_chooser'].get_active()
except:
pass

with open(self.settings_path, 'w') as f: f.write(json.dumps(self.config))

Expand Down Expand Up @@ -340,16 +343,16 @@ def on_save(self, widget, state=None):
self.save()

def profile0_menu(self, widget):
if self.config[self.profiles[0]]['mine']: self.widgets[self.profiles[0]]['mine_switch'].set_active(False)
else: self.widgets[self.profiles[0]]['mine_switch'].set_active(True)
if self.config[self.profiles[0]]['mine']: self.stop_mining(self.profiles[0])
else: self.start_mining(self.profiles[0])

def profile1_menu(self, widget):
if self.config[self.profiles[1]]['mine']: self.widgets[self.profiles[1]]['mine_switch'].set_active(False)
else: self.widgets[self.profiles[1]]['mine_switch'].set_active(True)
if self.config[self.profiles[1]]['mine']: self.stop_mining(self.profiles[1])
else: self.start_mining(self.profiles[1])

def profile2_menu(self, widget):
if self.config[self.profiles[2]]['mine']: self.widgets[self.profiles[2]]['mine_switch'].set_active(False)
else: self.widgets[self.profiles[2]]['mine_switch'].set_active(True)
if self.config[self.profiles[2]]['mine']: self.stop_mining(self.profiles[2])
else: self.start_mining(self.profiles[2])

def load_data(self):
self.user = os.getlogin()
Expand Down

0 comments on commit e42400d

Please sign in to comment.