def closeEvent(self, event): '''Clean up before closing by stopping all services''' print("Closing Murmeli") # Tell postmen to stop working for p in self.postmen: p.stop() DbI.releaseDb() TorClient.stopTor() self.clearWebCache() event.accept()
def __init__(self, *args): self.logPanel = LogWindow() GuiWindow.__init__(self, lowerItem=self.logPanel) self.clearWebCache() self.postmen = None self.toolbar = self.makeToolbar([ ("images/toolbar-home.png", self.onHomeClicked, "mainwindow.toolbar.home"), ("images/toolbar-people.png", self.onContactsClicked, "mainwindow.toolbar.contacts"), ("images/toolbar-messages.png", self.onMessagesClicked, "mainwindow.toolbar.messages"), ("images/toolbar-messages-highlight.png", self.onMessagesClicked, "mainwindow.toolbar.messages"), ("images/toolbar-calendar.png", self.onCalendarClicked, "mainwindow.toolbar.calendar"), ("images/toolbar-settings.png", self.onSettingsClicked, "mainwindow.toolbar.settings") ]) self.addToolBar(self.toolbar) self.setContextMenuPolicy(QtCore.Qt.NoContextMenu) # status bar self.statusbar = QtWidgets.QStatusBar(self) self.statusbar.setObjectName("statusbar") self.setStatusBar(self.statusbar) self.setWindowTitle(I18nManager.getText("mainwindow.title")) self.setStatusTip("Murmeli") self.setPageServer(PageServer()) self.navigateTo("/") # we want to be notified of Config changes Config.registerSubscriber(self) self.postmen = [ postmen.IncomingPostman(self), postmen.OutgoingPostman(self) ] self.postmen[1].messageSentSignal.connect(self.logPanel.notifyLogEvent) MessageShuffler.getTannoy().updateSignal.connect( self.logPanel.notifyLogEvent) # Make sure Tor client is started if not TorClient.isStarted(): TorClient.startTor() # Create database instance if not already set if not DbI.hasDbSet(): DbI.setDb(MurmeliDb(Config.getSsDatabaseFile())) # Make sure the status of the contacts matches our keyring missingKeyNames = ContactMaker.checkAllContactsKeys() if missingKeyNames: warningTexts = [I18nManager.getText("warning.keysnotfoundfor") ] + missingKeyNames QtWidgets.QMessageBox.warning(self, "Murmeli", "\n ".join(warningTexts))
def run(self): # Check each of the services in turn self.successFlags = {} # Mongo authSetup = AuthSetterUpper() self.successFlags['mongo'] = authSetup.setup() self.emit(QtCore.SIGNAL('updated()')) time.sleep(1) # Gnupg self.successFlags['gpg'] = CryptoClient.checkGpg() self.emit(QtCore.SIGNAL('updated()')) time.sleep(1) # Tor if TorClient.startTor(): torid = TorClient.getOwnId() if torid: print("Started tor, our own id is: ", torid) self.successFlags['tor'] = True else: print("Failed to start tor") else: print("startTor returned false :(")
def finish(self): '''Finished the key gen''' # Store key, name in mongo under own profile selectedKey = self.privateKeys[self.keypairListWidget.currentRow()] ownid = TorClient.getOwnId() # See if a name was entered before, if so use that myname = self.keygenParamBoxes['name'].text() if not myname: # Extract the name from the string which comes back from the key as "'Some Name (no comment) <*****@*****.**>'" myname = self.extractName(selectedKey['uids']) profile = {"name" : myname, "keyid" : selectedKey['keyid'], "torid" : ownid, "status" : "self", "ownprofile" : True} DbClient.updateContact(ownid, profile) return True
def run(self): # Check each of the services in turn self.successFlags = {} # Database time.sleep(0.5) DbI.setDb(MurmeliDb(Config.getSsDatabaseFile())) self.successFlags['database'] = True self.updatedSignal.emit() time.sleep(0.5) # Gnupg self.successFlags['gpg'] = CryptoClient.checkGpg() self.updatedSignal.emit() time.sleep(1) # Tor if TorClient.startTor(): torid = TorClient.getOwnId() if torid: print("Started tor, our own id is: ", torid) self.successFlags['tor'] = True else: print("Failed to start tor") else: print("startTor returned false :(")
def finish(self): '''Finished the key gen''' # Store key, name in the database for our own profile selectedKey = self.privateKeys[self.keypairListWidget.currentRow()] ownid = TorClient.getOwnId() # See if a name was entered before, if so use that myname = self.keygenParamBoxes['name'].text() if not myname: # Extract the name from the string which comes back from the key as "'Some Name (no comment) <*****@*****.**>'" myname = self.extractName(selectedKey['uids']) profile = { "name": myname, "keyid": selectedKey['keyid'], "torid": ownid, "status": "self", "ownprofile": True } # Store this in the database DbI.updateProfile(ownid, profile) return True
def prepare(self): '''Prepare the final panel''' text = (I18nManager.getText("startupwizard.finished.yourid") % TorClient.getOwnId()) self.youridLabel.setText(text)
def cancel(self): '''Coming back from services start - need to stop them''' DbClient.stopDatabase() TorClient.stopTor()
def closeMurmeli(signal, frame): '''Cleanup method called when Murmeli is killed, eg by Ctrl-C''' print("CloseMurmeli has been called") DbI.releaseDb() TorClient.stopTor() sys.exit(0)
def cancel(self): '''Coming back from services start - need to stop them''' # If we're cancelling, we don't want to save anything - need method? DbI.releaseDb() TorClient.stopTor()