예제 #1
0
파일: detail.py 프로젝트: Alex-Cheng/pdash
 def __init__(self,
              parent=None,
              product_id=None,
              name="",
              image=abs_path('icons/test.png'),
              icon=abs_path('icons/[email protected]'),
              category="Category",
              created=None,
              sales=0,
              cpc=0,
              description="",
              remain=0,
              market_hash=None,
              owner_address=None,
              ptype=None):
     self.parent = parent
     self.product_id = product_id
     self.name_ = name
     self.image_ = image
     self.icon = icon
     self.category = category
     self.created = created
     self.sales = sales
     self.cpc_ = cpc
     self.description_ = description
     self.remain = remain
     self.ptype = ptype
     self.market_hash = market_hash
     self.owner_address = owner_address
     self.is_owner = False
     self.paying = False
     super().__init__(parent)
     self.setObjectName("product_detail")
     self.signals.payed.connect(self.payedSlot)
예제 #2
0
 def __init__(self, star, listener):
     self.star = star
     self.listener = listener
     self.icon = Star.load_star(abs_path('icons/[email protected]'))
     self.clicked_icon = Star.load_star(
         abs_path('icons/star_{}@2x.png'.format(star)))
     super().__init__()
     self.setPixmap(self.icon)
     self.is_clicked = False
     Binder.click(self, self.onClicked)
예제 #3
0
    def ui(self, widget):
        layout = QVBoxLayout(widget)
        row = QHBoxLayout()
        row.setSpacing(0)
        row.addWidget(Builder().text('Address:').name('address_hint').build())
        row.addWidget(Builder().text(
            self.address.value).name('address').build())
        row.addSpacing(10)
        picture = Picture(abs_path('icons/[email protected]'), width=30, height=30)
        picture.setObjectName('picture')
        row.addWidget(picture)
        row.addSpacing(8)
        row.addWidget(Builder().click(
            self.copy_address).text('Copy').name('copy').build())
        row.addStretch(1)
        layout.addLayout(row)
        row2 = QHBoxLayout()
        row2.setSpacing(0)
        row2.addSpacing(15)
        row2.setAlignment(Qt.AlignBottom)
        qrcode = Picture(utils.get_cpc_free_qrcode(), width=96, height=96)
        qrcode.setObjectName('qrcode')
        row2.addWidget(qrcode)
        row2.addSpacing(10)

        copied_icon = Picture(abs_path('icons/[email protected]'),
                              width=30,
                              height=30)
        copied_layout = QHBoxLayout()
        copied_layout.setContentsMargins(0, 0, 0, 0)
        copied_layout.setSpacing(0)
        copied_layout.addWidget(copied_icon)
        copied_text = Builder().text('copied!').name('copied').build()
        copied_layout.addWidget(copied_text)
        copied_layout.addStretch(1)
        self.copied = QFrame(self)
        self.copied.setObjectName('copied_frame')
        self.copied.setLayout(copied_layout)

        vbox = QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setAlignment(Qt.AlignTop)
        vbox.addWidget(self.copied)

        row2.addLayout(vbox)
        self.copied.hide()
        row2.addStretch(1)
        layout.addLayout(row2)
        layout.addWidget(
            Builder().text('Get CPC for free').name('get_cpc').click(
                lambda _: self.openUrl(config.account.charge_server)).build())
        return layout
예제 #4
0
 def create(self):
     # balance
     amount = account.to_ether(account.get_balance(app.addr))
     self.obj.icon = abs_path('icons/person.png')
     self.obj.username = '******'.format(app.username)
     self.obj.amount = '{}'.format(amount)
     wallet.market_client.products().addCallbacks(self.renderProducts)
예제 #5
0
파일: loading.py 프로젝트: jkulesza/pdash
 def initUI(self):
     self.setObjectName('Loading')
     layout = QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setSpacing(0)
     layout.setAlignment(Qt.AlignCenter)
     loading = LoadingGif(self,
                          path=abs_path('icons/new_loading.gif'),
                          width=self.width_,
                          height=self.height_)
     loading.setObjectName('loading')
     layout.addWidget(loading)
     text = QLabel(self.text_)
     text.setObjectName('Text')
     text.setContentsMargins(0, 0, 0, 0)
     layout.addWidget(text)
     self.setStyleSheet("""
     QLabel#Text {{
         font-size: {}px;
         color: #9B9B9B;
         padding-bottom: 3px;
         padding-left: 3px;
     }}
     """.format(self.font_size))
     self.setLayout(layout)
     self.setContentsMargins(0, 0, 0, 0)
예제 #6
0
 def ui(self, layout):
     self.spacing(40)
     title = Builder().text('Generating keystore file…')\
                      .name('title')\
                      .build()
     self.add(title)
     self.spacing(60)
     loading = LoadingGif(path=abs_path('icons/GIF_3dot.gif'),
                          width=228,
                          height=228)
     self.add(loading)
예제 #7
0
파일: market.py 프로젝트: jkulesza/pdash
    def ui(self):
        scroll = QScrollArea()
        scroll.setStyleSheet("background: #fafafa;")
        layout = QVBoxLayout(self)
        layout.setAlignment(Qt.AlignHCenter | Qt.AlignTop)

        width = 720

        path = abs_path('icons/banner 2.png')
        banner = Banner(
            path,
            width=width,
            height=155,
            title="PDASH",
            subtitle=
            "Parallel Distributed Architecture for Data Storage and Sharing")
        banner.setObjectName('banner')

        layout.addWidget(banner)

        # add market title
        layout.addSpacing(15)
        layout.addWidget(Builder().text("Market Products").style(
            "font-size:24px;color:#333333;").build())

        layout.addSpacing(15)
        self.loading = Loading(text='Loading')
        layout.addWidget(self.loading)

        # Product List
        pdsWidget = ProductList(self.products, scroll=False)
        pdsWidget.setObjectName('products_list')
        pdsWidget.setMinimumWidth(width)
        pdsWidget.setMaximumWidth(width)

        layout.addWidget(pdsWidget)
        layout.addStretch(1)
        scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setWidgetResizable(True)
        wid = QWidget()
        wid.setLayout(layout)
        wid.setContentsMargins(0, 0, 0, 0)
        scroll.setWidget(wid)

        _layout = QVBoxLayout()
        _layout.setAlignment(Qt.AlignTop)
        _layout.addWidget(scroll)
        # add spacing with bottom
        _layout.addSpacing(30)
        wid.setStyleSheet("""
        """)
        return _layout
예제 #8
0
 def ui(self):
     width = 150
     height = 150
     layout = QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setAlignment(Qt.AlignLeft)
     for pic in self.pictures.value:
         tmp = Picture(path=pic, width=width, height=height)
         layout.addWidget(tmp)
     add = Picture(path=abs_path('icons/[email protected]'),
                   width=width,
                   height=height)
     Binder.click(add, self.read_file)
     layout.addWidget(add)
     return layout
예제 #9
0
    def ui(self):
        layout = QVBoxLayout(self)
        layout.setAlignment(Qt.AlignHCenter | Qt.AlignTop)

        width = 750

        path = abs_path('icons/banner 2.png')
        banner = Banner(
            path,
            width=720,
            height=155,
            title="PDASH",
            subtitle=
            "Parallel Distributed Architecture for Data Storage and Sharing")
        banner.setObjectName('banner')
        wrapper_banner = QWidget()
        wrapper_banner.setContentsMargins(0, 0, 0, 0)
        wrapper_layout = QHBoxLayout()
        wrapper_layout.addWidget(banner)
        wrapper_layout.setContentsMargins(0, 0, 0, 0)
        wrapper_banner.setLayout(wrapper_layout)

        wrapper_banner.setMinimumWidth(width)
        wrapper_banner.setMaximumWidth(width)

        layout.addWidget(wrapper_banner)
        layout.addSpacing(15)
        self.loading = Loading(text='Loading')
        layout.addWidget(self.loading)

        # Product List
        pdsWidget = ProductList(self.products)
        pdsWidget.setObjectName('products_list')
        pdsWidget.setMinimumWidth(width)
        pdsWidget.setMaximumWidth(width)
        layout.addWidget(pdsWidget)
        self.setStyleSheet("""
            QWidget#banner {
                
            }
            QScrollArea#market_page {
            }
            QWidget#products_list {
                width: 720;
            }
        """)
        return layout
예제 #10
0
 def __init__(self, parent=None, src=None, width=None, height=None, market_hash=None, show_status=False):
     super().__init__(parent)
     self.src_ = src
     self.width_ = width
     self.height_ = height
     self.signals = Signals()
     self.status = None
     self.need_mask_ = True
     self.show_status = show_status
     status = app.get_status(market_hash, app.addr)
     if status is not None and self.show_status:
         self.status = app.get_status_enum(status)
     else:
         self.need_mask_ = False
     self.downloading_gif_ = abs_path('icons/downloading.gif')
     self.is_downloading_ = False
     self.show_text_ = ""
     self.init()
예제 #11
0
    def ui(self, layout):
        # Logo
        path = abs_path('icons/[email protected]')
        pixm = QPixmap(path)
        scale = 1.3
        pixm = pixm.scaled(168 * scale, 214 * scale)
        logo = Builder().name('logo').pixmap(pixm).build()
        logoLayout = QHBoxLayout()
        logoLayout.setAlignment(Qt.AlignCenter)
        logoLayout.addWidget(logo)
        self.add(logoLayout, 70)

        create = Builder(widget=Button).text('Create New Account')\
                                       .name('create')\
                                       .click(lambda _: self.to(self.createWnd)).build()
        _import = Builder(widget=Button).text('Import Account')\
                                        .name('_import')\
                                        .click(lambda _: self.to(self.importWnd)).build()
        self.add(create, 15)
        self.add(_import)
예제 #12
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
예제 #13
0
 def __init__(self, parent=None):
     QObject.__init__(self, parent)
     self._icon = abs_path('icons/person.png')
     self._username = ""
     self._amount = "0"
예제 #14
0
파일: detail.py 프로젝트: Alex-Cheng/pdash
    def add_orders_ui(self, widget):
        height = widget.height()
        layout = widget.layout()

        order = None
        status = 0
        start = 1

        is_seller = self.owner_address == wallet.market_client.public_key
        # Sales
        if app.products_order.get(self.market_hash):
            self.sales_header = DetailHeader("{} Sales".format(
                len(app.products_order.get(self.market_hash))))
            layout.insertWidget(start, self.sales_header)
            start += 1

            # enum State {
            #     Created,
            #     SellerConfirmed,
            #     ProxyFetched,
            #     ProxyDelivered,
            #     BuyerConfirmed,
            #     Finished,
            #     SellerRated,
            #     BuyerRated,
            #     Disputed,
            #     Withdrawn
            # }
            myaddress = get_address_from_public_key_object(
                wallet.market_client.public_key)
            self.salesElem = []
            need_show = False
            for order in app.products_order[self.market_hash]:
                # not buyer and not seller
                buyer_addr = eth_addr_to_string(order['buyer_addr'])
                is_buyer = buyer_addr == myaddress
                if not is_buyer and not is_seller:
                    continue
                need_show = True
                self.buy.setEnabled(False)
                status = order['status']
                if status == 0:
                    current = 1
                elif status == 1:
                    current = 1
                elif status == 2:
                    current = 2
                elif status == 3:
                    current = 3
                else:
                    current = 4
                sale1 = Sale(
                    image=abs_path('icons/avatar.jpeg'),
                    name=order['public_key'],
                    current=current,
                    timestamps=[
                        "May 2, 08:09:08", "May 2, 08:09:08",
                        "May 2, 08:09:08", "May 2, 08:09:08"
                    ],
                    order_id=order["order_id"],
                    mhash=self.market_hash,
                    is_buyer=is_buyer,
                    is_seller=is_seller,
                    order_type='stream' if self.ptype == 'stream' else 'file')
                layout.insertWidget(start, sale1)
                self.salesElem.append(sale1)
                start += 1
                height += 200

            if not need_show:
                self.sales_header.hide()

        # Order Detail
        if status < 1:
            self.status_text.value = "Created on May 2, 08:09:08"
        elif status == 1:
            self.status_text.value = "Delivered on May 2, 08:09:08"
        elif status <= 3:
            self.status_text.value = "Received on May 2, 08:09:08"
        elif status > 3:
            self.status_text.value = "Confirmed on May 2, 08:09:08"
        if order and self.owner_address != wallet.market_client.public_key:
            if status > 2:
                order_header = DetailHeader('Order Detail')
                layout.insertWidget(start, order_header)
                start += 1
                height += 100
                has_comfirmed = status > 3
                if self.ptype == 'file':
                    self.data_type = 'batch'
                    self.order_detail = OrderDetail(
                        order_time=Model("2018/6/15  08:40:39"),
                        status=self.status_text,
                        order_id=order["order_id"],
                        name=self.name.value,
                        data_type=self.data_type,
                        has_comfirmed=has_comfirmed)
                    layout.insertWidget(start, self.order_detail)
                    start += 1
                    height += 100
                if self.ptype == 'stream':
                    self.data_type = 'stream'
                    order_detail = OrderDetail(
                        order_time=Model("2018/6/15  08:40:39"),
                        status=self.status_text,
                        order_id=order["order_id"],
                        market_hash=self.market_hash,
                        name=self.name.value,
                        data_type=self.data_type,
                        has_comfirmed=has_comfirmed)
                    layout.insertWidget(start, order_detail)
                    start += 1
                    height += 100
        widget.setFixedHeight(height)
예제 #15
0
 def close_icon_hover(self):
     return abs_path('icons/closehover.png')
예제 #16
0
 def close_icon(self):
     return abs_path('icons/close.png')
예제 #17
0
 def brush(self):
     palette1 = QPalette()
     path = abs_path('icons/[email protected]')
     palette1.setBrush(self.backgroundRole(), QBrush(QPixmap(path)))
     self.setPalette(palette1)
     self.setAutoFillBackground(True)
예제 #18
0
 def data(self):
     return {'pictures': [abs_path('icons/[email protected]')]}
예제 #19
0
 def brush(self):
     palette1 = QtGui.QPalette()
     palette1.setBrush(self.backgroundRole(),
                       QtGui.QBrush(QtGui.QPixmap(abs_path('icons/close'))))
     self.setPalette(palette1)
     self.setAutoFillBackground(True)