Example #1
0
class VentanaFiltrar(QDialog):
    def __init__(self, padre):
        super(VentanaFiltrar, self).__init__(padre)
        self.inicializar()
    
    def inicializar(self):
        self.titulo = QLabel("SELECCIONE EL FILTRO A APLICAR", self)
        self.titulo.move(50,50)
        self.titulo.adjustSize()
        
        self.filtros = QComboBox(self)
        self.filtros.move(100,100)
        self.filtros.sizeAdjustPolicy()
        self.filtros.addItem("Low pass filter")
        self.filtros.addItem("High pass filter")
        self.filtros.addItem("Gaussian filter")
        self.filtros.addItem("Pyramidal filter")
        self.filtros.addItem("Sinc filter")
        
        self.seleccionar = QPushButton("Seleccionar imagen", self)
        self.seleccionar.move(100,200)
        self.seleccionar.clicked.connect(self.filtrar)
        self.setWindowTitle("Filtrar una imagen")
        self.resize(300,300)
        self.setWindowModality(1)
        self.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed)
        self.show()
        
    def filtrar(self):
        archivo = QFileDialog(self)
        ruta = archivo.getOpenFileName(self, 'Seleccionar imagen', '', "Images (*.png *.gif *.jpg *.bmp)")
        if not ruta.isEmpty():
            try:
                from core import filtrar
                img = filtrar(str(ruta), str(self.filtros.currentText()))
                ruta1 = archivo.getSaveFileName(self, "Guardar imagen", '', "Images (*.png *.gif *.jpg *.bmp)")
                img.save(str(ruta1) + ".png")
            except ImportError:
                resp = QMessageBox.information(self, 'Error', 'Hubo un error inesperado', 
                                        QMessageBox.Ok, QMessageBox.NoButton)
        else:
            resp = QMessageBox.information(self, 'Error', 'No ha elegido imagenes', 
                                        QMessageBox.Ok, QMessageBox.NoButton)
Example #2
0
class mainUI(QWidget):

    def __init__(self):
        super(mainUI, self).__init__()
        self.btn_browse = QPushButton('Browse',self)
        self.btn_run = QPushButton('Run',self)
        self.lvd_dd = QComboBox(self)
        self.lvsub_dd = QComboBox(self)
        self.lid_dd = QComboBox(self)
        self.lisub_dd = QComboBox(self)
        self.lvd = QLabel('Vd' ,self)
        self.lvsub = QLabel('Vsub', self)
        self.lid = QLabel('Id', self)
        self.lisub = QLabel('Isub', self)
        self.la_vd = QLabel('Step', self)
        self.ln_vd_step = QLineEdit(self)
        self.initUI()

    def initUI(self):
        self.btn_browse.move(60,20)
        self.btn_browse.clicked.connect(self.showFolderDialog)

        self.btn_run.move(60,220)
        self.btn_run.clicked.connect(self.run)
        self.btn_run.setEnabled(False)

        self.lvd.move(38, 64)
        self.lvd_dd.setEditable(True)
        self.lvd_dd.addItems('none x y'.split())
        self.lvd_dd.move(60, 60)

        self.la_vd.move(150, 64)
        self.ln_vd_step.move(180, 60)
        self.ln_vd_step.resize(50,20)

        self.lvsub.move(38, 104)
        self.lvsub_dd.setEditable(True)
        self.lvsub_dd.addItems('none x y'.split())
        self.lvsub_dd.move(60, 100)

        self.lid.move(38, 144)
        self.lid_dd.setEditable(True)
        self.lid_dd.addItems('none x y'.split())
        self.lid_dd.move(60, 140)

        self.lisub.move(38, 184)
        self.lisub_dd.setEditable(True)
        self.lisub_dd.addItems('none x y'.split())
        self.lisub_dd.move(60, 180)

        # self.btn_save = QPushButton('Save', self)
        # self.btn_save.move(60, 100)
        # self.btn_save.clicked.connect(self.save)
        # self.btn_save.setEnabled(False)

        self.setGeometry(300,300,300,260)
        self.setWindowTitle('SnapBack')
        self.show()

    def showFolderDialog(self):
        global filelist
        index = 0
        basex = 60
        basey = 60
        try:
            filelist = QFileDialog.getOpenFileNames(self,'Select Files')
            self.btn_run.setEnabled(True)
            # print(os.path.dirname(os.path.realpath(filelist[0])))
            os.chdir(os.path.dirname(os.path.realpath(filelist[0])))
            # self.chk = QCheckBox('test',self)
            # self.chk.move(basex, basey)
            # self.chk.toggle()
            # self.show()
            # for item in filelist:
            #     basey = basey + (index + 1) * 40
                # self.addchkbox(item, basex, basey)
            # self.update()
            # print(filelist)
        except:
            print(sys.exc_info()[0])

    # def addchkbox(self, item, basex, basey):
    #     base = os.path.basename(item)
    #     l = os.path.splitext(base)[0]
    #     chk = QCheckBox(l,self)
    #     chk.move(basex, basey)
    #     chk.toggle()
        # print(basex)
        # print(basey)

    def run(self):
        global filelist
        # print(filelist)
        # newlist = list(map(self.xtr_plot,filelist))
        if filelist == []:
            QMessageBox.information(self,'Warning', 'Nothing to plot')
            return
        elif self.ln_vd_step.text() == '':
            QMessageBox.information(self, 'Warning', 'Please input step')
            return
        else:
            l_plot = []
            c_plot = []
            if self.lvd_dd.currentText() != 'none':
                l_plot.append('V3')
                c_plot.append(self.lvd_dd.currentText())
            if self.lid_dd.currentText() != 'none':
                l_plot.append('I3')
                c_plot.append(self.lid_dd.currentText())
            if self.lvsub_dd.currentText() != 'none':
                l_plot.append('V1')
                c_plot.append(self.lvsub_dd.currentText())
            if self.lisub_dd.currentText() != 'none':
                l_plot.append('I1')
                c_plot.append(self.lisub_dd.currentText())
            # print(l_plot)
            plt.ion()
            # fig = plt.figure()
            # ax = fig.add_subplot(111)
            # ax.minorticks_on()
            # ax.set_title("Id Vs Vd")
            # ax.set_xlabel('Vd(V)')
            # ax.set_ylabel('Id(A)')
            # ax.yaxis.set_major_formatter(mtick.FormatStrFormatter('%.2e'))
            # ax.xaxis.set_minor_formatter(mtick.FormatStrFormatter('%.2f'))
            # ax.xaxis.set_minor_locator(mtick.AutoMinorLocator(2))
            # ax.yaxis.set_minor_formatter(mtick.FormatStrFormatter('%.2e'))
            # ax.yaxis.set_minor_locator(mtick.AutoMinorLocator(2))
            #
            # ax.grid(b=True, which='major', color='black', linestyle='-')
            # ax.grid(b=True, which='minor', color='r', linestyle='--')
            # i = 1
            for file in filelist:
                self.xtr_plot(file, l_plot, c_plot)
                # i = i + 1
            # plt.legend()
            # plt.show()
            # print(newlist)
            # self.btn_save.setEnabled(True)
            filelist = []
            return

    def closeEvent(self, QCloseEvent):
        plt.ioff()
        plt.close()
        QApplication.quit()
        sys.exit()

    def xtr_plot(self, item, l_plot, c_plot):
        # print(item)
        data1 = []
        i = 0
        with open(item) as f:
            data = f.read()
        data = data.split('\n')
        # print(data)
        for x in data:
            # if i > 2:
            data1.append(x)
            # i += 1
        i = 0
        while True:
            if '' in data1:
                data1.remove('')
            else:
                break
        del data[:]
        temp = []
        for i in range(0,len(data1)):
            if "NO." in data1[0]:
                temp = data1[0].split('\t')
                del data1[0:2]
                break
            else:
                data1.remove(data1[0])
        x = []
        y = []
        y.append([])
        y.append([])
        for s in l_plot:
            i = temp.index(s)
            # print(i)
            if s == 'V3':
                x = [row.split("\t")[i] for row in data1]
            elif s == 'V1':
                x = [row.split("\t")[i] for row in data1]
            elif s == 'I3':
                y[0] = [row.split("\t")[i] for row in data1]
            elif s == 'I1':
                y[1] = [row.split("\t")[i] for row in data1]
        i = 0

        for s in x:
            s = s.replace("V","")
            s = s.replace(" ","")
            if "f" in s:
                s = s.replace("f","")
                num = float(s)/1000000000000000
            elif "p" in s:
                s = s.replace("p","")
                num = float(s)/1000000000000
            elif "n" in s:
                s = s.replace("n","")
                num = float(s)/1000000000
            elif "u" in s:
                s = s.replace("u","")
                num = float(s)/1000000
            elif "m" in s:
                s = s.replace("m","")
                num = float(s)/1000
            else:
                num = float(s)
            x[i] = num
            i += 1
        # print(x)
        i = 0
        m = 0
        for s in y:
            # print(s)
            if s != []:
                for s1 in s:
                    s1 = s1.replace("A","")
                    s1 = s1.replace(" ","")
                    if "f" in s1:
                        s1 = s1.replace("f","")
                        num = float(s1)/1000000000000000
                    elif "p" in s1:
                        s1 = s1.replace("p","")
                        num = float(s1)/1000000000000
                    elif "n" in s1:
                        s1 = s1.replace("n","")
                        num = float(s1)/1000000000
                    elif "u" in s1:
                        s1 = s1.replace("u","")
                        num = float(s1)/1000000
                    elif "m" in s1:
                        s1 = s1.replace("m","")
                        num = float(s1)/1000
                    else:
                        num = float(s1)
                    y[m][i] = num
                    i += 1
                i = 0
            # print(m)
            # print(y[m])
            m += 1
        i = 0
        m = 0
        base = os.path.basename(item)
        l = os.path.splitext(base)[0]
        l = l.replace('T','')
        w_title = ' '.join(['Vg =', str(int(l)-1),'V'])
        # # print(Vd)
        # # print(Id)
        # print(y[0])
        # print(y[1])
        index = len(x)
        step = int(self.ln_vd_step.text())
        Vsub_step = 100
        cols = 5
        nrows = math.ceil(index/step/5)
        fig, ax = plt.subplots(nrows, cols)
        fig.canvas.set_window_title(w_title)
        ax_row = 0
        ax_col = 0
        max_I = max(y[0])
        if max_I < max(y[1]):
            max_I = max(y[1])
        min_I = min(y[0])
        if min_I > min(y[1]):
            min_I = min(y[0])
        max_V = max(x)
        min_V = min(x)
        Vsub = 0
        while True:
            # ax[ax_row][ax_col] = fig.add_subplot(111)
            # ax[ax_row][ax_col].minorticks_on()
            # ax[ax_row][ax_col].set_title("Id Vs Vd")
            ax[ax_row][ax_col].set_xlabel('Vd(V)')
            ax[ax_row][ax_col].set_ylabel('I(A)')
            ax[ax_row][ax_col].yaxis.set_major_formatter(mtick.FormatStrFormatter('%.2e'))
            # ax[ax_row][ax_col].xaxis.set_minor_formatter(mtick.FormatStrFormatter('%.2f'))
            # ax[ax_row][ax_col].xaxis.set_minor_locator(mtick.AutoMinorLocator(2))
            # ax[ax_row][ax_col].yaxis.set_minor_formatter(mtick.FormatStrFormatter('%.2e'))
            # ax[ax_row][ax_col].yaxis.set_minor_locator(mtick.AutoMinorLocator(2))

            # ax[ax_row][ax_col].grid(b=True, which='major', color='black', linestyle='--')
            # ax[ax_row][ax_col].grid(b=True, which='minor', color='red', linestyle='--')
            m += step
            x_temp = x[i:m]
            ax[ax_row][ax_col].set_autoscale_on(False)
            title = ' '.join(['Vsub=', str(Vsub/1000), 'V'])
            ax[ax_row][ax_col].set_title(title)
            if y[0] != []:
                y_temp = y[0][i:m]
                ax[ax_row][ax_col].plot(x_temp, y_temp, color='red',label='Id')
                # ax[ax_row][ax_col].plot(x_temp, y_temp)
                ax[ax_row][ax_col].set_ylim([min_I*1.1, max_I*1.1])
                ax[ax_row][ax_col].set_xlim([min_V, max_V*1.1])
            if y[1] != []:
                y_temp = y[1][i:m]
                ax[ax_row][ax_col].plot(x_temp, y_temp, color='green',label='Isub')
                # ax[ax_row][ax_col].plot(x_temp, y_temp)
                ax[ax_row][ax_col].set_ylim([min_I*1.1, max_I*1.1])
                ax[ax_row][ax_col].set_xlim([min_V, max_V*1.1])
            # plt.legend()
            ax[ax_row][ax_col].legend(prop={'size':10})
            plt.show()
            i = m
            ax_col += 1
            Vsub += Vsub_step
            if ax_col >= cols:
                ax_col = 0
                ax_row += 1
            if i >= index:
                break
class Panel(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.clean_up_queue = []
        self.summoner = SummonerData()
        self.summoner.getStaticData()

        ### Search Bar ###
        ##################

        #label
        self.search_label = QLabel(self)
        self.search_label.move(20, 15)
        self.search_label.resize(220, 25)
        self.search_label.setText('Enter summoner name(s):')
        self.search_label.setStyleSheet("QLabel {font:14pt}")

        #text field
        self.search_field = QLineEdit(self)
        self.search_field.move(260, 15)
        self.search_field.resize(250, 25)
        self.search_field.setPlaceholderText("ex: mcnuggets, teltor, ...")
        self.search_field.setFocusPolicy(Qt.ClickFocus)

        #search button
        self.search_button = QPushButton(self)
        self.search_button.move(520, 15)
        self.search_button.resize(150, 25)
        self.search_button.setText('Search Summoner')

        #region combobox
        self.region_list = QComboBox(self)
        self.region_list.move(680, 15)
        self.region_list.resize(75, 25)
        regions = ['NA', 'LAN', 'BR', 'LAS', 'EUW', 'EUNE', 'TR', 'RU', 'OCE']
        self.region_list.addItems(regions)

        #error label
        self.error_label = QLabel(self)
        self.error_label.move(775, 15)
        self.error_label.resize(160, 25)
        self.error_label.setStyleSheet("QLabel {font:14pt}")

        ### Summoner Information ###
        ############################

        #summoner Icon label
        self.icon_label = QLabel(self)
        self.icon_label.setScaledContents(True)
        self.icon_label.move(260, 50)
        self.icon_label.resize(110, 110)

        #name label
        self.name_label = QLabel(self)
        self.name_label.move(380, 50)
        self.name_label.resize(620, 50)
        self.name_label.setText('SUMMONER NAME')
        self.name_label.setStyleSheet("QLabel {font:32pt}")

        #rank label
        self.rank_label = QLabel(self)
        self.rank_label.move(380, 100)
        self.rank_label.resize(200, 60)
        self.rank_label.setText('summoner rank')
        self.rank_label.setStyleSheet("QLabel {font:18pt}")

        #miniseries labels
        self.series_labels = {}
        self.pixmap_win = QPixmap()
        self.pixmap_loss = QPixmap()
        self.pixmap_n = QPixmap()
        self.pixmap_win.load("./images/win.png")
        self.pixmap_loss.load("./images/loss.png")
        self.pixmap_n.load("./images/n.png")
        xPos = 600
        for x in range(5):
            match_label = QLabel(self)
            match_label.move(xPos, 120)
            match_label.resize(35, 35)
            match_label.setScaledContents(True)
            match_label.hide()
            self.series_labels[x] = match_label
            xPos += 40

        #mastery image labels
        print 'loading mastery images ...'
        self.ferocity_tree_images = self.getMasteryImages(
            self.summoner.ferocityMasteryTree())
        self.cunning_tree_images = self.getMasteryImages(
            self.summoner.cunningMasteryTree())
        self.resolve_tree_images = self.getMasteryImages(
            self.summoner.resolveMasteryTree())
        print 'Done'

        #champion icon image labels
        print 'loading champion icon images ...'
        self.championIcons = self.getChampionIconImages(
            self.summoner.championList())
        print 'Done'

        #overview widget
        self.overview_widget = QWidget()
        self.overview_menu = QTabWidget(self.overview_widget)
        self.overview_menu.resize(720, 270)

        #runes widget
        self.runes_widget = QWidget()
        self.runes_menu = QTabWidget(self.runes_widget)
        self.runes_menu.resize(720, 270)

        #masteries widget
        self.masteries_widget = QWidget()
        self.masteries_menu = QTabWidget(self.masteries_widget)
        self.masteries_menu.resize(720, 270)

        #summoner menu
        self.menu = QTabWidget(self)
        self.menu.move(260, 180)
        self.menu.resize(720, 300)
        self.menu.addTab(self.overview_widget, "Overview")
        self.menu.addTab(self.runes_widget, "Runes")
        self.menu.addTab(self.masteries_widget, "Masteries")
        self.menu.hide()

        #summoners buttons
        self.button_list = {}
        yPos = 150
        for x in range(10):
            sum_button = QPushButton(self)
            sum_button.move(50, yPos)
            sum_button.resize(150, 25)
            sum_button.hide()
            self.button_list[x] = sum_button
            yPos += 25

        ### Connecting Widgets ###
        ##########################

        self.connect(self.search_button, QtCore.SIGNAL("clicked()"),
                     self.getData)
        self.connect(self.search_button, QtCore.SIGNAL("clicked()"),
                     self.getRankedData)
        self.connect(self.button_list[0], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[0].text())))
        self.connect(self.button_list[1], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[1].text())))
        self.connect(self.button_list[2], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[2].text())))
        self.connect(self.button_list[3], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[3].text())))
        self.connect(self.button_list[4], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[4].text())))
        self.connect(self.button_list[5], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[5].text())))
        self.connect(self.button_list[6], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[6].text())))
        self.connect(self.button_list[7], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[7].text())))
        self.connect(self.button_list[8], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[8].text())))
        self.connect(self.button_list[9], QtCore.SIGNAL("clicked()"),
                     lambda: self.displayData(str(self.button_list[9].text())))

        ### Window Configuration ###
        ############################

        #window settings
        self.setGeometry(200, 150, 1000, 500)
        self.setMaximumSize(1000, 500)
        self.setWindowTitle('summoner App')

        self.show()

    ### GUI methods ###
    ###################

    ############### GUI get methods ###############

    #get data related to given summoner names
    def getData(self):
        self.cleanUp()
        name_list = str(self.search_field.text()).replace(
            ' ', '').lower().split(',')
        region = str(self.region_list.currentText()).lower()
        if name_list != ['']:
            try:
                self.summoner.getSummonerData(name_list, region)
                for x in range(len(name_list)):
                    sum_name = self.summoner.getName(name_list[x])
                    if sum_name != None:
                        self.button_list[x].setText(sum_name)
                        self.clean_up_queue.append(self.button_list[x])
                    else:
                        self.button_list[x].setText(name_list[x])
                        self.clean_up_queue.append(self.button_list[x])
                        self.button_list[x].setEnabled(False)
                    self.button_list[x].show()
            except RiotError as e:
                response = e.message
                print response
                if response == 'ServiceUnavailable':
                    self.error_label.setText(response)
                elif response == '429':
                    self.error_label.setText('Rate limit reached')
                elif response == 'InternalServerError':
                    self.error_label.setText(response)
                elif response == 'Unauthorized':
                    self.error_label.setText('Invalid Input')
                elif response == 'ServerError':
                    self.error_label.setText(response)
                else:
                    self.error_label.setText('Not Found')
            except KeyError as k:
                self.error_label.setText('Invalid Input')

    #get summoner ranked data
    def getRankedData(self):
        if str(self.search_field.text()) != '':
            region = str(self.region_list.currentText()).lower()
            try:
                self.summoner.getRankedData(region)
            except RiotError:
                print 'Rank info not found'

    #get mastery images
    def getMasteryImages(self, masteryList):
        pixmap_list = collections.OrderedDict()
        empty_spaces = 0
        for row in masteryList:
            if len(row['masteryTreeItems']) == 2:
                #if len(row) == 3:
                row['masteryTreeItems'].append(None)
                #row.append(None)
            for element in row['masteryTreeItems']:
                #for element in row:
                if element != None:
                    pixmap = QPixmap()
                    pixmap.loadFromData(
                        self.summoner.getImage(
                            'mastery',
                            str(element['masteryId']) + '.png'))
                    pixmap_list[element['masteryId']] = pixmap
                else:
                    pixmap_list['null' + str(empty_spaces)] = None
                    empty_spaces += 1
        return pixmap_list

    #get champion icon images
    def getChampionIconImages(self, clist):
        pixmap_list = {}
        for champ in clist.values():
            pixmap = QPixmap()
            pixmap.loadFromData(
                self.summoner.getImage('champion', champ['key'] + '.png'))
            pixmap_list[champ['name']] = pixmap
        return pixmap_list

    ############### GUI update methods ###############

    #removes previous data from GUI
    def cleanUp(self):
        self.error_label.setText("")
        #clears summoner info
        self.icon_label.setPixmap(QPixmap())
        self.icon_label.setStyleSheet("QLabel {}")
        self.name_label.setText("")
        self.rank_label.setText("")
        #hides elements in clean up queue
        for x in self.clean_up_queue:
            x.hide()
            x.setEnabled(True)

    #display data
    def displayData(self, buttonName):
        sum_ID = self.summoner.getID(buttonName)
        self.displayIcon(buttonName.replace(' ', '').lower())
        self.name_label.setText(buttonName)
        self.displayRank(sum_ID)
        self.displayMenu(sum_ID)

    #display summoner icon
    def displayIcon(self, summoner_name):
        iconName = self.summoner.getIcon(summoner_name)
        iconPixmap = QPixmap()
        self.icon_label.setStyleSheet(
            "QLabel {border-style: outset; border-width: 3px; border-color: gold}"
        )
        try:
            iconPixmap.loadFromData(
                self.summoner.getImage('profileicon', iconName))
            self.icon_label.setPixmap(iconPixmap)
        except RiotError:
            iconPixmap.load("./images/no_image.png")
            self.icon_label.setPixmap(iconPixmap)

    #display summoner rank
    def displayRank(self, sumID):
        for x in range(len(self.series_labels)):
            self.series_labels[x].setPixmap(QPixmap())
        try:
            tier = self.summoner.getTier(sumID)
            division = self.summoner.getDivision(sumID)
            points = self.summoner.getLeaguePoints(sumID)
            self.rank_label.setText(tier + ': ' + division + '\n' +
                                    str(points) + ' league points')
            if points == 100:
                self.displayMiniseries(sumID)
        except KeyError:
            self.rank_label.setText('UNRANKED')

    #display promotion series
    def displayMiniseries(self, sumID):
        progress = self.summoner.getRankSeries(sumID)
        i = 0
        for x in progress:
            if x == 'W':
                self.series_labels[i].setPixmap(self.pixmap_win)
            elif x == 'L':
                self.series_labels[i].setPixmap(self.pixmap_loss)
            else:
                self.series_labels[i].setPixmap(self.pixmap_n)
            self.clean_up_queue.append(self.series_labels[i])
            self.series_labels[i].show()
            i += 1

    #display summoner menu
    def displayMenu(self, sumID):
        self.displayOverviewMenu(sumID)
        self.displayRuneMenu(sumID)
        self.displayMasteryMenu(sumID)
        self.clean_up_queue.append(self.menu)
        self.menu.show()

    #display overview menu
    def displayOverviewMenu(self, sumID):
        self.overview_menu.clear()

        overview_normal = OverviewWidget()
        overview_ranked_solo = OverviewWidget()
        overview_ranked_team = OverviewWidget()
        overview_champions = ChampionsWidget()

        overview_normal.showStats(self.summoner.getStats(sumID, 'Normal'))
        overview_ranked_solo.showStats(
            self.summoner.getStats(sumID, 'Ranked Solo'))
        overview_ranked_team.showStats(
            self.summoner.getStats(sumID, 'Ranked Team'))
        overview_champions.showStats(self.summoner.getChampionStats(sumID),
                                     self.championIcons)

        self.overview_menu.addTab(overview_normal, 'Normal')
        self.overview_menu.addTab(overview_ranked_solo, 'Ranked Solo')
        self.overview_menu.addTab(overview_ranked_team, 'Ranked Team')
        self.overview_menu.addTab(overview_champions, 'Champions')

    #display rune menu
    def displayRuneMenu(self, sumID):
        self.runes_menu.clear()
        for x in range(self.summoner.getNumOfRunePages(sumID)):
            rune_page = RuneWidget()
            rune_page.setSize(700, 225)
            rune_page.setName(self.summoner.getRunePageName(sumID, x))
            rune_data = self.summoner.getRunes(sumID, x)
            if rune_data != None:
                for y in rune_data:
                    rid = self.summoner.getRuneID(y)
                    desc = self.summoner.runeDescription(rid)
                    rname = self.summoner.runeName(rid)
                    rune_page.addRune(rid, desc, rname)
                rune_page.showRunes()
            self.runes_menu.addTab(rune_page, str(x + 1))

    #display mastery menu
    def displayMasteryMenu(self, sumID):
        self.masteries_menu.clear()
        for x in range(self.summoner.getNumOfMasteryPages(sumID)):
            mastery_page = MasteryWidget()
            mastery_page.setMasteryLabels(self.ferocity_tree_images,
                                          self.cunning_tree_images,
                                          self.resolve_tree_images)
            mastery_page.setName(self.summoner.getMasteryPageName(sumID, x))
            mastery_data = self.summoner.getMasteries(sumID, x)
            if mastery_data != None:
                for y in mastery_data:
                    mid = self.summoner.getMasteryID(y)
                    rank = self.summoner.getMasteryRank(y)
                    mastery_page.setMasteryRank(mid, rank)
            mastery_page.setTotalPoints()
            self.masteries_menu.addTab(mastery_page, str(x + 1))
Example #4
0
    def initUI(self):

        user = QLabel(u'用户', self)
        pwd = QLabel(u'密码', self)
        userEdit = QLineEdit(self)
        pwdEdit = QLineEdit(self)
        loginB = QPushButton(u'登 录', self)
        userEdit.move(40, 37)
        userEdit.setText('18815286582')
        user.move(10, 40)
        pwd.move(180, 40)
        pwdEdit.move(210, 37)
        pwdEdit.setText('ceshi123456')
        loginB.move(500, 35)
        print userEdit.size()
        userEdit.setBaseSize(QSize(100, 40))

        entrustLab = QLabel(self)
        entrustLab.setText(u'委托')
        entrustLab.setFont()
        entrustLab.move(10, 65)
        rentTypeCombo = QComboBox(self)
        rentTypeCombo.addItem(u'整租')
        rentTypeCombo.addItem(u'合租')
        rentTypeCombo.move(10, 90)
        apartmentTypeCombo = QComboBox(self)
        apartmentTypeCombo.addItem(u'品牌')
        apartmentTypeCombo.addItem(u'品质')
        apartmentTypeCombo.move(65, 90)

        # 头部
        self.titlelab = labelBtn2()
        self.titlelab.setParent(self)
        self.titlelab.setGeometry(-1, -1, 748, 36)
        self.titlelab.setPixmap(
            QPixmap("C:\Users\user\Desktop\myimg\ltitle.png"))
        # logo
        self.loglab = QLabel()
        self.loglab.setParent(self)
        self.loglab.setGeometry(2, -2, 36, 36)
        self.loglab.setPixmap(QPixmap("C:\Users\user\Desktop\myimg\mlogo.png"))
        # 关闭图标
        self.closelab = labelBtn1(2)
        self.closelab.setParent(self)
        self.closelab.setGeometry(774, -2, 27, 36)
        self.closelab.setPixmap(
            QPixmap("C:\Users\user\Desktop\myimg\closeb.png"))
        self.closelab.setToolTip(u"关闭")
        # 最小化
        self.minlab = labelBtn1(1)
        self.minlab.setParent(self)
        self.minlab.setGeometry(746, -2, 28, 36)
        self.minlab.setPixmap(QPixmap("C:\Users\user\Desktop\myimg\minb.png"))
        self.minlab.setToolTip(u"最小化")

        palette1 = QPalette()
        palette1.setColor(self.backgroundRole(), QColor(255, 255,
                                                        255))  # 设置背景颜色
        self.setPalette(palette1)
        self.setGeometry(300, 200, 800, 600)
        self.setWindowTitle(u'爱上租')
        self.setWindowFlags(Qt.FramelessWindowHint)  # 隐藏边框
        self.show()