def __init__(self, parent=None): super(NetworkStatus, self).__init__(parent) widgets.load('networkstatus.ui', self) header = self.tableWidgetConnectionCount.horizontalHeader() header.setResizeMode(QtGui.QHeaderView.ResizeToContents) # Somehow this value was 5 when I tested if header.sortIndicatorSection() > 4: header.setSortIndicator(0, QtCore.Qt.AscendingOrder) self.startup = time.localtime() self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg( l10n.formatTimestamp(self.startup))) self.UISignalThread = UISignaler.get() QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfPubkeysProcessed()"), self.updateNumberOfPubkeysProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfBroadcastsProcessed()"), self.updateNumberOfBroadcastsProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNetworkStatusTab(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.updateNetworkStatusTab) self.timer = QtCore.QTimer() QtCore.QObject.connect( self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
def __init__(self, parent=None): super(NetworkStatus, self).__init__(parent) widgets.load('networkstatus.ui', self) self.tableWidgetConnectionCount.horizontalHeader().setResizeMode( QtGui.QHeaderView.ResizeToContents) self.startup = time.localtime() self.labelStartupTime.setText( _translate("networkstatus", "Since startup on %1").arg( l10n.formatTimestamp(self.startup))) self.UISignalThread = UISignaler.get() QtCore.QObject.connect( self.UISignalThread, QtCore.SIGNAL("updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed) QtCore.QObject.connect( self.UISignalThread, QtCore.SIGNAL("updateNumberOfPubkeysProcessed()"), self.updateNumberOfPubkeysProcessed) QtCore.QObject.connect( self.UISignalThread, QtCore.SIGNAL("updateNumberOfBroadcastsProcessed()"), self.updateNumberOfBroadcastsProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("updateNetworkStatusTab()"), self.updateNetworkStatusTab) self.timer = QtCore.QTimer() self.timer.start(2000) # milliseconds QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
def __init__(self, parent=None, firstrun=False): super(SettingsDialog, self).__init__(parent) widgets.load('settings.ui', self) self.parent = parent self.firstrun = firstrun self.config = BMConfigParser() self.net_restart_needed = False self.timer = QtCore.QTimer() try: import pkg_resources except ImportError: pass else: # Append proxy types defined in plugins for ep in pkg_resources.iter_entry_points( 'bitmessage.proxyconfig'): self.comboBoxProxyType.addItem(ep.name) self.lineEditMaxOutboundConnections.setValidator( QtGui.QIntValidator(0, 8, self.lineEditMaxOutboundConnections)) self.adjust_from_config(self.config) if firstrun: # switch to "Network Settings" tab if user selected # "Let me configure special network settings first" on first run self.tabWidgetSettings.setCurrentIndex( self.tabWidgetSettings.indexOf(self.tabNetworkSettings)) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
def __init__(self, parent=None, config=None): super(SpecialAddressBehaviorDialog, self).__init__(parent) widgets.load('specialaddressbehavior.ui', self) self.address = parent.getCurrentAccount() self.parent = parent self.config = config try: self.address_is_chan = config.safeGetBoolean(self.address, 'chan') except AttributeError: pass else: if self.address_is_chan: # address is a chan address self.radioButtonBehaviorMailingList.setDisabled(True) self.lineEditMailingListName.setText( _translate( "SpecialAddressBehaviorDialog", "This is a chan address. You cannot use it as a" " pseudo-mailing list.")) else: if config.safeGetBoolean(self.address, 'mailinglist'): self.radioButtonBehaviorMailingList.click() else: self.radioButtonBehaveNormalAddress.click() try: mailingListName = config.get(self.address, 'mailinglistname') except: mailingListName = '' self.lineEditMailingListName.setText( unicode(mailingListName, 'utf-8')) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) self.show()
def __init__(self, parent=None): super(Blacklist, self).__init__(parent) widgets.load('blacklist.ui', self) QtCore.QObject.connect(self.radioButtonBlacklist, QtCore.SIGNAL("clicked()"), self.click_radioButtonBlacklist) QtCore.QObject.connect(self.radioButtonWhitelist, QtCore.SIGNAL("clicked()"), self.click_radioButtonWhitelist) QtCore.QObject.connect(self.pushButtonAddBlacklist, QtCore.SIGNAL("clicked()"), self.click_pushButtonAddBlacklist) self.init_blacklist_popup_menu() # Initialize blacklist QtCore.QObject.connect( self.tableWidgetBlacklist, QtCore.SIGNAL("itemChanged(QTableWidgetItem *)"), self.tableWidgetBlacklistItemChanged) # Set the icon sizes for the identicons identicon_size = 3 * 7 self.tableWidgetBlacklist.setIconSize( QtCore.QSize(identicon_size, identicon_size)) self.UISignalThread = UISignaler.get() QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("rerenderBlackWhiteList()"), self.rerenderBlackWhiteList)
def __init__(self, parent=None): super(NetworkStatus, self).__init__(parent) widgets.load('networkstatus.ui', self) header = self.tableWidgetConnectionCount.horizontalHeader() header.setResizeMode(QtGui.QHeaderView.ResizeToContents) # Somehow this value was 5 when I tested if header.sortIndicatorSection() > 4: header.setSortIndicator(0, QtCore.Qt.AscendingOrder) self.startup = time.localtime() self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg( l10n.formatTimestamp(self.startup))) self.UISignalThread = UISignaler.get() # pylint: disable=no-member QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfPubkeysProcessed()"), self.updateNumberOfPubkeysProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfBroadcastsProcessed()"), self.updateNumberOfBroadcastsProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNetworkStatusTab(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.updateNetworkStatusTab) self.timer = QtCore.QTimer() QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
def retranslateUi(self): defaults = QtGui.QWidget() widgets.load(self.__class__.__name__.lower() + '.ui', defaults) for attr, value in defaults.__dict__.iteritems(): setTextMethod = getattr(value, "setText", None) if callable(setTextMethod): getattr(self, attr).setText(getattr(defaults, attr).text()) elif isinstance(value, QtGui.QTableWidget): for i in range (value.columnCount()): getattr(self, attr).horizontalHeaderItem(i).setText(getattr(defaults, attr).horizontalHeaderItem(i).text()) for i in range (value.rowCount()): getattr(self, attr).verticalHeaderItem(i).setText(getattr(defaults, attr).verticalHeaderItem(i).text())
def __init__(self, parent=None, config=None): super(IconGlossaryDialog, self).__init__(parent) widgets.load('iconglossary.ui', self) # .. todo:: FIXME: check the window title visibility here self.groupBox.setTitle('') self.labelPortNumber.setText(_translate( "iconGlossaryDialog", "You are using TCP port %1. (This can be changed in the settings)." ).arg(config.getint('bitmessagesettings', 'port'))) self.setFixedSize(QtGui.QWidget.sizeHint(self))
def __init__(self, parent=None): super(NewAddressDialog, self).__init__(parent) widgets.load('newaddressdialog.ui', self) # Let's fill out the 'existing address' combo box with addresses # from the 'Your Identities' tab. for address in getSortedAccounts(): self.radioButtonExisting.click() self.comboBoxExisting.addItem(address) self.groupBoxDeterministic.setHidden(True) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) self.show()
def __init__(self, parent=None, config=None): super(IconGlossaryDialog, self).__init__(parent) widgets.load('iconglossary.ui', self) # FIXME: check the window title visibility here self.groupBox.setTitle('') self.labelPortNumber.setText(_translate( "iconGlossaryDialog", "You are using TCP port %1. (This can be changed in the settings)." ).arg(config.getint('bitmessagesettings', 'port'))) self.setFixedSize(QtGui.QWidget.sizeHint(self))
def __init__(self, parent=None): super(NewChanDialog, self).__init__(parent) widgets.load('newchandialog.ui', self) self.parent = parent self.chanAddress.setValidator(AddressValidator(self.chanAddress, self.chanPassPhrase, self.validatorFeedback, self.buttonBox, False)) self.chanPassPhrase.setValidator(PassPhraseValidator(self.chanPassPhrase, self.chanAddress, self.validatorFeedback, self.buttonBox, False)) self.timer = QtCore.QTimer() QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.delayedUpdateStatus) self.timer.start(500) # milliseconds self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.show()
def __init__(self, parent=None): super(NewChanDialog, self).__init__(parent) widgets.load('newchandialog.ui', self) self.parent = parent self.chanAddress.setValidator(AddressValidator(self.chanAddress, self.chanPassPhrase, self.validatorFeedback, self.buttonBox, False)) self.chanPassPhrase.setValidator(PassPhraseValidator(self.chanPassPhrase, self.chanAddress, self.validatorFeedback, self.buttonBox, False)) QtCore.QObject.connect(self.chanAddress, QtCore.SIGNAL('textEdited()'), self.chanAddress.validator(), QtCore.SLOT('checkData(self)')) QtCore.QObject.connect(self.chanPassPhrase, QtCore.SIGNAL('textEdited()'), self.chanPassPhrase.validator(), QtCore.SLOT('checkData(self)')) self.timer = QtCore.QTimer() QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.delayedUpdateStatus) self.timer.start(500) # milliseconds self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.show()
def __init__(self, parent=None): super(AboutDialog, self).__init__(parent) widgets.load('about.ui', self) last_commit = paths.lastCommit() version = softwareVersion commit = last_commit.get('commit') if commit: version += '-' + commit[:7] self.labelVersion.setText(self.labelVersion.text().replace( ':version:', version).replace(':branch:', commit or 'v%s' % version)) self.labelVersion.setOpenExternalLinks(True) try: self.label_2.setText(self.label_2.text().replace( '2017', str(last_commit.get('time').year))) except AttributeError: pass self.setFixedSize(QtGui.QWidget.sizeHint(self))
def __init__(self, parent, config=None, account=None): super(EmailGatewayDialog, self).__init__(parent) widgets.load('emailgateway.ui', self) self.parent = parent self.config = config if account: self.acct = account self.setWindowTitle( _translate("EmailGatewayDialog", "Registration failed:")) self.label.setText( _translate( "EmailGatewayDialog", "The requested email address is not available," " please try a new one.")) self.radioButtonRegister.hide() self.radioButtonStatus.hide() self.radioButtonSettings.hide() self.radioButtonUnregister.hide() else: address = parent.getCurrentAccount() self.acct = accountClass(address) try: label = config.get(address, 'label') except AttributeError: pass else: if "@" in label: self.lineEditEmail.setText(label) if isinstance(self.acct, GatewayAccount): self.radioButtonUnregister.setEnabled(True) self.radioButtonStatus.setEnabled(True) self.radioButtonStatus.setChecked(True) self.radioButtonSettings.setEnabled(True) self.lineEditEmail.setEnabled(False) else: self.acct = MailchuckAccount(address) self.lineEditEmail.setFocus() QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
def __init__(self, parent, config=None, account=None): super(EmailGatewayDialog, self).__init__(parent) widgets.load('emailgateway.ui', self) self.parent = parent self.config = config if account: self.acct = account self.setWindowTitle(_translate( "EmailGatewayDialog", "Registration failed:")) self.label.setText(_translate( "EmailGatewayDialog", "The requested email address is not available," " please try a new one." )) self.radioButtonRegister.hide() self.radioButtonStatus.hide() self.radioButtonSettings.hide() self.radioButtonUnregister.hide() else: address = parent.getCurrentAccount() self.acct = accountClass(address) try: label = config.get(address, 'label') except AttributeError: pass else: if "@" in label: self.lineEditEmail.setText(label) if isinstance(self.acct, GatewayAccount): self.radioButtonUnregister.setEnabled(True) self.radioButtonStatus.setEnabled(True) self.radioButtonStatus.setChecked(True) self.radioButtonSettings.setEnabled(True) self.lineEditEmail.setEnabled(False) else: self.acct = MailchuckAccount(address) self.lineEditEmail.setFocus() QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
def __init__(self, parent=None): super(NetworkStatus, self).__init__(parent) widgets.load('networkstatus.ui', self) self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg( l10n.formatTimestamp())) self.UISignalThread = UISignaler.get() QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfPubkeysProcessed()"), self.updateNumberOfPubkeysProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfBroadcastsProcessed()"), self.updateNumberOfBroadcastsProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNetworkStatusTab()"), self.updateNetworkStatusTab) self.totalNumberOfBytesReceived = 0 self.totalNumberOfBytesSent = 0 self.timer = QtCore.QTimer() self.timer.start(2000) # milliseconds QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
def __init__(self, parent=None, config=None): super(SpecialAddressBehaviorDialog, self).__init__(parent) widgets.load('specialaddressbehavior.ui', self) self.address = parent.getCurrentAccount() self.parent = parent self.config = config try: self.address_is_chan = config.safeGetBoolean( self.address, 'chan' ) except AttributeError: pass else: if self.address_is_chan: # address is a chan address self.radioButtonBehaviorMailingList.setDisabled(True) self.lineEditMailingListName.setText(_translate( "SpecialAddressBehaviorDialog", "This is a chan address. You cannot use it as a" " pseudo-mailing list." )) else: if config.safeGetBoolean(self.address, 'mailinglist'): self.radioButtonBehaviorMailingList.click() else: self.radioButtonBehaveNormalAddress.click() try: mailingListName = config.get( self.address, 'mailinglistname') except: mailingListName = '' self.lineEditMailingListName.setText( unicode(mailingListName, 'utf-8') ) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) self.show()
def __init__(self, parent=None): super(AboutDialog, self).__init__(parent) widgets.load('about.ui', self) last_commit = paths.lastCommit() version = softwareVersion commit = last_commit.get('commit') if commit: version += '-' + commit[:7] self.labelVersion.setText( self.labelVersion.text().replace( ':version:', version ).replace(':branch:', commit or 'v%s' % version) ) self.labelVersion.setOpenExternalLinks(True) try: self.label_2.setText( self.label_2.text().replace( '2017', str(last_commit.get('time').year) )) except AttributeError: pass self.setFixedSize(QtGui.QWidget.sizeHint(self))
def __init__(self, parent=None): super(NetworkStatus, self).__init__(parent) widgets.load('networkstatus.ui', self) self.startup = time.localtime() self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg( l10n.formatTimestamp(self.startup))) self.UISignalThread = UISignaler.get() QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfPubkeysProcessed()"), self.updateNumberOfPubkeysProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNumberOfBroadcastsProcessed()"), self.updateNumberOfBroadcastsProcessed) QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "updateNetworkStatusTab()"), self.updateNetworkStatusTab) self.totalNumberOfBytesReceived = 0 self.totalNumberOfBytesSent = 0 self.timer = QtCore.QTimer() self.timer.start(2000) # milliseconds QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
def __init__(self, parent=None): super(Blacklist, self).__init__(parent) widgets.load('blacklist.ui', self) QtCore.QObject.connect(self.radioButtonBlacklist, QtCore.SIGNAL( "clicked()"), self.click_radioButtonBlacklist) QtCore.QObject.connect(self.radioButtonWhitelist, QtCore.SIGNAL( "clicked()"), self.click_radioButtonWhitelist) QtCore.QObject.connect(self.pushButtonAddBlacklist, QtCore.SIGNAL( "clicked()"), self.click_pushButtonAddBlacklist) self.init_blacklist_popup_menu() # Initialize blacklist QtCore.QObject.connect(self.tableWidgetBlacklist, QtCore.SIGNAL( "itemChanged(QTableWidgetItem *)"), self.tableWidgetBlacklistItemChanged) # Set the icon sizes for the identicons identicon_size = 3*7 self.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size)) self.UISignalThread = UISignaler.get() QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( "rerenderBlackWhiteList()"), self.rerenderBlackWhiteList)
def __init__(self, parent=None): super(ConnectDialog, self).__init__(parent) widgets.load('connect.ui', self) self.setFixedSize(QtGui.QWidget.sizeHint(self))
def register_blueprints(app): for module_name in ('routes.dashboard', 'routes.login', 'routes.debug'): module = import_module('{}.routes'.format(module_name)) app.register_blueprint(module.blueprint) def has_no_empty_params(rule): defaults = rule.defaults if rule.defaults is not None else () arguments = rule.arguments if rule.arguments is not None else () return len(defaults) >= len(arguments) @app.route("/site-map") def site_map(): links = [] for rule in app.url_map.iter_rules(): # Filter out rules we can't navigate to in a browser # and rules that require parameters if "GET" in rule.methods and has_no_empty_params(rule): url = url_for(rule.endpoint, **(rule.defaults or {})) links.append(url) return '<br>'.join(links) widgets.load(app) register_blueprints(app) if __name__ == '__main__': app.run(debug=True)
def __init__(self, parent=None, address=None): super(AddAddressDialog, self).__init__(parent) widgets.load('addaddressdialog.ui', self) AddressCheckMixin.__init__(self) if address: self.lineEditAddress.setText(address)
def __init__(self, parent=None): super(RegenerateAddressesDialog, self).__init__(parent) widgets.load('regenerateaddresses.ui', self) self.groupBox.setTitle('') QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
def __init__(self, parent=None): super(NewSubscriptionDialog, self).__init__(parent) widgets.load('newsubscriptiondialog.ui', self) AddressCheckMixin.__init__(self)
def __init__(self, parent=None): super(DemoWidget, self).__init__(parent) widgets.load('demo.ui', self)