Skip to content

Commit

Permalink
Fix two 'first run' bugs (#62)
Browse files Browse the repository at this point in the history
* Avoid crash on exit when no configuration is present.

Specifically this is seen the first time the program
runs on a system.

#59

* ensure the configuration directory is always present

Currently the UI displays a blank ExpressKey window
the first time the program is run. If we create the
config directory earlier in the process the ExpressKey
panel will always be visible.
  • Loading branch information
skomra authored Feb 13, 2022
1 parent ebef0ae commit a801913
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wacom-gui/wacom-gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def getConfigs(self, idx):
self.tablet_data.tablets[dev][dev_id]['conf_path'] = os.path.join(home, dev)
if dev not in self.configs.keys():
self.configs[dev] = {}
if not os.path.exists(conf_path):
os.mkdir(self.tablet_data.tablets[dev][dev_id]['conf_path'])
if os.path.exists(conf_path):
# get configs in path
for config in os.listdir(conf_path):
Expand Down Expand Up @@ -267,9 +269,7 @@ def getConfigs(self, idx):
self.configButtons.btn_grp.buttons()[idx].setChecked(True)
self.tablet_data.tablets[dev][dev_id]['config'] = self.config
else:
os.mkdir(self.tablet_data.tablets[dev][dev_id]['conf_path'])
self.configLayout.addButton(
self.configButtons.addButton("default", 0, 0, 0, os.path.join(self.cwd, 'icons/ui/config.png'), 48))
pass

def loadConfig(self, dev, dev_id, config):
# TODO: load cursor configs
Expand Down Expand Up @@ -366,6 +366,9 @@ def boxdelete(self, box):
break

def updateConfigs(self):
# if there is no config don't try to update the configs
if (self.config == None):
return
write = False
if not self.toolButtons.buttons[(0, 0)].isHidden():
pad = self.pad.get_config()
Expand Down

0 comments on commit a801913

Please sign in to comment.