Skip to content

Commit

Permalink
changes to fwget function call changes to setModel
Browse files Browse the repository at this point in the history
  • Loading branch information
HelaFaye committed Nov 8, 2019
1 parent 49a95f0 commit e66e7cc
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
from fwupd import FWUpd
from fwget import FWGet

thread = Thread()
thread0 = Thread()
thread1 = Thread()

class NineRiFt(App):

Expand Down Expand Up @@ -65,14 +66,21 @@ def fwget_reload(self, mod):
self.fwget.setModel(mod)
self.fwget.setRepo("https://files.scooterhacking.org/" + self.model + "/fw/repo.json")
self.fwget.loadRepo(self.fwget.repoURL)

try:
toast("Firmware repo loaded")
except:
print("Firmware repo loaded")

# threaded firmware downloading function
def fwget_func(self, dev, ver):
global thread
if thread.isAlive() == False:
thread = Thread(target=self.fwget.Gimme, args=(dev, ver))
thread.start()
global thread1
if thread1.isAlive() == False:
thread1 = Thread(target=self.fwget.Gimme, args=(dev, ver))
thread1.start()
try:
toast("Firmware download started")
except:
print("Firmware download started")
else:
try:
toast("download already in progress!")
Expand All @@ -82,10 +90,10 @@ def fwget_func(self, dev, ver):

# threaded firmware flashing function
def fwupd_func(self, sel):
global thread
if thread.isAlive() == False:
thread = Thread(target=self.fwupd.Flash, args=(sel,))
thread.start()
global thread0
if thread0.isAlive() == False:
thread0 = Thread(target=self.fwupd.Flash, args=(sel,))
thread0.start()
try:
toast("Firmware update started")
except:
Expand Down Expand Up @@ -115,6 +123,7 @@ def fwget_dynver(sel):
dev = self.fwget.DRV
for i in dev:
fwget_verselspin.values.append(str(i))
print('FWGet Vers. available: '+str(fwget_verselspin.values))
return fwget_verselspin.values


Expand All @@ -132,14 +141,14 @@ def selfile_filter(vers, dev):
else:
sf = ['*.bin']
selfile.filters = sf+check
elif self.model is 'm365pro':
if self.model is 'm365pro':
if dev is 'DRV':
sf = ['*.bin.enc']
selfile.filters = sf+check
else:
sf = ['*.bin']
selfile.filters = sf+check
else:
if self.model is 'esx':
sf = ['*.bin.enc']
selfile.filters = sf+check
print('selfile_filter set to %s' % selfile.filters)
Expand All @@ -163,7 +172,7 @@ def modsel_func(mod):
self.versel = False
if mod is 'esx':
self.hasextbms = True
selfile_filter(flash_verselspin.text, self.part)
selfile_filter(None, self.part)
if self.hasextbms is True:
try:
devselspin.values.append('ExtBMS')
Expand All @@ -177,6 +186,7 @@ def modsel_func(mod):
if self.versel is True:
flashtopbtnlayout.add_widget(flash_verselspin)
self.model = mod
self.fwget_reload(mod)
selfile_filter(flash_verselspin.text, self.part)
flashtopbtnlayout.do_layout()

Expand All @@ -186,6 +196,7 @@ def setdevice(dev):
self.part = dev
self.fwupd.setdev(self.part)
selfile_filter(flash_verselspin.text, self.part)
flashtopbtnlayout.do_layout()


# define screens
Expand Down

0 comments on commit e66e7cc

Please sign in to comment.