def __init__(self, fn): super(MainWindow, self).__init__() self.data = TacmaData(fn) self.setUi() # -- tray icon self.ticon = TrayIcon(self) self.ticon.show() #autosave and save at exit if tacmaopt.opt.autosave > 0: self.timer_autosave = QtCore.QTimer(self) self.timer_autosave.timeout.connect(self._autosave) self.timer_autosave.start(tacmaopt.opt.autosave * 60000) if tacmaopt.opt.backup_autosave > 0: self.timer_bautosave = QtCore.QTimer(self) self.timer_bautosave.timeout.connect(self._bautosave) self.timer_bautosave.start(tacmaopt.opt.backup_autosave * 60000) import atexit atexit.register(self._autosave) atexit.register(tacmaopt.opt.write)