示例#1
0
 def fillEachPieceOfEquip(self, equip, side, pos):
     tooltip = eq2s_func.CookItemText(equip['item'])
     try:
         epnm = QTableWidgetItem(equip['item']['displayname'])
         epnm.setToolTip(tooltip.text)
         epnm.setData(1001, equip['item']['iconid'])
         epnm.setData(1002, equip['item']['displayname'])
         if side == 'l':
             epnm.setTextAlignment(Qt.AlignRight)
         else:
             epnm.setTextAlignment(Qt.AlignLeft)
         epicon = QTableWidgetItem()
         icon = QIcon()
         icon.addPixmap(eq2s_func.get_pixmap_in_db(equip['item']['iconid']))
         epicon.setIcon(icon)
         epicon.setToolTip(tooltip.text)
         epicon.setData(1001, equip['item']['iconid'])
         epicon.setData(1002, equip['item']['displayname'])
         if side == 'l':
             self.leftEquipTable.setItem(pos, 0, epnm)
             self.leftEquipTable.setItem(pos, 1, epicon)
         elif side == 'r':
             self.rightEquipTable.setItem(pos, 0, epicon)
             self.rightEquipTable.setItem(pos, 1, epnm)
     except KeyError:
         pass
示例#2
0
 def cooked_info(self, item_obj):
     self.setWindowTitle('{} (Modified)'.format(item_obj['name']))
     self.item_detail_label.setText(item_obj['info'])
     pixicon = eq2s_func.get_pixmap_in_db(item_obj['iconid'])
     ticon = QIcon()
     ticon.addPixmap(pixicon)
     self.setWindowIcon(ticon)
     self.item_icon_label.setPixmap(pixicon)
示例#3
0
 def __init__(self, parent=None):
     super(AliPay_w, self).__init__(parent)
     self.setWindowTitle('Thank you!')
     layout = QVBoxLayout()
     label = QLabel()
     paypix = eq2s_func.get_pixmap_in_db(2, 'eq2icon_reserve')
     label.setPixmap(paypix)
     layout.addWidget(label)
     self.setLayout(layout)
示例#4
0
    def whenCollectionTreesReceived(self, trees):
        locker = QMutex()
        locker.lock()
        self.collectionList.extend(trees['collection_list'])
        self.received += 1
        locker.unlock()
        if self.received < self.qcount:
            return

        category_list_order = {}
        for each in self.collectionList:
            try:
                category_list_order[each['category']].append(each)
            except BaseException:
                category_list_order[each['category']] = [each]

        for each in category_list_order:
            cate_item = QTreeWidgetItem()
            cate_item.setText(0, each)
            for ea in category_list_order[each]:
                try:
                    name_item = QTreeWidgetItem()
                    name_item.setText(0, ea['name'])
                    name_item.setText(1, 'Lv.{}'.format(ea['level']))
                    name_item.setText(2, 'Unpack Reward')
                    name_item.setData(2, 1000, ea['reward_list'])
                    for e in ea['reference_list']:
                        pieces_item = QTreeWidgetItem()
                        nm = e['name']
                        if e['id'] in self.foundList:
                            nm += ' * Found *'
                        pieces_item.setText(0, nm)
                        icon = QIcon()
                        icon.addPixmap(eq2s_func.get_pixmap_in_db(e['icon']))
                        pieces_item.setIcon(0, icon)
                        name_item.addChild(pieces_item)
                    cate_item.addChild(name_item)
                except BaseException as err:
                    print(
                        'Something wrong when adding items to collection tree, \n{}'
                        .format(err))
            self.bigTree.addTopLevelItem(cate_item)
示例#5
0
 def author_piece_sets(self):
     bLayout = QHBoxLayout()
     donateBtn = QPushButton()
     donateBtn.setFixedSize(60, 30)
     dicon = QIcon()
     dicon.addPixmap(eq2s_func.get_pixmap_in_db(1, 'eq2icon_reserve'))
     donateBtn.setIcon(dicon)
     donateBtn.setIconSize(QSize(60, 25))
     donateBtn.clicked.connect(self.whenPaypalDonateClicked)
     donateBtn2 = QPushButton('ALIPAY')
     donateBtn2.setFixedSize(50, 30)
     donateBtn2.clicked.connect(self.whenAlipaylDonateClicked)
     author_Label = QLabel()
     author_text = '[Author] Fyoung  [Email] [email protected]  [Github] https://github.com/FYoungLee/EQ2Sheep'
     author_Label.setFixedHeight(30)
     author_Label.setText(author_text)
     bLayout.addWidget(author_Label)
     bLayout.addWidget(donateBtn)
     bLayout.addWidget(donateBtn2)
     return bLayout
示例#6
0
 def fillTable(self):
     levelrange = tuple(self.spells.keys())
     r = 0
     for level in sorted(levelrange):
         for spell in self.spells[level]:
             lvitem = QTableWidgetItem(str(spell['level']))
             lvitem.setTextAlignment(Qt.AlignCenter)
             self.spellsTable.setItem(r, 0, lvitem)
             nmitem = QTableWidgetItem(spell['name'])
             nmitem.setTextAlignment(Qt.AlignCenter)
             try:
                 ticon = QIcon()
                 ticon.addPixmap(
                     eq2s_func.get_pixmap_in_db(spell['icon']['id'],
                                                'spellicons'))
                 nmitem.setIcon(ticon)
             except:
                 pass
             dtxt = eq2s_func.CookSpellText(spell)
             nmitem.setToolTip(dtxt)
             self.spellsTable.setItem(r, 1, nmitem)
             tieritem = QTableWidgetItem(spell['tier_name'])
             tieritem.setTextAlignment(Qt.AlignCenter)
             self.spellsTable.setItem(r, 2, tieritem)
             typeitem = QTableWidgetItem(spell['type'].capitalize())
             typeitem.setTextAlignment(Qt.AlignCenter)
             self.spellsTable.setItem(r, 3, typeitem)
             gbitem = QTableWidgetItem(spell['given_by'].capitalize())
             gbitem.setTextAlignment(Qt.AlignCenter)
             self.spellsTable.setItem(r, 4, gbitem)
             r += 1
     self.spellsTable.horizontalHeader().setSectionResizeMode(
         0, QHeaderView.ResizeToContents)
     self.spellsTable.horizontalHeader().setSectionResizeMode(
         2, QHeaderView.ResizeToContents)
     self.spellsTable.horizontalHeader().setSectionResizeMode(
         3, QHeaderView.ResizeToContents)
     self.spellsTable.horizontalHeader().setSectionResizeMode(
         4, QHeaderView.ResizeToContents)
示例#7
0
    def cook_detail(self, detail):
        # window title
        try:
            self.item_detail = detail['item_list'][0]
            self.setWindowTitle(self.item_detail['displayname'])
        except (KeyError, IndexError) as err:
            QMessageBox().critical(
                self, 'Loading Error',
                'Time out or Item did not exists.\nTry to reload again.\n{}'.
                format(err))
            self.refreshBtn.setEnabled(True)
            return
        # icon handle
        pixicon = eq2s_func.get_pixmap_in_db(self.item_detail['iconid'])
        ticon = QIcon()
        ticon.addPixmap(pixicon)
        self.setWindowIcon(ticon)
        self.item_icon_label.setPixmap(pixicon)
        # set item name header
        name = '<h2><b>{}</b></h2><br>'.format(self.item_detail['displayname'])
        self.item_name_label.setText(name)

        # info start cook
        textInfo = eq2s_func.CookItemText(self.item_detail)

        # set to label
        self.item_detail_label.setText(textInfo.text)

        # buttons contorl
        self.dico_btn.setEnabled(True)
        if textInfo.has_set:
            self.sets_btn.setHidden(False)
        if 'typeinfo' in self.item_detail.keys():
            if 'item_list' in self.item_detail['typeinfo'].keys():
                self.contains_btn.setHidden(False)
        self.favorBtn.setEnabled(True)
        self.refreshBtn.setEnabled(True)
示例#8
0
 def fill_contains_table(self, contains_obj):
     try:
         for r, t in enumerate(contains_obj['item_list']):
             icon = QTableWidgetItem()
             ticon = QIcon()
             ticon.addPixmap(eq2s_func.get_pixmap_in_db(t['iconid']))
             icon.setIcon(ticon)
             nm = QTableWidgetItem(t['displayname'])
             nm.setTextAlignment(Qt.AlignCenter)
             nm.setData(1, str(t['id']))
             nm.setToolTip('Click for detail.')
             rlv = QTableWidgetItem(str(t['leveltouse']))
             rlv.setTextAlignment(Qt.AlignCenter)
             tier = QTableWidgetItem(t['tier'])
             tier.setTextAlignment(Qt.AlignCenter)
             tp = QTableWidgetItem(t['type'])
             tp.setTextAlignment(Qt.AlignCenter)
             slot_text = ''
             try:
                 for s in t['slot_list']:
                     slot_text += s['name']
             except KeyError:
                 pass
             slot = QTableWidgetItem(slot_text)
             slot.setTextAlignment(Qt.AlignCenter)
             self.containsTable.setItem(r, 0, icon)
             self.containsTable.setItem(r, 1, nm)
             self.containsTable.setItem(r, 2, rlv)
             self.containsTable.setItem(r, 3, tier)
             self.containsTable.setItem(r, 4, tp)
             self.containsTable.setItem(r, 5, slot)
         self.containsTable.resizeColumnsToContents()
     except BaseException as err:
         QMessageBox().critical(self, 'Result Error',
                                'Try again.\n{}'.format(err))
         return
示例#9
0
    def build_aa_layout(self, pak):
        trees_id = self.get_tree_tabs(pak)
        trees_info = eq2s_func.get_db_content('aatree', 'id', trees_id)
        self.aa_maxpoints = {}
        self.aa_clickedpoints = {}
        self.aa_points_display = {}
        # store aa tabs
        self.aa_tables = {}
        tradeskilltabs = []
        # adventure tabs
        for each in sorted(trees_id):
            name = trees_info[each]['name']
            # store all tradeskill aa tab into a list, and make all of them next to adventure tabs.
            if name in ['Tradeskill', 'General', 'Far Seas']:
                tradeskilltabs.append(each)
                continue
            # jumping to tabs creating function
            tab = self.create_tabs(each)
            self.aa_maxpoints[each] = trees_info[each][
                'maxpointsperlevelnode_list'][-1]['maxpoints']
            self.aa_clickedpoints[each] = 0
            self.aa_points_display[each].setText('{} / {}'.format(
                self.aa_clickedpoints[each], self.aa_maxpoints[each]))
            self.tab_widget.addTab(tab, name)
        # tradeskill tabs
        for each in tradeskilltabs:
            tab = self.create_tabs(each)
            self.aa_maxpoints[each] = trees_info[each][
                'maxpointsperlevelnode_list'][-1]['maxpoints']
            self.aa_clickedpoints[each] = 0
            self.aa_points_display[each].setText('{} / {}'.format(
                self.aa_clickedpoints[each], self.aa_maxpoints[each]))
            self.tab_widget.addTab(tab, trees_info[each]['name'])

        self.splnodes = {}
        # construct the aa layout
        try:
            for e1 in trees_info:
                grid_n = eq2s_func.get_aa_tree_grid_modifier(
                    trees_info[e1]['name'])
                for e2 in trees_info[e1]['alternateadvancementnode_list']:
                    epicon = QTableWidgetItem()
                    epicon.setFont(QFont("Times", 15, QFont.Black))
                    # get the crc group spells from local databases, cuz only one target provide,
                    # so I just extract the only list from the returned dict.
                    crcs = eq2s_func.get_db_content(
                        'crcspl', 'crc', (e2['spellcrc'], ))[e2['spellcrc']]
                    # this dict intend to save ordered level(tier) crc spells, the keys means tier of this spell.
                    crcdict = {}
                    for each in crcs:
                        crcdict[each['tier']] = each
                    epicon.setData(1000, crcdict)
                    self.splnodes[e2['nodeid']] = epicon
                    epicon.setToolTip(eq2s_func.CookSpellText(crcs[0]))
                    icon = QIcon()
                    iconid = epicon.data(1000)[1]['icon']['id']
                    # backiconid = epicon.data(1000)[0]['icon']['backdrop']
                    icon.addPixmap(
                        eq2s_func.get_pixmap_in_db(iconid, 'spellicons'))
                    # epicon.setBackground(QBrush(eq2s_func.get_pixmap_in_db(backiconid, 'spellicons')))
                    epicon.setIcon(icon)
                    self.aa_tables[e1].setItem(
                        int(e2['ycoord'] * grid_n['y'] + 1),
                        int(e2['xcoord'] * grid_n['x'] + 1), epicon)
        except BaseException as err:
            QMessageBox().critical(self, 'Loading Error',
                                   'Something Bad Happen:\n{}'.format(err))
            print(err)
            return

        self.fresh_tables()
        self.throw_aas(pak)
示例#10
0
    def item_result_received(self, rst, apd=True):
        if apd:
            self.itemHistory.append(rst)
        if self.itemSearchTag:
            self.item_previous_btn.setEnabled(True)
        try:
            rows = len(rst['item_list'])
            # display the result into table
            if rows == 0:
                QMessageBox().warning(
                    self, 'Loading Error',
                    'Time out or Data did not exists\nTry again.')
                self.item_find_btn.setEnabled(True)
                return
        except KeyError:
            QMessageBox().warning(
                self, 'Loading Error',
                'Time out or Data did not exists\nTry again.')
            self.item_find_btn.setEnabled(True)
            return
        # set the table rows
        self.item_result_table.setRowCount(rows)
        # connect the table items to a function

        try:
            for r, t in enumerate(rst['item_list']):
                icon = QTableWidgetItem()
                ticon = QIcon()
                ticon.addPixmap(eq2s_func.get_pixmap_in_db(t['iconid']))
                icon.setIcon(ticon)
                nm = QTableWidgetItem(t['displayname'])
                nm.setTextAlignment(Qt.AlignCenter)
                nm.setData(1001, t['id'])
                nm.setToolTip('Click for detail.')
                rlv = QTableWidgetItem(str(t['leveltouse']))
                rlv.setTextAlignment(Qt.AlignCenter)
                tier = QTableWidgetItem(t['tier'])
                tier.setTextAlignment(Qt.AlignCenter)
                tp = QTableWidgetItem(t['type'])
                tp.setTextAlignment(Qt.AlignCenter)
                slot_text = ''
                try:
                    for s in t['slot_list']:
                        slot_text += s['name'] + ' '
                except KeyError:
                    pass
                slot = QTableWidgetItem(slot_text)
                self.item_result_table.setItem(r, 0, icon)
                self.item_result_table.setItem(r, 1, nm)
                self.item_result_table.setItem(r, 2, rlv)
                self.item_result_table.setItem(r, 3, tier)
                self.item_result_table.setItem(r, 4, tp)
                self.item_result_table.setItem(r, 5, slot)
            self.item_result_table.horizontalHeader().setSectionResizeMode(
                0, QHeaderView.ResizeToContents)
            self.item_result_table.horizontalHeader().setSectionResizeMode(
                1, QHeaderView.ResizeToContents)
            self.item_result_table.horizontalHeader().setSectionResizeMode(
                2, QHeaderView.ResizeToContents)
        except BaseException as err:
            QMessageBox().critical(self, 'Result Error',
                                   'Try again.\n{}'.format(err))
            self.item_find_btn.setEnabled(True)
            return
        self.item_find_btn.setEnabled(True)