示例#1
0
    def ui(self, widget):
        layout = QVBoxLayout(widget)
        layout.setSpacing(20)
        unit1 = Builder().text('CPC').name('unit').build()
        unit2 = Builder().text('CPC').name('unit').build()
        unit3 = Builder().text('CPC').name('unit').build()
        layout.addLayout(self.gen_row('Balance:', Builder().text(
            self.account_amount.value).build(), unit1))
        layout.addLayout(self.gen_row('Transfer Amount:', Input.Builder(
            height=25, width=120).model(self.transfer_amount).build(), unit2))
        layout.addLayout(self.gen_row('Remark:', Input.Builder(
            height=25, width=120).model(self.remark).build()))
        layout.addLayout(self.gen_row('Collection Address:', Input.Builder(
            height=25, width=250).model(self.collection_address).build()))
        layout.addLayout(self.gen_row('Payment Address:', Input.Builder(
            height=25, width=250).model(self.payaddr).build()))
        layout.addLayout(self.gen_row(
            'Gas Price:', Builder().text(self.gas.value).build(), unit3))

        hbox = QHBoxLayout()
        hbox.addStretch(1)
        next_ = Button.Builder(width=100, height=28).style(
            'primary').click(self.openPassword).text('Next').build()
        hbox.addWidget(next_)
        hbox.addSpacing(5)

        layout.addLayout(hbox)
        return layout
示例#2
0
 def ui(self, layout):
     title = Builder().text('Create a new account')\
                      .name('title')\
                      .build()
     desc = Builder().text('The password cannot be modified and we cannot recover it, please backup cautiously.')\
                     .name('desc')\
                     .wrap(True)\
                     .height(80)\
                     .build()
     self.add(title)
     self.add(desc, 40)
     password = Input.Builder().placeholder('Password')\
                               .name('pwd')\
                               .mode(Input.Password)\
                               .model(self.password)\
                               .build()
     self.add(password, 10)
     repeat = Input.Builder().placeholder('Repeat Password')\
                             .name('repeat')\
                             .mode(Input.Password)\
                             .model(self.repeat)\
                             .build()
     self.add(repeat, 10)
     self.add(Agreement(self.check, width=228, height=30), 40)
     self.add(Button.Builder().text('Create').style('primary').click(
         lambda _: self.create()).build())
示例#3
0
    def ui(self, widget):
        layout = QVBoxLayout(widget)
        width = 340
        layout.addWidget(Builder().name('field').text('Data name:').build())
        layout.addWidget(
            Input.Builder(width=width).model(self.data_name).name(
                'data-name').placeholder('Please input data name').build())
        layout.addSpacing(10)
        layout.addWidget(
            Builder().name('field').text('Select a Proxy:').build())

        combox = ComboBox(self.proxy)
        combox.setMaximumWidth(width + 24)
        combox.setMinimumWidth(width + 24)
        layout.addWidget(combox)

        hbox = QHBoxLayout()
        hbox.setAlignment(Qt.AlignRight)
        hbox.addWidget(
            Button.Builder(width=100, height=30).text('Cancel').click(
                lambda _: self.close()).build())
        hbox.addSpacing(10)
        hbox.addWidget(
            Button.Builder(width=100, height=30).text('Next').click(
                self.toNext).style('primary').build())

        layout.addStretch(1)
        layout.addLayout(hbox)
        return layout
示例#4
0
    def ui(self, layout):
        layout.addSpacing(30)
        title = Builder().text('Import a keystore file')\
                         .name('title')\
                         .build()
        desc = Builder().text('CPC Wallet uses a keystore format to store encrypted'
                              ' private key information, please drop the file below.')\
                        .name('desc')\
                        .wrap(True)\
                        .height(100)\
                        .build()
        self.add(title)
        self.add(desc, 15)
        self.file = FileUploadQml(width=247,
                                  height=74,
                                  background="#f8f8f8",
                                  text="Drop keystore file here or",
                                  browse_text="browse…")
        self.add(self.file, 5)
        password = Input.Builder().placeholder('Password')\
                                  .name('pwd')\
                                  .mode(Input.Password)\
                                  .model(self.password)\
                                  .build()

        self.add(password, 20)
        self.import_ = Button.Builder().text('Import')\
            .style('primary')\
            .click(lambda _: self._import())\
            .build()
        self.add(self.import_, 5)
        self.loading = Loading()
        self.loading.hide()
        self.add(self.loading)
示例#5
0
    def ui(self, _):
        layout = QVBoxLayout()
        layout.setAlignment(Qt.AlignTop)

        layout.addWidget(self.gen_row('Price: ', Label(self.price)))
        layout.addWidget(self.gen_row('Gas: ', Label(self.gas)))
        layout.addWidget(
            self.gen_row('Account Ballance: ', Label(self.account)))
        pwd = Input.Builder(width=280, height=25).model(self.password).mode(
            Input.Password).build()
        layout.addWidget(self.gen_row('Payment Password: '******'Proxy: ', ComboBox(self.proxy), 303))

        # Bottom
        btm = QHBoxLayout()
        btm.setAlignment(Qt.AlignRight)
        btm.setContentsMargins(0, 0, 0, 0)
        btm.setSpacing(40)
        btm.addStretch(1)
        cancel = QPushButton('Cancel')
        cancel.setObjectName('pinfo_cancel_btn')
        cancel.clicked.connect(self.handle_cancel)
        btm.addWidget(cancel)
        self.ok = QPushButton('Pay')
        self.ok.setObjectName('pinfo_publish_btn')
        self.ok.clicked.connect(self.handle_confirm)
        btm.addWidget(self.ok)
        layout.addSpacing(30)
        layout.addLayout(btm)
        return layout
示例#6
0
    def ui(self, widget):
        layout = QVBoxLayout(widget)
        layout.setSpacing(20)
        self.loading = Loading()
        layout.addLayout(self.gen_row('Payment password:'******'', self.loading, left_width=120))
        self.loading.hide()

        hbox = QHBoxLayout()
        hbox.addStretch(1)
        self.ok = Button.Builder(width=100, height=28).style(
            'primary').click(self.beforeSend).text('OK').build()
        hbox.addWidget(self.ok)
        hbox.addSpacing(5)

        layout.addLayout(hbox)
        return layout
示例#7
0
 def ui(self, layout):
     title = Builder().text('Create a username')\
                      .name('title')\
                      .build()
     desc = Builder().text('The username will be bound to the keystore file and cannot be modified.')\
                     .name('desc')\
                     .wrap(True)\
                     .height(80)\
                     .build()
     self.add(title)
     self.add(desc, 40)
     username = Input.Builder().placeholder('Username')\
                               .name('pwd')\
                               .model(self.username)\
                               .build()
     self.username_elem = username
     self.add(username, 10)
     self.add(Button.Builder().text('Enter PDash').style('primary').click(
         lambda _: self.enter()).build())
示例#8
0
    def ui(self, widget):
        layout = QVBoxLayout(widget)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addSpacing(16)
        layout.addLayout(
            self.gen_row(
                'Password:'******'Rate:', Rate()))
        layout.addSpacing(16)
        layout.addLayout(
            self.gen_row(
                'Comment:',
                Text.Builder(width=320,
                             height=80).model(self.comment).placeholder(
                                 "Your comment means a lot to all").build()))
        layout.addSpacing(40)

        bottom = QHBoxLayout()
        bottom.addStretch(1)
        bottom.setSpacing(20)
        btn_width = 80
        btn_height = 30
        bottom.addWidget(
            Button.Builder(width=btn_width, height=btn_height).click(
                self.cancel).text('Cancel').build())
        bottom.addWidget(
            Button.Builder(width=btn_width, height=btn_height).click(
                self.ok).style("primary").text('OK').build())
        bottom.addSpacing(32)

        layout.addLayout(bottom)
        layout.addSpacing(24)
        layout.addStretch(1)
        return layout
示例#9
0
    def ui(self):
        layout = QVBoxLayout(self)
        layout.setAlignment(Qt.AlignTop)
        layout.setSpacing(21)

        # Title
        title = QLabel('Publish Batch Data')
        title.setObjectName('title')
        layout.addWidget(title)

        layout.addSpacing(23)
        # Name
        layout.addLayout(
            self.gen_row(
                "Name:",
                Input.Builder(width=536, height=30).model(self.name).build()))

        # Type
        type_label = 'Batch' if self.type_ == 'Batch' else 'Streaming'
        layout.addLayout(
            self.gen_row('Type:', QLabel('{} data'.format(type_label))))

        # Category
        category = [
            'Advertising', 'Business Intelligence', 'Communications', 'Crypto',
            'Energy', 'Entertainment', 'Environment', 'Finance', 'Health',
            'Industrial', 'IoT', 'Other', 'Retail', 'Smart Cities',
            'Social Media', 'Sports', 'Transportation', 'Weather'
        ]
        categoryWid = QComboBox()
        for cate in category:
            categoryWid.addItem(cate)

        def itemSelect(index):
            self.category.value = category[index]

        categoryWid.currentIndexChanged.connect(itemSelect)
        layout.addLayout(self.gen_row("Category:", categoryWid))

        # Cover Picture
        openBtn = QLabel('browse...')
        openBtn.setObjectName('openBtn')

        def onOpen(_):
            tmp = QFileDialog.getOpenFileName()[0]
            if tmp:
                self.cover_image.value = tmp

        Binder.click(openBtn, onOpen)
        path = Label(self.cover_image)
        layout.addLayout(self.gen_row('Cover picture:', openBtn))
        layout.addLayout(self.gen_row("", path))

        # Description
        text = Text.Builder(width=536,
                            height=80).model(self.description).build()
        # text.setMaximumHeight(80)
        # text.setMinimumHeight(80)
        # text.setMaximumWidth(536)
        # text.setMinimumWidth(536)
        layout.addLayout(self.gen_row("Description:", text))

        # Price
        layout.addLayout(
            self.gen_row(
                "Price:",
                Input.Builder(width=160, height=30).model(self.price).build(),
                14, QLabel('CPC')))

        # Agreement
        agreement = QLabel("xxxxxx")
        agreement.setObjectName('agreement')
        layout.addLayout(
            self.gen_row("", CheckBox(self.checked), 9,
                         QLabel("I agree with the agreement of"), 5,
                         agreement))

        # Bottom
        cancel = QPushButton('Cancel')
        cancel.setObjectName('pinfo_cancel_btn')
        cancel.clicked.connect(self.handle_cancel)
        ok = QPushButton('Publish')
        ok.setObjectName('pinfo_publish_btn')
        ok.clicked.connect(self.handle_publish)
        layout.addLayout(self.gen_row("", cancel, 20, ok))
        layout.addStretch(1)
        return layout
示例#10
0
文件: publish.py 项目: jkulesza/pdash
    def ui(self):
        layout = QVBoxLayout(self)
        layout.setAlignment(Qt.AlignTop)
        layout.setSpacing(21)
        type_label = 'Batch' if self.type_ == 'Batch' else 'Streaming'
        icon_dict = {
            'file': 'icons/[email protected]',
            'stream': 'icons/[email protected]',
        }
        type_icon = abs_path(
            icon_dict['file']) if self.type_ == 'Batch' else abs_path(
                icon_dict['stream'])
        # Title
        title = QLabel('Publish {} Data'.format(type_label))
        title.setObjectName('title')
        layout.addWidget(title)

        layout.addSpacing(23)
        # Name
        layout.addLayout(
            self.gen_row(
                "Name:",
                Input.Builder(width=536, height=30).model(self.name).build()))

        # Type
        type_icon_wid = QLabel()
        type_pix = QPixmap(type_icon)
        type_pix = type_pix.scaled(20, 20)
        type_icon_wid.setPixmap(type_pix)
        layout.addLayout(
            self.gen_row('Type:', type_icon_wid, 7,
                         QLabel('{} data'.format(type_label))))

        # Category
        category = [
            'Advertising', 'Business Intelligence', 'Communications', 'Crypto',
            'Energy', 'Entertainment', 'Environment', 'Finance', 'Health',
            'Industrial', 'IoT', 'Other', 'Retail', 'Smart Cities',
            'Social Media', 'Sports', 'Transportation', 'Weather'
        ]
        categoryWid = QComboBox()
        for cate in category:
            categoryWid.addItem(cate)

        def itemSelect(index):
            self.category.value = category[index]

        categoryWid.currentIndexChanged.connect(itemSelect)
        layout.addLayout(self.gen_row("Category:", categoryWid))

        # Cover Picture
        height = 150
        img = ImageUploadQml(width=547, height=height, gap=1)
        img.setMinimumHeight(height)
        self.cover_image = img
        layout.addLayout(self.gen_row('Cover picture:', img))

        # Description
        text = Text.Builder(width=536,
                            height=80).model(self.description).build()
        # text.setMaximumHeight(80)
        # text.setMinimumHeight(80)
        # text.setMaximumWidth(536)
        # text.setMinimumWidth(536)
        layout.addLayout(self.gen_row("Description:", text))

        # Price
        layout.addLayout(
            self.gen_row(
                "Price:",
                Input.Builder(width=160, height=30).model(self.price).build(),
                14, QLabel('CPC')))

        # Agreement
        agreement = QLabel("xxxxxx")
        agreement.setObjectName('agreement')
        layout.addLayout(
            self.gen_row("", CheckBox(self.checked), 9,
                         QLabel("I agree with the agreement of"), 5,
                         agreement))

        # Bottom
        cancel = QPushButton('Cancel')
        cancel.setObjectName('pinfo_cancel_btn')
        cancel.clicked.connect(self.handle_cancel)
        ok = QPushButton('Publish')
        ok.setObjectName('pinfo_publish_btn')
        ok.clicked.connect(self.handle_publish)
        layout.addLayout(self.gen_row("", cancel, 20, ok))
        layout.addSpacing(30)
        layout.addStretch(1)

        return layout