示例#1
0
    def __init__(self, parent):
        QVBoxLayout.__init__(self, parent)

        self.scroll_area = QScrollArea()

        self.grid_frame = QFrame(self.scroll_area)

        self.grid_layout = QGridLayout(self.grid_frame)

        self.scroll_area.setWidget(self.grid_frame)
        self.scroll_area.setWidgetResizable(True)
        self.scroll_area.setBackgroundRole(QPalette.Light)

        self.addWidget(self.scroll_area)

        self.current_column = 0

        self.current_row = 0

        self.initial_grid = True

        self.max_columns = 5

        self.current_width = 0

        self.child_widgets = list()
示例#2
0
    def __init__(self, seed=None, title=None, icon=True, msg=None, options=None,
                 is_seed=None, passphrase=None, parent=None, for_seed_words=True):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.options = options
        if title:
            self.addWidget(WWLabel(title))
        if seed:  # "read only", we already have the text
            if for_seed_words:
                self.seed_e = ButtonsTextEdit()
            else:  # e.g. xpub
                self.seed_e = ShowQRTextEdit()
            self.seed_e.setReadOnly(True)
            self.seed_e.setText(seed)
        else:  # we expect user to enter text
            assert for_seed_words
            self.seed_e = CompletionTextEdit()
            self.seed_e.setTabChangesFocus(False)  # so that tab auto-completes
            self.is_seed = is_seed
            self.saved_is_seed = self.is_seed
            self.seed_e.textChanged.connect(self.on_edit)
            self.initialize_completer()

        self.seed_e.setMaximumHeight(75)
        hbox = QHBoxLayout()
        if icon:
            logo = QLabel()
            logo.setPixmap(QPixmap(icon_path("seed.png"))
                           .scaledToWidth(64, mode=Qt.SmoothTransformation))
            logo.setMaximumWidth(60)
            hbox.addWidget(logo)
        hbox.addWidget(self.seed_e)
        self.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        self.seed_type_label = QLabel('')
        hbox.addWidget(self.seed_type_label)

        # options
        self.is_bip39 = False
        self.is_ext = False
        if options:
            opt_button = EnterButton(_('Options'), self.seed_options)
            hbox.addWidget(opt_button)
            self.addLayout(hbox)
        if passphrase:
            hbox = QHBoxLayout()
            passphrase_e = QLineEdit()
            passphrase_e.setText(passphrase)
            passphrase_e.setReadOnly(True)
            hbox.addWidget(QLabel(_("Your seed extension is") + ':'))
            hbox.addWidget(passphrase_e)
            self.addLayout(hbox)
        self.addStretch(1)
        self.seed_warning = WWLabel('')
        if msg:
            self.seed_warning.setText(seed_warning_msg(seed))
        self.addWidget(self.seed_warning)
示例#3
0
 def __init__(self, parent=None, header_layout=None, is_valid=None, allow_multi=False):
     QVBoxLayout.__init__(self)
     self.parent = parent
     self.is_valid = is_valid
     self.text_e = ScanQRTextEdit(allow_multi=allow_multi)
     self.text_e.textChanged.connect(self.on_edit)
     if isinstance(header_layout, str):
         self.addWidget(WWLabel(header_layout))
     else:
         self.addLayout(header_layout)
     self.addWidget(self.text_e)
    def __init__(self, parent=None) -> None:
        QVBoxLayout.__init__(self, parent)
        self.gamma = ErrorAngleSpinBox(label="Угол скручивания антенны ")
        self.eps = ErrorAngleSpinBox(label="Угол наклона антенны ")
        self.beta = ErrorAngleSpinBox(label="Азимут оси антенны ")

        self.addWidget(self.gamma)
        self.addWidget(self.eps)
        self.addWidget(self.beta)

        # Пока отключим (не используем)
        self.gamma.setEnabled(False)
        self.eps.setEnabled(False)
示例#5
0
 def __init__(self,
              parent=None,
              header_layout=None,
              is_valid=None,
              allow_multi=False):
     QVBoxLayout.__init__(self)
     self.parent = parent
     self.is_valid = is_valid
     self.text_e = ScanQRTextEdit(allow_multi=allow_multi)
     self.text_e.textChanged.connect(self.on_edit)
     if isinstance(header_layout, str):
         self.addWidget(WWLabel(header_layout))
     else:
         self.addLayout(header_layout)
     self.addWidget(self.text_e)
示例#6
0
    def __init__(self, parent):
        QVBoxLayout.__init__(self, parent)

        self.scroll_area = QScrollArea()

        # A ListView is a widget, instead of a layout, so there should be no need for additional containers
        self.list_view = QListView()

        self.scroll_area.setWidget(self.list_view)

        self.addWidget(self.list_view)

        self.view_model = QStringListModel()

        self.list_view.setModel(self.view_model)
示例#7
0
 def __init__(self, seed=None, title=None, icon=True, msg=None, options=None,
              is_seed=None, passphrase=None, parent=None):
     QVBoxLayout.__init__(self)
     self.parent = parent
     self.options = options
     if title:
         self.addWidget(WWLabel(title))
     self.seed_e = ButtonsTextEdit()
     if seed:
         self.seed_e.setText(seed)
     else:
         self.seed_e.setTabChangesFocus(True)
         self.is_seed = is_seed
         self.saved_is_seed = self.is_seed
         self.seed_e.textChanged.connect(self.on_edit)
     self.seed_e.setMaximumHeight(75)
     hbox = QHBoxLayout()
     if icon:
         logo = QLabel()
         logo.setPixmap(QPixmap(":icons/seed.png").scaledToWidth(64))
         logo.setMaximumWidth(60)
         hbox.addWidget(logo)
     hbox.addWidget(self.seed_e)
     self.addLayout(hbox)
     hbox = QHBoxLayout()
     hbox.addStretch(1)
     self.seed_type_label = QLabel('')
     hbox.addWidget(self.seed_type_label)
     if options:
         opt_button = EnterButton(_('Options'), self.seed_options)
         hbox.addWidget(opt_button)
         self.addLayout(hbox)
     if passphrase:
         hbox = QHBoxLayout()
         passphrase_e = QLineEdit()
         passphrase_e.setText(passphrase)
         passphrase_e.setReadOnly(True)
         hbox.addWidget(QLabel(_("Your seed extension is") + ':'))
         hbox.addWidget(passphrase_e)
         self.addLayout(hbox)
     self.addStretch(1)
     self.seed_warning = WWLabel('')
     if msg:
         self.seed_warning.setText(seed_warning_msg(seed))
     self.addWidget(self.seed_warning)
示例#8
0
    def __init__(self, parent=None) -> None:
        QVBoxLayout.__init__(self, parent)

        self.beta_north = ErrorAngleSpinBox(
            label="Азимут строительной оси относительно направления на 'Север' "
        )
        self.eps_long = ErrorAngleSpinBox(
            label="Угол невертикальности в продольной плоскости ")
        self.eps_cross = ErrorAngleSpinBox(
            label="Угол невертикальности в поперечной плоскости ")

        self.addWidget(self.beta_north)
        self.addWidget(self.eps_long)
        self.addWidget(self.eps_cross)

        # Пока отключим (не используем)
        self.eps_long.setEnabled(False)
        self.eps_cross.setEnabled(False)
示例#9
0
    def __init__(self):
        QVBoxLayout.__init__(self)

        self.upLay = QVBoxLayout(
        )  # Avoiding AttributeError while page swithcing

        self.font = QFont('Bahnschrift SemiLight SemiConde', 50)

        self.href = '''<a href='https://sourceforge.net/projects/random-proj/'>sourceforge</a>'''

        self.label = QLabel('Leave your review on')
        self.link = QLabel(self.href)

        self.label.setFont(self.font)
        self.link.setFont(self.font)

        self.label.setStyleSheet('color: white')
        self.label.setAlignment(Qt.AlignCenter)
        self.link.setAlignment(Qt.AlignCenter)

        self.addWidget(self.label)
        self.addWidget(self.link)
示例#10
0
    def __init__(self, dashboard):
        QVBoxLayout.__init__(self)
        self.dashboard = dashboard
        self.tab_widget = QTabWidget()
        self.addWidget(self.tab_widget)
        self.current_hub = None
        self.dashboard.tree_widget.itemSelectionChanged.connect(
            self.update_hub)
        ''' Create Run tab '''
        measure_tab = QWidget()
        self.measure_panel = MeasureLayout(self)
        measure_tab.setLayout(self.measure_panel)
        measure_tab.setStyleSheet('background-color: rgba(255, 255, 255, 50%)')
        self.tab_widget.addTab(measure_tab, 'Measure')
        ''' Create Model tab '''
        model_tab = QWidget()
        self.model_panel = ModelLayout(self)
        model_tab.setLayout(self.model_panel)
        model_tab.setStyleSheet('background-color: rgba(255, 255, 255, 50%)')
        self.tab_widget.addTab(model_tab, 'Model')
        ''' Create Servo tab '''
        servo_tab = QWidget()
        self.servo_panel = ServoLayout(self)
        servo_tab.setLayout(self.servo_panel)
        servo_tab.setStyleSheet('background-color: rgba(255, 255, 255, 50%)')
        self.tab_widget.addTab(servo_tab, 'Servo')
        ''' Create Pipeline tab '''
        pipeline_tab = QWidget()
        self.pipeline_panel = PipelineLayout(self)
        pipeline_tab.setLayout(self.pipeline_panel)
        pipeline_tab.setStyleSheet(
            'background-color: rgba(255, 255, 255, 50%)')
        self.tab_widget.addTab(pipeline_tab, 'Pipeline')

        self.update_panel()

        self.tab_widget.currentChanged.connect(self.update_panel)
    def __init__(
            self,
            seed=None,
            title=None,
            icon=True,
            msg=None,
            options=None,
            is_seed=None,
            passphrase=None,
            parent=None,
            for_seed_words=True,
            *,
            config: 'SimpleConfig',
    ):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.options = options
        self.config = config
        self.seed_type = 'bip39'
        if title:
            self.addWidget(WWLabel(title))
        if seed:  # "read only", we already have the text
            if for_seed_words:
                self.seed_e = ButtonsTextEdit()
            else:  # e.g. xpub
                self.seed_e = ShowQRTextEdit(config=self.config)
            self.seed_e.setReadOnly(True)
            self.seed_e.setText(seed)
        else:  # we expect user to enter text
            assert for_seed_words
            self.seed_e = CompletionTextEdit()
            self.seed_e.setTabChangesFocus(False)  # so that tab auto-completes
            self.is_seed = is_seed
            self.saved_is_seed = self.is_seed
            self.seed_e.textChanged.connect(self.on_edit)
            self.initialize_completer()

        self.seed_e.setMaximumHeight(75)
        hbox = QHBoxLayout()
        if icon:
            logo = QLabel()
            logo.setPixmap(QPixmap(icon_path("seed.png"))
                           .scaledToWidth(64, mode=Qt.SmoothTransformation))
            logo.setMaximumWidth(60)
            hbox.addWidget(logo)
        hbox.addWidget(self.seed_e)
        self.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.addStretch(1)

        self.seed_type_label = QLabel('')
        hbox.addWidget(self.seed_type_label)

        seed_types = [
            (value, title) for value, title in (
                ('bip39', _('BIP39 seed')),
                ('electrum', _('Electrum')),
                # ('slip39', _('SLIP39 seed')),
            )
            #if value in self.options or value == 'electrum'
        ]
        seed_type_values = [t[0] for t in seed_types]

        if len(seed_types) >= 2:
            def f(choices_layout):
                self.seed_type = seed_type_values[choices_layout.selected_index()]
                self.is_seed = (lambda x: bool(x)) if self.seed_type != 'bip39' else self.saved_is_seed
                self.slip39_current_mnemonic_invalid = None
                self.seed_status.setText('')
                #self.on_edit()
                self.update_share_buttons()
                self.initialize_completer()
                self.seed_warning.setText(msg)

            checked_index = seed_type_values.index(self.seed_type)
            titles = [t[1] for t in seed_types]
            clayout = ChoicesLayout(_('Seed type'), titles, on_clicked=f, checked_index=checked_index)
            hbox.addLayout(clayout.layout())

        # options
        self.is_ext = False
        if options:
            opt_button = EnterButton(_('Options'), self.seed_options)
            hbox.addWidget(opt_button)
            self.addLayout(hbox)
        if passphrase:
            hbox = QHBoxLayout()
            passphrase_e = QLineEdit()
            passphrase_e.setText(passphrase)
            passphrase_e.setReadOnly(True)
            hbox.addWidget(QLabel(_("Your seed extension is") + ':'))
            hbox.addWidget(passphrase_e)
            self.addLayout(hbox)

        # slip39 shares
        self.slip39_mnemonic_index = 0
        self.slip39_mnemonics = [""]
        self.slip39_seed = None
        self.slip39_current_mnemonic_invalid = None
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        self.prev_share_btn = QPushButton(_("Previous share"))
        self.prev_share_btn.clicked.connect(self.on_prev_share)
        hbox.addWidget(self.prev_share_btn)
        self.next_share_btn = QPushButton(_("Next share"))
        self.next_share_btn.clicked.connect(self.on_next_share)
        hbox.addWidget(self.next_share_btn)
        self.update_share_buttons()
        self.addLayout(hbox)

        self.addStretch(1)
        self.seed_status = WWLabel('')
        self.addWidget(self.seed_status)
        self.seed_warning = WWLabel('')
        if msg:
            self.seed_warning.setText(seed_warning_msg(seed))
        self.addWidget(self.seed_warning)

        self.lang = 'en'
    def __init__(
            self,
            seed=None,
            title=None,
            icon=True,
            msg=None,
            options=None,
            passphrase=None,
            parent=None,
            electrum_seed_type=None,
            only_display=False,
            *,
            config: 'SimpleConfig'):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.config = config
        self.options = options
        self.electrum_seed_type = electrum_seed_type
        self.seed_type = 'bip39'
        if title:
            self.addWidget(WWLabel(title))

        self.seed_e = ButtonsTextEdit()
        self.seed_e.setReadOnly(True)
        self.seed_e.setText(seed)
        self.seed_e.setMaximumHeight(75)

        self.cached_seed_phrases = {'bip39_en': seed}

        hbox = QHBoxLayout()
        if icon:
            logo = QLabel()
            logo.setPixmap(QPixmap(icon_path("seed.png"))
                           .scaledToWidth(64, mode=Qt.SmoothTransformation))
            logo.setMaximumWidth(60)
            hbox.addWidget(logo)
        hbox.addWidget(self.seed_e)
        self.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.addStretch(1)

        self.seed_type_label = QLabel('')
        hbox.addWidget(self.seed_type_label)

        self.is_ext = False
        self.opt_button = None
        if options:
            self.opt_button = EnterButton(_('Options'), self.seed_options)
            self.opt_button.setVisible(False)

        seed_types = [
            (value, title) for value, title in (
                ('bip39', _('BIP39 seed')),
                ('electrum', _('Electrum')),
            )
        ]
        seed_type_values = [t[0] for t in seed_types]

        from electrum import mnemonic

        self.languages = list(mnemonic.filenames.items())
        self.lang_cb = QComboBox()
        self.lang_cb.addItems([' '.join([s.capitalize() for s in x[1][:-4].split('_')]) for x in self.languages])
        self.lang_cb.setCurrentIndex(0)

        def on_change():
            i = self.lang_cb.currentIndex()
            l = self.languages[i][0]
            k = 'bip39_' + l
            if k not in self.cached_seed_phrases:
                seed = mnemonic.Mnemonic(l).make_bip39_seed()
                self.cached_seed_phrases[k] = seed
            else:
                seed = self.cached_seed_phrases[k]
            self.seed_warning.setText(SEED_WARNING_1(seed))
            self.seed_e.setText(seed)
            self.lang = l

        self.lang_cb.currentIndexChanged.connect(on_change)

        def f(choices_layout):
            self.seed_type = seed_type_values[choices_layout.selected_index()]
            self.seed_status.setText('')
            if self.seed_type == 'bip39':
                if self.opt_button:
                    self.opt_button.setVisible(False)
                self.lang_cb.setVisible(True)
                k = 'bip39_'+self.lang
                if k not in self.cached_seed_phrases:
                    seed = mnemonic.Mnemonic(self.lang).make_bip39_seed()
                    self.cached_seed_phrases[k] = seed
                else:
                    seed = self.cached_seed_phrases[k]
                self.seed_warning.setText(SEED_WARNING_1(seed))
                self.seed_e.setText(seed)
                self.seed_type = 'bip39'
            else:
                if self.opt_button:
                    self.opt_button.setVisible(True)
                self.lang_cb.setVisible(False)
                k = 'electrum'
                if k not in self.cached_seed_phrases:
                    seed = mnemonic.Mnemonic('en').make_seed(seed_type=self.electrum_seed_type)
                    self.cached_seed_phrases[k] = seed
                else:
                    seed = self.cached_seed_phrases[k]
                self.seed_warning.setText(SEED_WARNING_1(seed))
                self.seed_e.setText(seed)
                self.seed_type = 'electrum'

        checked_index = seed_type_values.index(self.seed_type)
        titles = [t[1] for t in seed_types]
        self.clayout = ChoicesLayout(_('Seed type'), titles, on_clicked=f, checked_index=checked_index)

        vbox = QVBoxLayout()

        if not only_display:
            vbox.addLayout(self.clayout.layout())
            h_b = QHBoxLayout()
            if options:
                h_b.addWidget(self.opt_button)
            h_b.addWidget(self.lang_cb)
            help = HelpButton(_('The standard electrum seed phrase is not ' +
                                'BIP39 compliant and will not work with other wallets. ' +
                                'It does however, have some advantages over BIP39 as explained ' +
                                'here:') +
                                '\n\nhttps://electrum.readthedocs.io/en/latest/seedphrase.html\n\n' +
                                _('If you wish to use your seed phrase with other wallets, choose BIP39.'))
            h_b.addWidget(help)
            vbox.addLayout(h_b)

        hbox.addLayout(vbox)

        if passphrase:
            hbox = QHBoxLayout()
            passphrase_e = QLineEdit()
            passphrase_e.setText(passphrase)
            passphrase_e.setReadOnly(True)
            hbox.addWidget(QLabel(_("Your seed extension is") + ':'))
            hbox.addWidget(passphrase_e)
            self.addLayout(hbox)

        sub_hbox = QHBoxLayout()
        sub_hbox.setStretch(0, 1)

        self.addStretch(1)
        self.seed_status = WWLabel('')
        self.addWidget(self.seed_status)
        self.seed_warning = WWLabel('')
        if msg:
            self.seed_warning.setText(SEED_WARNING_1(seed))

        sub_hbox.addWidget(self.seed_warning)
        sub_hbox.addLayout(hbox)

        self.addLayout(sub_hbox)
        self.addWidget(WWLabel(SEED_WARNING_2(seed)))

        self.lang = 'en'
    def __init__(self, dialog):
        QVBoxLayout.__init__(self)
        self.dialog = dialog
        self.senders = self.dialog.parent().wallet.get_spendable_addresses()
        self.constructor = {}
        self.abi = []

        self.addWidget(QLabel(_("Contract Name:")))
        self.name_e = ButtonsLineEdit()
        self.addWidget(self.name_e)
        self.addStretch(1)

        self.addWidget(QLabel(_("Bytecode:")))
        self.bytecode_e = ButtonsTextEdit()
        self.bytecode_e.setMinimumHeight(80)
        self.bytecode_e.setMaximumHeight(80)
        self.addWidget(self.bytecode_e)
        self.addStretch(1)

        self.addWidget(QLabel(_("Interface(ABI):")))
        self.interface_e = ButtonsTextEdit()
        self.interface_e.setMaximumHeight(80)
        self.interface_e.textChanged.connect(self.interface_changed)
        self.addWidget(self.interface_e)
        self.addStretch(1)

        params_layout = QHBoxLayout()
        args_lb = QLabel(_('Constructor:'))
        self.args_e = QLineEdit()
        params_layout.addWidget(args_lb)
        params_layout.addWidget(self.args_e)
        self.addLayout(params_layout)

        optional_layout = QHBoxLayout()
        self.addLayout(optional_layout)
        gas_limit_lb = QLabel(_('gas limit:'))
        self.gas_limit_e = ButtonsLineEdit()
        self.gas_limit_e.setValidator(int_validator)
        self.gas_limit_e.setText('2500000')
        gas_price_lb = QLabel(_('gas price:'))
        self.gas_price_e = ButtonsLineEdit()
        self.gas_price_e.setValidator(float_validator)
        self.gas_price_e.setText('0.00000040')
        sender_lb = QLabel(_('sender:'))
        self.sender_combo = QComboBox()
        self.sender_combo.setMinimumWidth(300)
        self.sender_combo.addItems(self.senders)
        optional_layout.addWidget(gas_limit_lb)
        optional_layout.addWidget(self.gas_limit_e)
        optional_layout.addStretch(1)
        optional_layout.addWidget(gas_price_lb)
        optional_layout.addWidget(self.gas_price_e)
        optional_layout.addStretch(1)
        optional_layout.addWidget(sender_lb)
        optional_layout.addWidget(self.sender_combo)

        self.cancel_btn = CancelButton(dialog)
        self.preview_btn = QPushButton(_('Preview'))
        self.preview_btn.setDefault(False)
        self.preview_btn.clicked.connect(self.preview)
        self.create_btn = QPushButton(_('Create'))
        self.create_btn.setDefault(True)
        self.create_btn.clicked.connect(self.create)
        self.addLayout(
            Buttons(*[self.cancel_btn, self.preview_btn, self.create_btn]))
示例#14
0
 def __init__(self, *args, **kwargs):
     QVBoxLayout.__init__(self, *args, **kwargs)
     self.setSpacing(spacing)
示例#15
0
    def __init__(self,
                 seed=None,
                 title=None,
                 icon=True,
                 msg=None,
                 options=None,
                 is_seed=None,
                 passphrase=None,
                 parent=None,
                 for_seed_words=True,
                 imported_wallet=None):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.options = options
        if title:
            self.addWidget(WWLabel(title))
        if seed:  # "read only", we already have the text
            if for_seed_words:
                self.seed_e = ButtonsTextEdit()
            else:  # e.g. xpub
                self.seed_e = ShowQRTextEdit()
            self.seed_e.setReadOnly(True)
            self.seed_e.setText(seed)
        else:  # we expect user to enter text
            assert for_seed_words
            self.seed_e = CompletionTextEdit()
            self.seed_e.setTabChangesFocus(False)  # so that tab auto-completes
            self.is_seed = is_seed
            self.saved_is_seed = self.is_seed
            self.seed_e.textChanged.connect(self.on_edit)
            self.initialize_completer()

        self.seed_e.setContextMenuPolicy(Qt.PreventContextMenu)
        self.seed_e.setMaximumHeight(75)
        hbox = QHBoxLayout()
        hbox.addWidget(self.seed_e)
        if icon:
            logo = QLabel()
            logo.setPixmap(
                QPixmap(icon_path("seed.png")).scaledToWidth(
                    64, mode=Qt.SmoothTransformation))
            logo.setMaximumWidth(60)
            hbox.addWidget(logo)

        self.addLayout(hbox)
        self.seed_warning = WWLabel('')

        # options
        self.is_bip39 = False
        self.is_ext = False
        self.is_gold_wallet_import = False
        self.checkboxes = {}
        import_gw = False
        if imported_wallet in ['standard', '2-key', '3-key']:
            self.is_gold_wallet_import = True
            import_gw = True
        if imported_wallet in ['2-key', '3-key']:
            self.options = options = ['ext']
        if options:
            self.seed_options(import_gw)
        if passphrase:
            hbox = QHBoxLayout()
            passphrase_e = QLineEdit()
            passphrase_e.setText(passphrase)
            passphrase_e.setReadOnly(True)
            hbox.addWidget(QLabel(_("Your seed extension is") + ':'))
            hbox.addWidget(passphrase_e)
            self.addLayout(hbox)
        self.addStretch(1)
        if msg:
            self.seed_warning.setText(seed_warning_msg(seed))
        self.addWidget(self.seed_warning)
示例#16
0
    def __init__(self, parent):
        QVBoxLayout.__init__(self)
        self.parent = parent

        hlayout = QHBoxLayout()
        self.addLayout(hlayout)

        vlayout = QVBoxLayout()
        hlayout.addLayout(vlayout)
        box_layout = QHBoxLayout()
        vlayout.addLayout(box_layout)
        self.experiment_box = QComboBox()

        box_layout.addWidget(self.experiment_box)
        self.experiment_box.currentTextChanged.connect(self.update_params)
        box_layout.addWidget(IconButton('dashboard/gui/media/Material/content-save-outline.svg', self.save_params, tooltip='Save parameters'))
        box_layout.addWidget(IconButton('dashboard/gui/media/Material/content-undo.svg', self.reset_params, tooltip='Reset parameters'))


        ''' Experiment parameters '''
        self.experiment_table = ParameterTable()
        vlayout.addWidget(self.experiment_table)


        treeLayout = QVBoxLayout()
        hlayout.addLayout(treeLayout)

        saveLayout = QHBoxLayout()
        treeLayout.addLayout(saveLayout)
        self.pipeline_selector = QComboBox()
        self.pipeline_selector.addItem('default')
        saved=self.parent.dashboard.get('optimize/pipelines')
        for item in saved:
            self.pipeline_selector.addItem(item)
        self.pipeline_selector.currentTextChanged.connect(self.load)
        saveLayout.addWidget(self.pipeline_selector)
        self.store_button = IconButton('dashboard/gui/media/Material/content-save-outline.svg', self.store, tooltip='Save preset')
        saveLayout.addWidget(self.store_button)
        self.delete_button = IconButton('dashboard/gui/media/Material/trash.svg', self.delete, tooltip='Delete preset')
        saveLayout.addWidget(self.delete_button)

        self.tree = CustomTree(self)
        self.tree.setColumnCount(2)
        header_item = QTreeWidgetItem(['Block', 'Parameter'])
        self.tree.setHeaderItem(header_item)
        self.tree.setDragEnabled(True)
        self.tree.viewport().setAcceptDrops(True)
        self.tree.setDropIndicatorShown(True)
        self.tree.setDragDropMode(QAbstractItemView.InternalMove)

        treeLayout.addWidget(self.tree)

        self.add_button = IconButton('dashboard/gui/media/Material/content-add.svg', None, tooltip='Add block')
        self.add_button.setMenu(self.get_add_menu())
        self.remove_button = IconButton('dashboard/gui/media/Material/content-remove.svg', self.delete_item, tooltip='Remove block')
        self.clear_button = IconButton('dashboard/gui/media/Material/content-undo.svg', self.reset, tooltip='Reset pipeline')

        for button in [self.add_button, self.remove_button, self.clear_button]:
            saveLayout.addWidget(button)
        self.averaging_edit = QLineEdit('1')
        average_button = IconButton('dashboard/gui/media/Material/outline-repeat_one.svg', None, tooltip='Point averaging')
        average_menu = QMenu()
        average_button.setMenu(average_menu)
        widget_action = QWidgetAction(average_menu)
        self.averaging_edit.returnPressed.connect(average_menu.hide)
        widget_action.setDefaultWidget(self.averaging_edit)
        average_menu.addAction(widget_action)
        box_layout.addWidget(average_button)

        saveLayout.addWidget(IconButton('dashboard/gui/media/Material/outline-play-arrow.svg', self.post_pipeline, tooltip='Start'))

        self.reset()
示例#17
0
    def __init__(self,
                 seed=None,
                 title=None,
                 icon=True,
                 msg=None,
                 options=None,
                 is_seed=None,
                 passphrase=None,
                 parent=None,
                 for_seed_words=True):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.options = options
        if title:
            self.addWidget(WWLabel(title))
        if seed:  # "read only", we already have the text
            if for_seed_words:
                self.seed_e = ButtonsTextEdit()
            else:  # e.g. xpub
                self.seed_e = ShowQRTextEdit()
            self.seed_e.setReadOnly(True)
            self.seed_e.setText(seed)
        else:  # we expect user to enter text
            assert for_seed_words
            self.seed_e = CompletionTextEdit()
            self.seed_e.setTabChangesFocus(False)  # so that tab auto-completes
            self.is_seed = is_seed
            self.saved_is_seed = self.is_seed
            self.seed_e.textChanged.connect(self.on_edit)
            self.initialize_completer()

        self.seed_e.setMaximumHeight(75)
        hbox = QHBoxLayout()
        if icon:
            logo = QLabel()
            logo.setPixmap(
                QPixmap(icon_path("seed.png")).scaledToWidth(
                    64, mode=Qt.SmoothTransformation))
            logo.setMaximumWidth(60)
            hbox.addWidget(logo)
        hbox.addWidget(self.seed_e)
        self.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        self.seed_type_label = QLabel('')
        hbox.addWidget(self.seed_type_label)

        # options
        self.is_bip39 = False
        self.is_ext = False
        if options:
            opt_button = EnterButton(_('Options'), self.seed_options)
            hbox.addWidget(opt_button)
            self.addLayout(hbox)
        if passphrase:
            hbox = QHBoxLayout()
            passphrase_e = QLineEdit()
            passphrase_e.setText(passphrase)
            passphrase_e.setReadOnly(True)
            hbox.addWidget(QLabel(_("Your seed extension is") + ':'))
            hbox.addWidget(passphrase_e)
            self.addLayout(hbox)
        self.addStretch(1)
        self.seed_warning = WWLabel('')
        if msg:
            self.seed_warning.setText(seed_warning_msg(seed))
        self.addWidget(self.seed_warning)
示例#18
0
 def __init__(self, *args, **kwargs):
     self.__minimumSize = None
     self.__maximumSize = None
     QVBoxLayout.__init__(self, *args, **kwargs)
示例#19
0
 def __init__(self):
     QVBoxLayout.__init__(self)
     Publisher.__init__(self)
     self.role = 'view'
     self.initUI()
示例#20
0
 def __init__(self, parent=None):
     QVBoxLayout.__init__(self, parent)
     self._last_size = QSize(0, 0)
    def __init__(
            self,
            title=None,
            icon=True,
            options=None,
            is_seed=None,
            parent=None,
            for_seed_words=True,
            full_check=True,
            *,
            config: 'SimpleConfig',
    ):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.options = options
        self.config = config
        self.seed_type = 'electrum'
        if title:
            self.addWidget(WWLabel(title))
        assert for_seed_words
        self.seed_e = CompletionTextEdit()
        self.seed_e.setTabChangesFocus(False)  # so that tab auto-completes
        self.is_seed = is_seed
        self.saved_is_seed = self.is_seed
        self.seed_e.textChanged.connect(self.on_edit)
        self.initialize_completer()

        self.seed_e.setMaximumHeight(75)
        hbox = QHBoxLayout()
        if icon:
            logo = QLabel()
            logo.setPixmap(QPixmap(icon_path("seed.png"))
                           .scaledToWidth(64, mode=Qt.SmoothTransformation))
            logo.setMaximumWidth(60)
            hbox.addWidget(logo)
        hbox.addWidget(self.seed_e)
        self.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.addStretch(1)

        self.seed_type_label = QLabel('')
        if full_check:
            hbox.addWidget(self.seed_type_label)

        # options
        self.is_ext = False

        self.opt_button = None

        if options:
            self.opt_button = EnterButton(_('Options'), self.seed_options)

        seed_types = [
            (value, title) for value, title in (
                ('electrum', _('Electrum')),
                ('bip39', _('BIP39 seed')),
            )
        ]
        seed_type_values = [t[0] for t in seed_types]

        def f(choices_layout):
            self.seed_type = seed_type_values[choices_layout.selected_index()]
            self.is_seed = (lambda x: bool(x)) if self.seed_type != 'bip39' else self.saved_is_seed
            self.seed_status.setText('')
            self.on_edit(from_click=True)
            self.initialize_completer()
            self.seed_warning.setText(None)

            if self.seed_type == 'bip39':
                if self.opt_button:
                    self.opt_button.setVisible(False)
            else:
                if self.opt_button:
                    self.opt_button.setVisible(True)

        if options and full_check:
            hbox.addWidget(self.opt_button)
        self.addLayout(hbox)

        checked_index = seed_type_values.index(self.seed_type)
        titles = [t[1] for t in seed_types]
        self.clayout = ChoicesLayout(_('Seed type'), titles, on_clicked=f, checked_index=checked_index)
        if full_check:
            hbox.addLayout(self.clayout.layout())

        self.addStretch(1)
        self.seed_status = WWLabel('')
        self.addWidget(self.seed_status)
        self.seed_warning = WWLabel('')
        self.addWidget(self.seed_warning)

        self.lang = 'en'
示例#22
0
    def __init__(self, parent):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.name = 'Model'
        ''' Experiment select layout '''
        self.experiment_layout = QVBoxLayout()
        label = QLabel('Experiment')
        label.setStyleSheet(
            'color:"#000000"; font-weight: light; font-family: "Exo 2"; font-size: 14px; background-color: transparent'
        )
        self.experiment_layout.addWidget(label)
        self.experiment_box = QComboBox()
        self.experiment_layout.addWidget(self.experiment_box)
        ''' Experiment parameters '''
        self.experiment_table = ParameterTable()
        ''' Model select layout '''
        self.modelLayout = QVBoxLayout()
        self.model_box = QComboBox()
        for item in ['None', 'GaussianProcess', 'NonlinearModel']:
            self.model_box.addItem(item)
        label = QLabel('Model')
        label.setStyleSheet(
            'color:"#000000"; font-weight: light; font-family: "Exo 2"; font-size: 14px; background-color: transparent'
        )
        self.modelLayout.addWidget(label)
        self.modelLayout.addWidget(self.model_box)
        ''' Model parameters '''
        self.model_table = ParameterTable()
        ''' Algorithm select layout '''
        self.sampler_layout = QVBoxLayout()
        label = QLabel('Sampler')
        label.setStyleSheet(
            'color:"#000000"; font-weight: light; font-family: "Exo 2"; font-size: 14px; background-color: transparent'
        )
        self.sampler_layout.addWidget(label)
        self.sampler_box = QComboBox()
        self.sampler_layout.addWidget(self.sampler_box)

        self.sampler_table = ParameterTable()
        ''' Add parameter tables in tabs '''
        self.horizontal_layout = QHBoxLayout()
        self.tab_widget = QTabWidget()
        self.experiment_layout.addWidget(self.experiment_table)
        self.horizontal_layout.addLayout(self.experiment_layout)
        self.modelLayout.addWidget(self.model_table)
        self.horizontal_layout.addLayout(self.modelLayout)

        self.sampler_layout.addWidget(self.sampler_table)
        self.horizontal_layout.addLayout(self.sampler_layout)

        self.addLayout(self.horizontal_layout)

        for box in [self.experiment_box, self.sampler_box, self.model_box]:
            box.currentTextChanged.connect(self.update_params)

        self.gotoLayout = QHBoxLayout()
        label = QLabel('End at')
        self.gotoLayout.addWidget(label)
        label.setStyleSheet(
            'color:"#000000"; font-weight: light; font-family: "Exo 2"; font-size: 14px; background-color: transparent'
        )
        self.goto_box = QComboBox()
        for item in ['First point', 'Best point', 'Last point']:
            self.goto_box.addItem(item)
        self.gotoLayout.addWidget(self.goto_box)
        self.addLayout(self.gotoLayout)

        self.triggerLayout = QHBoxLayout()
        label = QLabel('Trigger')
        self.triggerLayout.addWidget(label)
        label.setStyleSheet(
            'color:"#000000"; font-weight: light; font-family: "Exo 2"; font-size: 14px; background-color: transparent'
        )
        self.trigger_box = QComboBox()
        self.triggerLayout.addWidget(self.trigger_box)
        self.addLayout(self.triggerLayout)

        optimizeButtonsLayout = QHBoxLayout()
        parent.optimizer_button = QPushButton('Go!')
        parent.optimizer_button.clicked.connect(
            lambda: parent.start_process(process='model'))

        optimizeButtonsLayout.addWidget(parent.optimizer_button)
        self.addLayout(optimizeButtonsLayout)
示例#23
0
 def __init__(self, seed=None, title=None, icon=True, msg=None, options=None,
              is_seed=None, passphrase=None, parent=None):
     QVBoxLayout.__init__(self)
     self.parent = parent
     self.options = options
     if title:
         self.addWidget(WWLabel(title))
     self.seed_e = ButtonsTextEdit()
     if seed:
         self.seed_e.setText(seed)
     else:
         self.seed_e.setTabChangesFocus(True)
         self.is_seed = is_seed
         self.saved_is_seed = self.is_seed
         self.seed_e.textChanged.connect(self.on_edit)
     self.seed_e.setMaximumHeight(75)
     hbox = QHBoxLayout()
     if icon:
         logo = QLabel()
         logo.setPixmap(QPixmap(icon_path("seed.png")).scaledToWidth(64))
         logo.setMaximumWidth(60)
         hbox.addWidget(logo)
     hbox.addWidget(self.seed_e)
     self.addLayout(hbox)
     hbox = QHBoxLayout()
     seed_text = ("<p>"+ _("You can simply enter a seed previously created in ElectrumSV or "+
         "Electron Cash here, and when you have entered enough words, the 'Next' button will "+
         "become enabled. The 'Options' can be ignored unless you know you need them due to "+
         "previous special choices made when creating your seed.") +"</p>"+
         "<p>"+
         _("Be aware that if you are importing a seed created using another wallet like "+
         "Centbee, Handcash or Moneybutton only do so if it is absolutely necessary or you "+
         "do not plan to do anything other than watch the coins.  At least Handcash and "+
         "Moneybutton get confused if other wallets try and manage the same coins at the "+
         "same time. You will need to fix your original Handcash or Moneybutton wallets if "+
         "you send or receive the same coins in ElectrumSV, in order to get them to work "+
         "correctly again.") +
         "</p>")
     seed_help_label = HelpLabel("label text", seed_text)
     seed_help_label.setPixmap(
         QPixmap(icon_path("icons8-info.svg")).scaledToWidth(16, Qt.SmoothTransformation))
     hbox.addWidget(seed_help_label)
     seed_label = QLabel(_("About importing a seed"))
     hbox.addWidget(seed_label)
     hbox.addStretch(1)
     self.seed_type_label = QLabel('')
     hbox.addWidget(self.seed_type_label)
     if options:
         opt_button = EnterButton(_('Options'), self.seed_options)
         hbox.addWidget(opt_button)
         self.addLayout(hbox)
     if passphrase:
         hbox = QHBoxLayout()
         passphrase_e = QLineEdit()
         passphrase_e.setText(passphrase)
         passphrase_e.setReadOnly(True)
         hbox.addWidget(QLabel(_("Your seed extension is") + ':'))
         hbox.addWidget(passphrase_e)
         self.addLayout(hbox)
     self.addStretch(1)
     self.seed_warning = WWLabel('')
     if msg:
         self.seed_warning.setText(seed_warning_msg(seed))
     self.addWidget(self.seed_warning)
示例#24
0
 def __init__(self):
     QVBoxLayout.__init__(self)
     self.setSpacing(5)
     self.setContentsMargins(10, 10, 10, 10)
示例#25
0
    def __init__(self, seed=None, title=None, icon=True, msg=None, options=None,
                 is_seed=None, passphrase=None, parent=None, for_seed_words=True):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.options = options
        if title:
            self.addWidget(WWLabel(title))
        if seed:  # "read only", we already have the text
            if for_seed_words:
                self.seed_e = ButtonsTextEdit()
            else:  # e.g. xpub
                self.seed_e = ShowQRTextEdit()
            self.seed_e.setReadOnly(True)
            self.seed_e.setText(seed)
        else:  # we expect user to enter text
            assert for_seed_words
            self.seed_e = ButtonsTextEdit()
            self.seed_e.addButton("paste.png",self.paste_text,_("paste seed"))
            #self.seed_e.setTabChangesFocus(False)  # so that tab auto-completes
            self.is_seed = is_seed
            self.saved_is_seed = self.is_seed
            self.seed_e.textChanged.connect(self.on_edit)
            #self.initialize_completer()

        self.seed_e.setMaximumHeight(75)
        hbox = QHBoxLayout()
        if icon:
            logo = QLabel()
            logo.setPixmap(QPixmap(icon_path("seed.png"))
                           .scaledToWidth(64, mode=Qt.SmoothTransformation))
            logo.setMaximumWidth(60)
            hbox.addWidget(logo)
        hbox.addWidget(self.seed_e)
        self.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        self.seed_type_label = QLabel('')
        hbox.addWidget(self.seed_type_label)

        # options
        self.is_bip39 = False
        
        if options:
            vbox = QVBoxLayout()
            hbox.addLayout(vbox)
            
            if 'bip39' in self.options:
                def f(b):
                    self.is_seed = (lambda x: bool(x)) if b else self.saved_is_seed
                    self.is_bip39 = b
                    self.on_edit()
                cb_bip39 = QCheckBox(_('Import mobile wallet seed phrase.'))
                cb_bip39.toggled.connect(f)
                cb_bip39.setChecked(self.is_bip39)
                vbox.addWidget(cb_bip39)
            self.addLayout(hbox)
            
        self.addStretch(1)
        self.seed_warning = WWLabel('')
        if msg:
            self.seed_warning.setText(seed_warning_msg(seed))
        self.addWidget(self.seed_warning)
示例#26
0
    def __init__(
        self,
        seed=None,
        title=None,
        icon=True,
        msg=None,
        options=None,
        is_seed=None,
        passphrase=None,
        parent=None,
        for_seed_words=True,
        on_edit_cb=None,
        *,
        config: 'SimpleConfig',
    ):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.options = options
        self.on_edit_cb = on_edit_cb
        self.config = config
        self.seed_type = 'electrum'
        if title:
            self.addWidget(WWLabel(title))
        if seed:  # "read only", we already have the text
            if for_seed_words:
                self.seed_e = ButtonsTextEdit()
            else:  # e.g. xpub
                self.seed_e = ShowQRTextEdit(config=self.config)
            self.seed_e.setReadOnly(True)
            self.seed_e.setText(seed)
        else:  # we expect user to enter text
            assert for_seed_words
            self.seed_e = CompletionTextEdit()
            self.seed_e.setTabChangesFocus(False)  # so that tab auto-completes
            self.is_seed = is_seed
            self.saved_is_seed = self.is_seed
            self.seed_e.textChanged.connect(self.on_edit)
            self.initialize_completer()

        self.seed_e.setMaximumHeight(75)
        hbox = QHBoxLayout()
        if icon:
            logo = QLabel()
            logo.setPixmap(
                QPixmap(icon_path("seed.png")).scaledToWidth(
                    64, mode=Qt.SmoothTransformation))
            logo.setMaximumWidth(60)
            hbox.addWidget(logo)
        hbox.addWidget(self.seed_e)
        self.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        self.seed_type_label = QLabel('')
        hbox.addWidget(self.seed_type_label)

        # options
        self.is_ext = False
        if options:
            opt_button = EnterButton(_('Options'), self.seed_options)
            hbox.addWidget(opt_button)
            self.addLayout(hbox)
        if passphrase:
            hbox = QHBoxLayout()
            passphrase_e = QLineEdit()
            passphrase_e.setText(passphrase)
            passphrase_e.setReadOnly(True)
            hbox.addWidget(QLabel(_("Your seed extension is") + ':'))
            hbox.addWidget(passphrase_e)
            self.addLayout(hbox)

        # slip39 shares
        self.slip39_mnemonic_index = 0
        self.slip39_mnemonics = [""]
        self.slip39_seed = None
        self.slip39_current_mnemonic_invalid = None
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        self.prev_share_btn = QPushButton(_("Previous share"))
        self.prev_share_btn.clicked.connect(self.on_prev_share)
        hbox.addWidget(self.prev_share_btn)
        self.next_share_btn = QPushButton(_("Next share"))
        self.next_share_btn.clicked.connect(self.on_next_share)
        hbox.addWidget(self.next_share_btn)
        self.update_share_buttons()
        self.addLayout(hbox)

        self.addStretch(1)
        self.seed_status = WWLabel('')
        self.addWidget(self.seed_status)
        self.seed_warning = WWLabel('')
        if msg:
            self.seed_warning.setText(seed_warning_msg(seed))
        self.addWidget(self.seed_warning)
 def __init__(self, options: Options, parent=None, delegate: OptionsMenuViewDelegate = None):
     QVBoxLayout.__init__(self, parent)
     self._delegate = delegate
     self._set_up_ui(options)