def start(self): """Do the rest of the setup before turning control over to the reactor""" self._setup_environment() self._load_settings() self._load_data() self._create_applications() #in case this was the first run: self.bbApp.settings.fileName = os.path.join(Globals.USER_DATA_DIR, BitBlinder.BitBlinderSettings.defaultFile) GlobalEvents.throw_event("settings_changed") #must be done after settings are loaded self._start_psyco() #check for updates for the program: Updater.get().start() #start the bank bankStartupDeferred = self.bankApp.start() bankStartupDeferred.addCallback(self._on_bank_ready) bankStartupDeferred.addErrback(log_ex, "Bank failed to start!") #the rest of the startup code needs to run after the reactor has started: Scheduler.schedule_once(0.0, self._on_reactor_started)
def start(self): """Do the rest of the setup before turning control over to the reactor""" self._setup_environment() self._load_settings() self._load_data() self._create_applications() #in case this was the first run: self.bbApp.settings.fileName = os.path.join( Globals.USER_DATA_DIR, BitBlinder.BitBlinderSettings.defaultFile) GlobalEvents.throw_event("settings_changed") #must be done after settings are loaded self._start_psyco() #check for updates for the program: Updater.get().start() #start the bank bankStartupDeferred = self.bankApp.start() bankStartupDeferred.addCallback(self._on_bank_ready) bankStartupDeferred.addErrback(log_ex, "Bank failed to start!") #the rest of the startup code needs to run after the reactor has started: Scheduler.schedule_once(0.0, self._on_reactor_started)
def update_check(self, widget=None, event=None): def success_cb(data, httpDownloadInstance): if not Updater.get().update_request_done(data, httpDownloadInstance): self.show_msgbox("You are using the latest available packaged version.") else: self.show_msgbox("BitBlinder is downloading a new version. It will prompt you when the update is ready.") def failure_cb(failure, httpDownloadInstance): log_ex(failure, "Failed to manually check for update") self.show_msgbox("A server is temporarily offline; check back later.") Updater.get().check_for_updates(success_cb=success_cb, failure_cb=failure_cb)
def cleanup(self): """Make sure the reactor, threads, etc have been stopped. Also removes the file that indicates we shutdown cleanly.""" #shutdown Twisted if ProgramState.USE_GTK: Globals.reactor.stop() Globals.reactor.runUntilCurrent() #ensure that all threads have closed: remainingThreads = threading.enumerate() for thread in remainingThreads: if threading._MainThread != type(thread): log_msg( "Thread has not finished by the end of the program: %s" % (thread), 1) #start the update if necessary: if Updater.get().APPLY_UPDATE: ClientUtil.apply_update() #NOTE: we intentionally leave the log files open so that errors can get written to them... log_msg("Thanks for using BitBlinder", 2) ErrorReporting.destroy_marker_file() #NOTE: this is here so that threads can finish properly. I was getting errors from leftover threads without it. #However, I'm pretty sure that it was just from the IDE time.sleep(0.2)
def cleanup(self): """Make sure the reactor, threads, etc have been stopped. Also removes the file that indicates we shutdown cleanly.""" #shutdown Twisted if ProgramState.USE_GTK: Globals.reactor.stop() Globals.reactor.runUntilCurrent() #ensure that all threads have closed: remainingThreads = threading.enumerate() for thread in remainingThreads: if threading._MainThread != type(thread): log_msg("Thread has not finished by the end of the program: %s" % (thread), 1) #start the update if necessary: if Updater.get().APPLY_UPDATE: ClientUtil.apply_update() #NOTE: we intentionally leave the log files open so that errors can get written to them... log_msg("Thanks for using BitBlinder", 2) ErrorReporting.destroy_marker_file() #NOTE: this is here so that threads can finish properly. I was getting errors from leftover threads without it. #However, I'm pretty sure that it was just from the IDE time.sleep(0.2)
def success_cb(data, httpDownloadInstance): if not Updater.get().update_request_done(data, httpDownloadInstance): self.show_msgbox( "You are using the latest available packaged version.") else: self.show_msgbox( "BitBlinder is downloading a new version. It will prompt you when the update is ready." )
def update_check(self, widget=None, event=None): def success_cb(data, httpDownloadInstance): if not Updater.get().update_request_done(data, httpDownloadInstance): self.show_msgbox( "You are using the latest available packaged version.") else: self.show_msgbox( "BitBlinder is downloading a new version. It will prompt you when the update is ready." ) def failure_cb(failure, httpDownloadInstance): log_ex(failure, "Failed to manually check for update") self.show_msgbox( "A server is temporarily offline; check back later.") Updater.get().check_for_updates(success_cb=success_cb, failure_cb=failure_cb)
def success_cb(data, httpDownloadInstance): if not Updater.get().update_request_done(data, httpDownloadInstance): self.show_msgbox("You are using the latest available packaged version.") else: self.show_msgbox("BitBlinder is downloading a new version. It will prompt you when the update is ready.")