Ejemplo n.º 1
0
    def set_style_sheet(cls):
        """设置样式"""
        # cls.query_button.setStyleSheet(WindowCons.button_style())
        cls.save_button.setStyleSheet(WindowCons.button_style())
        # cls.compute_button.setStyleSheet(WindowCons.button_style())
        cls.add_record.setStyleSheet(WindowCons.background_image())

        cls.title.setStyleSheet(WindowCons.LIGHT_BLUE_STYLE)
        cls.sale_num_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.share_name_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.sale_price_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.buy_date_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.win_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.buy_num_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.can_sale_num_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.have_num_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.share_code_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.buy_price_title.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.have_avg_price.setStyleSheet(WindowCons.WHITE_STYLE)
        cls.sale_date_title.setStyleSheet(WindowCons.WHITE_STYLE)
        # cls.text_edit.setAttribute(Qt.WA_TranslucentBackground, True)
        # cls.text_edit.repaint()
        cls.text_edit.setStyleSheet(WindowCons.TRANSPARENT)
        palette1 = QPalette()
        palette1.setBrush(
            cls.add_record.backgroundRole(),
            QBrush(QPixmap(':backgroud.png').scaled(cls.add_record.size())))
        cls.add_record.setPalette(palette1)
        cls.add_record.setStyleSheet(WindowCons.background_image())
Ejemplo n.º 2
0
    def View1(self):
        #Nueva vista 1
        palette = QPalette()
        palette.setBrush(
            QPalette.Background,
            QBrush(QPixmap(self.MAIN_VIEW).scaled(self.size_x, self.size_y)))
        self.ui.setPalette(palette)

        #Reinicio de las opciones
        self.unlock()
        red_btn = QPixmap(self.RED)
        self.ui.red_ranger.setPixmap(red_btn)
        blue_btn = QPixmap(self.BLUE)
        self.ui.blue_ranger.setPixmap(blue_btn)
        black_btn = QPixmap(self.BLACK)
        self.ui.black_ranger.setPixmap(black_btn)
        pink_btn = QPixmap(self.PINK)
        self.ui.pink_ranger.setPixmap(pink_btn)
        yellow_btn = QPixmap(self.YELLOW)
        self.ui.yellow_ranger.setPixmap(yellow_btn)

        self.firstTime = False

        self.promptTex = ""
        self.flag_Key = 3
        self.IsChecked = [['Red', False], ['Pink', False], ['Blue', False],
                          ['Black', False], ['Yellow', False]]
        self.ui.acepto_btn.setChecked(False)

        self.ui.setCurrentWidget(self.ui.View1)
Ejemplo n.º 3
0
 def initUI(self):
     # title
     title = QLabel(self)
     title.setText("User Instruction")
     title.setAlignment(Qt.AlignCenter)
     # user instruction
     groupBox = QGroupBox()
     text = QLabel(self)
     text.setText("Create image montages and histograms from the interface:\nChoose option No. 1 to 5 on main interface.\nClick Enter to select the paths for input and output locations.\nEnjoy using the interface!")
     self.setStyleSheet("QLabel { color: #8B4513; font-size: 16px;font-family: cursive, sans-serif;}")    
     title.setStyleSheet("QLabel { color: #8B4513; font-weight: 600;}")
     # set layout
     sbox = QVBoxLayout(self)
     sbox.addWidget(text)
     groupBox.setLayout(sbox) 
     vBoxLayout = QVBoxLayout()
     vBoxLayout.addSpacing(15)
     vBoxLayout.addWidget(title)
     vBoxLayout.addWidget(groupBox)
     vBoxLayout.addSpacing(15)
     self.setLayout(vBoxLayout)
     # set background as transparent
     palette	= QPalette()
     palette.setBrush(QPalette.Background,QBrush(QPixmap()))
     self.setPalette(palette)
Ejemplo n.º 4
0
    def View3(self):
        #Nueva vista 3
        palette = QPalette()
        palette.setBrush(
            QPalette.Background,
            QBrush(QPixmap(self.VIEW_3).scaled(self.size_x, self.size_y)))
        self.ui.setPalette(palette)

        #Acción Envía Vista 3
        self.ui.setCurrentWidget(self.ui.View3)

        if self.flag_Key == 3:
            #Vista 3
            self.ui.title_v3.move(int(self.size_x / 2 - self.t3x / 2),
                                  int(self.size_y / 9))
            self.ui.photo_ranger.move(int(self.size_x / 2 - self.fx / 2),
                                      int(self.size_y / 6))
            self.ui.name_v3.move(int(self.size_x / 2 - self.name_x / 2),
                                 int(self.size_y / 2 + 2 * self.name_y))
            self.ui.continue_btn_V3.move(int(self.size_x / 2 - self.c3x / 2),
                                         int(self.y_init_btn))

            #Vista 6
            self.ui.the_gif_validate.move(self.size_x + 1, self.size_y + 1)
            self.ui.title_V6.move(self.size_x + 1, self.size_y + 1)
            self.ui.acepto.move(self.size_x + 1, self.size_y + 1)
            self.ui.acepto_btn.move(self.size_x + 1, self.size_y + 1)
            self.ui.cancelar.move(self.size_x + 1, self.size_y + 1)

            for i in range(len(self.IsChecked)):
                if self.IsChecked[i][1] == True:
                    face_ranger = QPixmap(self.URL_FACES[i])
                    self.ui.photo_ranger.setPixmap(face_ranger)
                    break

        elif self.flag_Key == 5:
            #Vista 6
            #----------------------
            #Aqui se pone el gif :)
            self.ui.the_gif_validate.setMovie(self.movie)
            self.movie.start()
            #----------------------

            self.ui.the_gif_validate.move(
                int(self.size_x / 2 - self.gif2_x / 2), int(self.altura_gif2))
            self.ui.title_V6.move(int(self.size_x / 2 - self.mail_x / 2),
                                  int(self.altura_mail))
            self.ui.acepto.move(int(self.size_x / 2 - self.acepto_x / 2),
                                int(self.altura_acepto))
            self.ui.acepto_btn.move(int(0.26 * self.size_x),
                                    int(self.altura_acepto + 5))
            self.ui.continue_btn_V3.move(int(self.size_x / 2),
                                         int(self.y_init_btn))
            self.ui.cancelar.move(int(self.size_x / 25), int(self.y_init_btn))

            #Vista 3
            self.ui.title_v3.move(self.size_x + 1, self.size_y + 1)
            self.ui.photo_ranger.move(self.size_x + 1, self.size_y + 1)
            self.ui.name_v3.move(self.size_x + 1, self.size_y + 1)
Ejemplo n.º 5
0
    def createWidgets(self):
        """
        QtWidgets creation
        """
        self.mainTab = QTabWidget()
        mainLayout = QVBoxLayout()
    
        self.toRead = QLabel( "%s" % "Release notes are specific to each version of the server, SUT adapters, libraries and toolbox. More details on each HISTORY files."  )

        mainLayout.addWidget(self.toRead)
        mainLayout.addWidget(self.mainTab)

        palette = QPalette()
        brush = QBrush(QColor(240, 240, 240))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Active, QPalette.Base, brush)

        # treewidget for server rn
        self.rn = QTreeWidget(self)
        self.rn.setHeaderHidden(True)
        self.rn.setFrameShape(QFrame.NoFrame)
        self.rn.setSelectionMode(QAbstractItemView.NoSelection)
        self.rn.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.rn.setRootIsDecorated(False)
        self.rn.setPalette(palette)

        # treewidget for adapter rn
        self.rnAdp = QTreeWidget(self)
        self.rnAdp.setHeaderHidden(True)
        self.rnAdp.setFrameShape(QFrame.NoFrame)
        self.rnAdp.setSelectionMode(QAbstractItemView.NoSelection)
        self.rnAdp.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.rnAdp.setRootIsDecorated(False)
        self.rnAdp.setPalette(palette)

        # treewidget for library rn
        self.rnLibAdp = QTreeWidget(self)
        self.rnLibAdp.setHeaderHidden(True)
        self.rnLibAdp.setFrameShape(QFrame.NoFrame)
        self.rnLibAdp.setSelectionMode(QAbstractItemView.NoSelection)
        self.rnLibAdp.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.rnLibAdp.setRootIsDecorated(False)
        self.rnLibAdp.setPalette(palette)
        
        # treewidget for agent rn
        self.rnToolbox = QTreeWidget(self)
        self.rnToolbox.setHeaderHidden(True)
        self.rnToolbox.setFrameShape(QFrame.NoFrame)
        self.rnToolbox.setSelectionMode(QAbstractItemView.NoSelection)
        self.rnToolbox.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.rnToolbox.setRootIsDecorated(False)
        self.rnToolbox.setPalette(palette)

        self.mainTab.addTab( self.rn, Settings.instance().readValue( key = 'Common/acronym-server' )  )
        self.mainTab.addTab( self.rnAdp, "Sut Adapters" )
        self.mainTab.addTab( self.rnLibAdp, "Sut Librairies" )
        self.mainTab.addTab( self.rnToolbox, "Toolbox" )

        self.setLayout(mainLayout)
Ejemplo n.º 6
0
Archivo: scj.py Proyecto: Ptaah/SCJ
 def addLog(self, log):
     self.log.append(log)
     self.logbtn.show()
     palette = QPalette()
     brush = QBrush(QColor(240, 100, 100))
     brush.setStyle(Qt.SolidPattern)
     palette.setBrush(QPalette.Normal, QPalette.Background, brush)
     self.label.setPalette(palette)
     self.label.setAutoFillBackground(True)
Ejemplo n.º 7
0
    def View2(self):
        #Cambio de fondo vista 2
        palette = QPalette()
        palette.setBrush(
            QPalette.Background,
            QBrush(QPixmap(self.VIEW_2).scaled(self.size_x, self.size_y)))
        self.ui.setPalette(palette)

        self.ui.setCurrentWidget(self.ui.View2)
Ejemplo n.º 8
0
    def View6(self):
        #Pasamos a vista 6
        palette = QPalette()
        palette.setBrush(
            QPalette.Background,
            QBrush(QPixmap(self.VIEW_6).scaled(self.size_x, self.size_y)))
        self.ui.setPalette(palette)

        self.ui.setCurrentWidget(self.ui.View6)
        self.sendMail(self.GIF)
Ejemplo n.º 9
0
 def initUI(self):
     # local variable that records which radio button is clicked
     self.choice = 1
     # welcome message
     welcomeMsg = QLabel(self)
     welcomeMsg.setText("Welcome to the PyQt Interface!")
     welcomeMsg.setAlignment(Qt.AlignCenter)
     menu = QLabel(self)
     menu.setText("Menu")
     # create buttons & connect them with function btnClicked
     btn1 = QRadioButton(self)
     btn1.setText("1. Create montages recursively from given directory and sub-directories")
     btn1.setChecked(True)
     btn1.toggled.connect(lambda:self.btnClicked(1))        
     btn2 = QRadioButton(self)
     btn2.setText("2. Create montages from provided CSV files (split by categories or bins)")
     btn2.toggled.connect(lambda:self.btnClicked(2))
     btn3 = QRadioButton(self)
     btn3.setText("3. Create vertical montage from provided CSV file")
     btn3.toggled.connect(lambda:self.btnClicked(3))
     btn4 = QRadioButton(self)
     btn4.setText("4. Create image histogram from provided CSV file")
     btn4.toggled.connect(lambda:self.btnClicked(4))
     btn5 = QRadioButton(self)
     btn5.setText("5. Create scatter plot from provided CSV file")
     btn5.toggled.connect(lambda:self.btnClicked(5))
     quit = QPushButton(self)
     quit.setText("Quit")
     enter = QPushButton(self)
     enter.setText("Enter")
     instr = QPushButton(self)
     instr.setText("Instruction")
     self.setStyleSheet('QLabel {font-family: cursive, sans-serif; font-weight: 500; font-size: 16px; color: #A0522D;} QRadioButton {font-family: cursive, sans-serif; font-weight: 300; font-size: 16px; color: #8B4513;} QPushButton {font-family: cursive, sans-serif; font-weight: 500; font-size: 16px; color: #CD853F; }')
     welcomeMsg.setStyleSheet('QLabel {font-weight: 900;font-size: 20px;}')        
     # set layout
     mbox = QGridLayout(self)
     mbox.addWidget(welcomeMsg, 1, 1)
     mbox.addWidget(menu,2,1)
     mbox.addWidget(btn1,3,1)
     mbox.addWidget(btn2,4,1)
     mbox.addWidget(btn3,5,1)
     mbox.addWidget(btn4,6,1)
     mbox.addWidget(btn5,7,1)
     mbox.addWidget(quit,8,0)
     mbox.addWidget(enter,8,2)
     mbox.addWidget(instr,8,1)
     self.setLayout(mbox)
     # connect the click event with a function
     enter.clicked.connect(self.nextPage)
     quit.clicked.connect(self.close)
     instr.clicked.connect(self.instruction)
     # set background as transparent
     palette	= QPalette()
     palette.setBrush(QPalette.Background,QBrush(QPixmap()))
     self.setPalette(palette)       
Ejemplo n.º 10
0
    def __init__(self):
        super(MyDlg, self).__init__()
        uic.loadUi("./mydlg.ui", self)            #  加载ui文件  *****

        self.setGeometry(50,50,800,600)
        self.setAutoFillBackground(True)

        # 设置窗口背景
        pixmap = QPixmap(":/images/onepiece.jpg").scaled(self.size()) # 适应窗口大小
        palette = QPalette()
        palette.setBrush(QPalette.Window,QBrush(pixmap))
        self.setPalette(palette)
Ejemplo n.º 11
0
    def __init__(self):
        super(MyDlg, self).__init__()
        uic.loadUi("./mydlg.ui", self)  #  加载ui文件  *****

        self.setGeometry(50, 50, 800, 600)
        self.setAutoFillBackground(True)

        # 设置窗口背景
        pixmap = QPixmap(":/images/onepiece.jpg").scaled(self.size())  # 适应窗口大小
        palette = QPalette()
        palette.setBrush(QPalette.Window, QBrush(pixmap))
        self.setPalette(palette)
Ejemplo n.º 12
0
 def setBackgroundandSize(self,
                          qwidget,
                          imgpath,
                          role,
                          fixedHeight=None,
                          fixedWidth=None):
     if isinstance(qwidget, QWidget) and isinstance(imgpath, str):
         palette = QPalette()
         palette.setBrush(role, QBrush(QPixmap(imgpath)))
         qwidget.setAutoFillBackground(True)
         qwidget.setPalette(palette)
         if fixedHeight is not None and fixedWidth is not None:
             qwidget.setFixedHeight(fixedHeight)
             qwidget.setFixedWidth(fixedWidth)
Ejemplo n.º 13
0
    def __init__(self):
        self.engine = Engine()
        self.ui = Ui_Form()
        self.MainWindow = QtGui.QMainWindow()

        self.ui.setupUi(self.MainWindow)
        self.ui.stackedWidget.setCurrentIndex(4)
        self.setSignals()

        palette = QPalette()
        palette.setBrush(QPalette.Background,
                         QBrush(QPixmap("background.jpg")))

        #self.MainWindow.setPalette(palette)
        #self.ui.page_2.setStyleSheet("background-image: url("+"background.jpg"+"); background-repeat: no-repeat; background-position: center;")

        pass
Ejemplo n.º 14
0
    def createDialog(self):
        """
        Create qt dialog
        """
        self.setWindowTitle("%s %s" % (self.tr("Release Notes"), self.name))
        self.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint
                            | Qt.WindowMinMaxButtonsHint)

        layout = QVBoxLayout()
        self.toRead = QLabel("%s" % self.tr(
            "Release notes of the application. More details in HISTORY."))
        layout.addWidget(self.toRead)

        self.rn = QTreeWidget(self)
        self.rn.setHeaderHidden(True)
        self.rn.setFrameShape(QFrame.NoFrame)
        self.rn.setSelectionMode(QAbstractItemView.NoSelection)
        self.rn.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.rn.setRootIsDecorated(False)

        palette = QPalette()
        brush = QBrush(QColor(240, 240, 240))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Active, QPalette.Base, brush)
        self.rn.setPalette(palette)

        layout.addWidget(self.rn)

        buttonLayout = QHBoxLayout()
        buttonLayout.addStretch()

        self.closeButton = QPushButton(self.tr("Close"), self)
        self.closeButton.clicked.connect(self.reject)

        buttonLayout.addWidget(self.closeButton)

        layout.addLayout(buttonLayout)

        self.setLayout(layout)

        # resise the window
        size = QSize(700, 500)
        self.resize(size)
Ejemplo n.º 15
0
    def loadStyleSheet(self):
        try:
            with open(Utils.CSS_FILE, "r") as f:
                self.setStyleSheet(f.read())

        # If my file disappears for some reason, load crappy black color scheme
        except IOError:
            self.printMessage('No style sheet found!')
            palette = QPalette()

            brush = QBrush(QColor(0, 0, 0))
            brush.setStyle(Qt.SolidPattern)
            palette.setBrush(QPalette.Active, QPalette.Text, brush)

            brush = QBrush(QColor(0, 0, 0))
            brush.setStyle(Qt.SolidPattern)
            palette.setBrush(QPalette.Inactive, QPalette.Text, brush)

            self.ui.textBrowser.setPalette(palette)
Ejemplo n.º 16
0
    def setupUi(self):
        bar = QToolBar()

        bar.addAction(self.playAction)
        bar.addAction(self.pauseAction)
        bar.addAction(self.stopAction)

        self.seekSlider = Phonon.SeekSlider(self)
        self.seekSlider.setMediaObject(media)

        self.volumeSlider = Phonon.VolumeSlider(self)
        self.volumeSlider.setAudioOutput(audio)
        self.volumeSlider.setSizePolicy(QSizePolicy.Maximum,
                                        QSizePolicy.Maximum)

        volumeLabel = QLabel()
        volumeLabel.setPixmap(QPixmap('images/volume.png'))

        palette = QPalette()
        palette.setBrush(QPalette.Light, Qt.darkGray)

        self.timeLcd = QLCDNumber()
        self.timeLcd.setPalette(palette)

        headers = ("Title", "Artist", "Album", "Year")

        seekerLayout = QHBoxLayout()
        seekerLayout.addWidget(self.seekSlider)
        seekerLayout.addWidget(self.timeLcd)

        playbackLayout = QHBoxLayout()
        playbackLayout.addWidget(bar)
        playbackLayout.addStretch()
        playbackLayout.addWidget(volumeLabel)
        playbackLayout.addWidget(self.volumeSlider)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(video)
        mainLayout.addLayout(seekerLayout)
        mainLayout.addLayout(playbackLayout)

        self.setLayout(mainLayout)
Ejemplo n.º 17
0
  def setupUi(self):
        bar = QToolBar()

        bar.addAction(self.playAction)
        bar.addAction(self.pauseAction)
        bar.addAction(self.stopAction)

        self.seekSlider = Phonon.SeekSlider(self)
        self.seekSlider.setMediaObject(media)

        self.volumeSlider = Phonon.VolumeSlider(self)
        self.volumeSlider.setAudioOutput(audio)
        self.volumeSlider.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)

        volumeLabel = QLabel()
        volumeLabel.setPixmap(QPixmap('images/volume.png'))

        palette = QPalette()
        palette.setBrush(QPalette.Light, Qt.darkGray)

        self.timeLcd = QLCDNumber()
        self.timeLcd.setPalette(palette)

        headers = ("Title", "Artist", "Album", "Year")

        seekerLayout = QHBoxLayout()
        seekerLayout.addWidget(self.seekSlider)
        seekerLayout.addWidget(self.timeLcd)

        playbackLayout = QHBoxLayout()
        playbackLayout.addWidget(bar)
        playbackLayout.addStretch()
        playbackLayout.addWidget(volumeLabel)
        playbackLayout.addWidget(self.volumeSlider)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(video)
        mainLayout.addLayout(seekerLayout)
        mainLayout.addLayout(playbackLayout)

        self.setLayout(mainLayout)
Ejemplo n.º 18
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        palette = QPalette()
        brush = QBrush(QColor(255, 255, 255, 255))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Active, QPalette.Base, brush)
        palette.setBrush(QPalette.Active, QPalette.Window, brush)
        palette.setBrush(QPalette.Inactive, QPalette.Base, brush)
        palette.setBrush(QPalette.Inactive, QPalette.Window, brush)
        palette.setBrush(QPalette.Disabled, QPalette.Base, brush)
        palette.setBrush(QPalette.Disabled, QPalette.Window, brush)
        self.setPalette(palette)
        self.ui = Ui_FlightPlannerSimpleBase()
        self.ui.setupUi(self)
        ''' buttons clicked connect '''
        self.ui.btnClose.clicked.connect(self.reject)
        #         self.ui.btnClose_2.clicked.connect(self.reject)
        self.ui.btnConstruct.clicked.connect(self.btnConstruct_Click)
        self.ui.btnPDTCheck.clicked.connect(self.btnPDTCheck_Click)
        self.ui.btnUpdateQA.clicked.connect(self.btnUpdateQA_Click)
        #         self.ui.btnEvaluate.clicked.connect(self.btnEvaluate_Click)
        self.ui.btnOpenData.clicked.connect(self.openData)
        self.ui.btnSaveData.clicked.connect(self.saveData)
        self.ui.btnExportResult.clicked.connect(self.exportResult)
        self.ui.btnExportResult.setDisabled(True)
        self.ui.btnExportResult.setVisible(False)
        ''' properties '''
        self.parametersPanel = None
        self.ui.btnUpdateQA.setVisible(False)
        # self.ui.btnUpdateQA_2.setVisible(False)

        self.uiStateInit()
        #         self.obstacleTableInit()
        self.ui.btnPDTCheck.setVisible(False)

        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/btnImage/dlgIcon.png"), QIcon.Normal,
                       QIcon.Off)
        self.setWindowIcon(icon)
        self.resultLayerList = []
Ejemplo n.º 19
0
class MainWindow(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        self.frmTuner = TunerFrame( self )
        #self.frmTuner.setFrameStyle( QFrame.Panel | QFrame.Raised )

        self.frmAmp = AmpFrame( self )
        self.frmAmp.setFrameStyle( QFrame.Panel | QFrame.Raised )

        self.layout = QVBoxLayout( self )
        #self.layout.setMargin( 0 )
        self.layout.setSpacing( 0 )
        self.layout.addWidget( self.frmTuner )
        self.layout.addWidget( self.frmAmp )

        self.frmTuner.fieldChanged['double'].connect(self.frmAmp.setMaster)

        self.frmTuner.setFreq( 90.0 )

        self.setPalette( QPalette( QColor( 192, 192, 192 ) ) )
        self.updateGradient()

    def resizeEvent(self, QResizeEvent  ):
        # Qt 4.7.1: QGradient.StretchToDeviceMode is buggy on X11
        self.updateGradient()

    def updateGradient(self):
        self.pal = QPalette()

        self.buttonColor = self.pal.color( QPalette.Button )
        self.midLightColor = self.pal.color( QPalette.Midlight )

        #self.gradient = QLinearGradient( rect().topLeft(), rect().topRight() ) FIXME
        self.gradient = QLinearGradient(  )
        self.gradient.setColorAt( 0.0, self.midLightColor )
        self.gradient.setColorAt( 0.7, self.buttonColor )
        self.gradient.setColorAt( 1.0, self.buttonColor )

        self.pal.setBrush( QPalette.Window, self.gradient )
        self.setPalette( self.pal )
Ejemplo n.º 20
0
 def initUI(self):
     # create a class object
     self.setStyleSheet('QPushButton {font-family: cursive, sans-serif; font-weight: 300; font-size: 14px; color: #CD853F; }') 
     self.montage = Montages()
     # create buttons
     createPath = QPushButton(self)
     createPath.setText("Choose the directory of your photos")
     createPath.clicked.connect(self.cPath)
     savePath = QPushButton(self)
     savePath.setText("Choose the directory to save your plot")
     savePath.clicked.connect(self.sPath)
     create = QPushButton(self)
     create.setText("Create plot")
     create.clicked.connect(self.createPlot)
     # set layout
     sbox = QGridLayout(self)
     sbox.addWidget(createPath, 1, 0)
     sbox.addWidget(savePath, 2, 0)
     sbox.addWidget(create, 3, 1)
     self.setLayout(sbox)
     # set background as transparent
     palette	= QPalette()
     palette.setBrush(QPalette.Background,QBrush(QPixmap()))
     self.setPalette(palette)
Ejemplo n.º 21
0
 def setPalette(self, onto):
     """sets a background palette for widget onto"""
     palette = QPalette()
     mybrush = self.brush(onto.size())
     palette.setBrush(QPalette.Window, mybrush)
     onto.setPalette(palette)
Ejemplo n.º 22
0
    def __init__(self):

        QtGui.QMainWindow.__init__(self)

        #Dimensiones originales
        size_x_Original = 1080
        size_y_Original = 1920

        #Clicked button
        self.p = 1.15
        self.b = 0.95

        #Flags Vista 2
        self.IsChecked = [['Red', False], ['Pink', False], ['Blue', False],
                          ['Black', False], ['Yellow', False]]

        #Direcciones de Imágenes de fondo
        self.MAIN_VIEW = "src/img/ArtesPowerRangers/Pantalla 1/1.jpg"
        self.VIEW_2 = "src/img/ArtesPowerRangers/Pantalla 2/1 Back.jpg"
        self.VIEW_3 = "src/img/ArtesPowerRangers/Pantalla 3/1 Back.jpg"
        self.VIEW_5 = "src/img/ArtesPowerRangers/Pantalla 5/Back5.jpg"
        self.VIEW_6 = "src/img/ArtesPowerRangers/Pantalla 7/Back-7.jpg"

        #Direcciones Caras Vista 3
        self.URL_FACES = [
            "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Red.jpg",
            "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Pink.jpg",
            "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Blue.jpg",
            "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Black.jpg",
            "src/img/ArtesPowerRangers/Pantalla 3/3 Rengers/Yellow.jpg"
        ]

        self.RED = "src/img/ArtesPowerRangers/Pantalla 2/Red.jpg"
        self.RED_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/red_blocked.png"
        self.BLUE = "src/img/ArtesPowerRangers/Pantalla 2/Blue.jpg"
        self.BLUE_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/azul_blocked.png"
        self.BLACK = "src/img/ArtesPowerRangers/Pantalla 2/black.jpg"
        self.BLACK_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/black_blocked.png"
        self.PINK = "src/img/ArtesPowerRangers/Pantalla 2/pink.jpg"
        self.PINK_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/pink_blocked.png"
        self.YELLOW = "src/img/ArtesPowerRangers/Pantalla 2/yellow.jpg"
        self.YELLOW_BLOCK = "src/img/ArtesPowerRangers/Pantalla 2/yellow_blocked.png"

        self.GIF = "src/img/gif_red.gif"

        self.PASS_MAIL = "aradmagol"
        self.MAIL = "*****@*****.**"

        # Se monta la interfaz de usuario para la pantalla principal
        self.ui = uic.loadUi("views/main.ui")

        #Se bloquea el marco superior
        self.ui.setWindowFlags(self.ui.windowFlags()
                               | QtCore.Qt.CustomizeWindowHint)
        self.ui.setWindowFlags(self.ui.windowFlags()
                               & ~QtCore.Qt.WindowMaximizeButtonHint)

        #Full Screen
        self.ui.showFullScreen()
        screen = QtGui.QDesktopWidget().screenGeometry()

        #Dimensiones de la pantalla
        self.size_x = screen.width()
        self.size_y = screen.height()

        #Relación imagen/pantalla
        rel_x = float(self.size_x) / float(size_x_Original)
        rel_y = float(self.size_y) / float(size_y_Original)

        #----------Vista 1---------------
        #Se carga la imagen principal
        palette = QPalette()
        palette.setBrush(
            QPalette.Background,
            QBrush(QPixmap(self.MAIN_VIEW).scaled(self.size_x, self.size_y)))
        self.ui.setPalette(palette)
        #Vista de inicio
        self.ui.setCurrentWidget(self.ui.View1)

        #----------Bóton Inicio-----------
        nx = self.ui.inicio_btn.width() * rel_x
        ny = self.ui.inicio_btn.height() * rel_y

        self.ui.inicio_btn.resize(int(nx), int(ny))
        self.ui.inicio_btn.move(int(self.size_x / 2 - nx / 2),
                                int(7 * self.size_y / 8))
        self.ui.inicio_btn.mousePressEvent = self.pressStartV1
        self.ui.inicio_btn.mouseReleaseEvent = self.releaseStartV1
        #----------------------------------

        #-----------Vista 2----------------
        #-----------Título-----------------
        tx = self.ui.title_v2.width() * rel_x
        ty = self.ui.title_v2.height() * rel_y

        self.ui.title_v2.resize(int(tx), int(ty))
        self.ui.title_v2.move(int(self.size_x / 2 - tx / 2),
                              int(self.size_y / 10))

        #----------Bóton Ranger Azul-------
        y_init = 403 * rel_y

        brx = self.ui.blue_ranger.width() * rel_x
        bry = self.ui.blue_ranger.height() * rel_y

        self.ui.blue_ranger.resize(int(brx), int(bry))
        self.ui.blue_ranger.move(int(self.size_x / 2 - brx / 2), int(y_init))
        self.ui.blue_ranger.mousePressEvent = self.pressBlue

        #----------Bóton Ranger Rosa-----------
        self.ui.pink_ranger.resize(int(brx), int(bry))
        self.ui.pink_ranger.move(int(self.size_x / 2 - brx / 2),
                                 int(y_init + bry))
        self.ui.pink_ranger.mousePressEvent = self.pressPink

        #----------Bóton Ranger Rojo-----------
        self.ui.red_ranger.resize(int(brx), int(bry))
        self.ui.red_ranger.move(int(self.size_x / 2 - brx / 2),
                                int(y_init + 2 * bry))
        self.ui.red_ranger.mousePressEvent = self.pressRed

        #----------Bóton Ranger Amarillo-----------
        self.ui.yellow_ranger.resize(int(brx), int(bry))
        self.ui.yellow_ranger.move(int(self.size_x / 2 - brx / 2),
                                   int(y_init + 3 * bry))
        self.ui.yellow_ranger.mousePressEvent = self.pressYellow

        #----------Bóton Ranger Negro-----------
        self.ui.black_ranger.resize(int(brx), int(bry))
        self.ui.black_ranger.move(int(self.size_x / 2 - brx / 2),
                                  int(y_init + 4 * bry))
        self.ui.black_ranger.mousePressEvent = self.pressBlack

        #----------Botón Continuar-------------
        self.y_init_btn = 1700 * rel_y

        c2x = self.ui.continue_btn.width() * rel_x
        c2y = self.ui.continue_btn.height() * rel_y

        self.ui.continue_btn.resize(int(c2x), int(c2y))
        self.ui.continue_btn.move(int(self.size_x / 2 - c2x / 2),
                                  int(self.y_init_btn))
        self.ui.continue_btn.mousePressEvent = self.pressContinueV2
        self.ui.continue_btn.mouseReleaseEvent = self.releaseContinueV2

        #--------------------------------------
        #Se guarda el tamaño original del botón
        self.x_red = self.ui.red_ranger.width()
        self.y_red = self.ui.red_ranger.height()

        #Se guarda el tamaño original del botón
        self.x_black = self.ui.black_ranger.width()
        self.y_black = self.ui.black_ranger.height()

        #Se guarda el tamaño original del botón
        self.x_pink = self.ui.pink_ranger.width()
        self.y_pink = self.ui.pink_ranger.height()

        #Se guarda el tamaño original del botón
        self.x_blue = self.ui.blue_ranger.width()
        self.y_blue = self.ui.blue_ranger.height()

        #Se guarda el tamaño original del botón
        self.x_yellow = self.ui.yellow_ranger.width()
        self.y_yellow = self.ui.yellow_ranger.height()

        #------------Vista 3--------------
        #-----------Título-----------------
        self.t3x = self.ui.title_v3.width() * rel_x
        t3y = self.ui.title_v3.height() * rel_y

        self.ui.title_v3.resize(int(self.t3x), int(t3y))
        self.ui.title_v3.move(int(self.size_x / 2 - self.t3x / 2),
                              int(self.size_y / 9))

        self.fx = self.ui.photo_ranger.width() * rel_x
        fy = self.ui.photo_ranger.height() * rel_y

        self.ui.photo_ranger.resize(int(self.fx), int(fy))
        self.ui.photo_ranger.move(int(self.size_x / 2 - self.fx / 2),
                                  int(self.size_y / 6))

        self.name_x = self.ui.name_v3.width() * rel_x
        self.name_y = self.ui.name_v3.height() * rel_y

        self.ui.name_v3.resize(int(self.name_x), int(self.name_y))
        self.ui.name_v3.move(int(self.size_x / 2 - self.name_x / 2),
                             int(self.size_y / 2 + 2 * self.name_y))

        #--------------Keyboard-----------
        self.promptTex = ""
        self.ui.keyboard.move(
            int(self.size_x / 2 - self.ui.keyboard.width() / 2),
            int(self.size_y / 2))
        self.ui.key_a.mouseReleaseEvent = self.key_a
        self.ui.key_b.mouseReleaseEvent = self.key_b
        self.ui.key_c.mouseReleaseEvent = self.key_c
        self.ui.key_d.mouseReleaseEvent = self.key_d
        self.ui.key_e.mouseReleaseEvent = self.key_e
        self.ui.key_f.mouseReleaseEvent = self.key_f
        self.ui.key_g.mouseReleaseEvent = self.key_g
        self.ui.key_h.mouseReleaseEvent = self.key_h
        self.ui.key_i.mouseReleaseEvent = self.key_i
        self.ui.key_j.mouseReleaseEvent = self.key_j
        self.ui.key_k.mouseReleaseEvent = self.key_k
        self.ui.key_l.mouseReleaseEvent = self.key_l
        self.ui.key_m.mouseReleaseEvent = self.key_m
        self.ui.key_n.mouseReleaseEvent = self.key_n
        self.ui.key_o.mouseReleaseEvent = self.key_o
        self.ui.key_p.mouseReleaseEvent = self.key_p
        self.ui.key_q.mouseReleaseEvent = self.key_q
        self.ui.key_r.mouseReleaseEvent = self.key_r
        self.ui.key_s.mouseReleaseEvent = self.key_s
        self.ui.key_t.mouseReleaseEvent = self.key_t
        self.ui.key_u.mouseReleaseEvent = self.key_u
        self.ui.key_v.mouseReleaseEvent = self.key_v
        self.ui.key_w.mouseReleaseEvent = self.key_w
        self.ui.key_x.mouseReleaseEvent = self.key_x
        self.ui.key_y.mouseReleaseEvent = self.key_y
        self.ui.key_z.mouseReleaseEvent = self.key_z

        self.ui.key_1.mouseReleaseEvent = self.key_1
        self.ui.key_2.mouseReleaseEvent = self.key_2
        self.ui.key_3.mouseReleaseEvent = self.key_3
        self.ui.key_4.mouseReleaseEvent = self.key_4
        self.ui.key_5.mouseReleaseEvent = self.key_5
        self.ui.key_6.mouseReleaseEvent = self.key_6
        self.ui.key_7.mouseReleaseEvent = self.key_7
        self.ui.key_8.mouseReleaseEvent = self.key_8
        self.ui.key_9.mouseReleaseEvent = self.key_9
        self.ui.key_0.mouseReleaseEvent = self.key_0

        self.ui.key_punto.mouseReleaseEvent = self.key_punto
        self.ui.key_puntocoma.mouseReleaseEvent = self.key_puntocoma
        self.ui.key_coma.mouseReleaseEvent = self.key_coma
        self.ui.key_space.mouseReleaseEvent = self.key_space
        self.ui.key_money.mouseReleaseEvent = self.key_money
        self.ui.key_cs.mouseReleaseEvent = self.key_cs
        self.ui.key_cc.mouseReleaseEvent = self.key_cc
        self.ui.key_guionbajo.mouseReleaseEvent = self.key_guion_bajo
        self.ui.key_guion.mouseReleaseEvent = self.key_guion_alto
        self.ui.key_admirar.mouseReleaseEvent = self.key_admiracion
        self.ui.key_porcentage.mouseReleaseEvent = self.key_porcentaje
        self.ui.key_arroba.mouseReleaseEvent = self.key_arroba
        self.ui.key_number.mouseReleaseEvent = self.key_number

        self.ui.key_delete.mouseReleaseEvent = self.key_delete

        #-------------Continuar-----------
        self.c3x = self.ui.continue_btn_V3.width() * rel_x
        c3y = self.ui.continue_btn_V3.height() * rel_y

        self.ui.continue_btn_V3.resize(int(self.c3x), int(c3y))
        self.ui.continue_btn_V3.move(int(self.size_x / 2 - self.c3x / 2),
                                     int(self.y_init_btn))
        self.ui.continue_btn_V3.mousePressEvent = self.pressContinueV3
        self.ui.continue_btn_V3.mouseReleaseEvent = self.releaseContinueV3

        #--------------Atrás--------------
        self.ax = self.ui.cancelar.width() * rel_x
        ay = self.ui.cancelar.height() * rel_y

        self.ui.cancelar.resize(int(self.ax), int(ay))
        self.ui.cancelar.move(int(self.size_x / 25), int(self.y_init_btn))
        self.ui.cancelar.mousePressEvent = self.pressCancelar
        self.ui.cancelar.mouseReleaseEvent = self.releaseCancelar

        self.firstTime = False

        #--------------Vista 5---------------
        #------------Muestra GIF-------------
        altura_gif = 350 * rel_y
        gif_x = self.ui.the_gif.width() * rel_x
        gif_y = self.ui.the_gif.height() * rel_y

        self.ui.the_gif.resize(int(gif_x), int(gif_y))
        self.ui.the_gif.move(int(self.size_x / 2 - gif_x / 2), int(altura_gif))
        #--------------Marco-----------------
        altura_mark = 1250 * rel_y
        mark_x = self.ui.cuadro.width() * rel_x
        mark_y = self.ui.cuadro.height() * rel_y

        self.ui.cuadro.resize(int(mark_x), int(mark_y))
        self.ui.cuadro.move(int(self.size_x / 2 - mark_x / 2),
                            int(altura_mark))
        #-----------Atrás botón--------------
        altura_atras = 1350 * rel_y
        base_atras = 130 * rel_x

        atras_x = self.ui.atras.width() * rel_x
        atras_y = self.ui.atras.height() * rel_y

        self.ui.atras.resize(int(atras_x), int(atras_y))
        self.ui.atras.move(int(base_atras), int(altura_atras))
        self.ui.atras.mousePressEvent = self.pressAtrasV5
        self.ui.atras.mouseReleaseEvent = self.releaseAtrasV5
        #-----------Continuar botón--------------
        base_con = 575 * rel_x

        con_x = self.ui.continuar_V5.width() * rel_x
        con_y = self.ui.continuar_V5.height() * rel_y

        self.ui.continuar_V5.resize(int(con_x), int(con_y))
        self.ui.continuar_V5.move(int(base_con), int(altura_atras))
        self.ui.continuar_V5.mousePressEvent = self.pressContinueV5
        self.ui.continuar_V5.mouseReleaseEvent = self.releaseContinueV5

        #Posiciones de los botones
        self.positionV2 = self.ui.continue_btn.pos()
        self.positionV3 = self.ui.continue_btn_V3.pos()
        self.positionV5 = self.ui.continuar_V5.pos()
        self.positionAtras = self.ui.atras.pos()
        self.positionCancelar = self.ui.cancelar.pos()

        #------------Vista 6---------------
        #------------Muestra GIF-------------
        self.altura_gif2 = 170 * rel_y
        self.gif2_x = self.ui.the_gif_validate.width() * rel_x
        gif2_y = self.ui.the_gif_validate.height() * rel_y

        self.ui.the_gif_validate.resize(int(self.gif2_x), int(gif2_y))
        self.ui.the_gif_validate.move(int(self.size_x / 2 - self.gif2_x / 2),
                                      int(self.altura_gif2))
        #----------Escribe Correo-------------
        self.altura_mail = 990 * rel_y
        self.mail_x = self.ui.title_V6.width() * rel_x
        mail_y = self.ui.title_V6.height() * rel_y

        self.ui.title_V6.resize(int(self.mail_x), int(mail_y))
        self.ui.title_V6.move(int(self.size_x / 2 - self.mail_x / 2),
                              int(self.altura_mail))

        #----------Acepto?-------------
        self.altura_acepto = 1650 * rel_y
        self.acepto_x = self.ui.acepto.width() * rel_x
        acepto_y = self.ui.acepto.height() * rel_y

        self.ui.acepto.resize(int(self.acepto_x), int(acepto_y))
        self.ui.acepto.move(int(self.size_x / 2 - self.acepto_x / 2),
                            int(self.altura_acepto))

        #Bandera para el uso del teclado :)
        self.flag_Key = 3  #La vista 3 es la original

        #Botón pantalla completa
        self.ui.next_btn.resize(self.size_x, self.size_y)
        self.ui.next_btn.move(0, 0)
        self.ui.next_btn.mousePressEvent = self.restart

        #Nombre
        self.name = ""
        #Correo
        self.email = ""

        self.ui.show()
Ejemplo n.º 23
0
    def setupUi(self, showprogress):
        showprogress.setObjectName("showprogress")
        showprogress.resize(335, 310)
        self.verticalLayout = QVBoxLayout(showprogress)
        self.verticalLayout.setObjectName("verticalLayout")
        self.barProgress = QProgressBar(showprogress)
        self.barProgress.setProperty("value", QVariant(0))
        self.barProgress.setObjectName("barProgress")
        self.verticalLayout.addWidget(self.barProgress)
        self.infoText = QTextEdit(showprogress)
        palette = QPalette()
        brush = QBrush(QColor(255, 255, 255))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Active, QPalette.Text, brush)
        brush = QBrush(QColor(0, 0, 0))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Active, QPalette.Base, brush)
        brush = QBrush(QColor(255, 255, 255))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Inactive, QPalette.Text, brush)
        brush = QBrush(QColor(0, 0, 0))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Inactive, QPalette.Base, brush)
        brush = QBrush(QColor(126, 125, 124))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Disabled, QPalette.Text, brush)
        brush = QBrush(QColor(255, 255, 255))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Disabled, QPalette.Base, brush)
        self.infoText.setPalette(palette)
        self.infoText.setObjectName("infoText")
        self.verticalLayout.addWidget(self.infoText)
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.fermer = QPushButton(showprogress)
        self.fermer.setObjectName("fermer")
        self.horizontalLayout.addWidget(self.fermer)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(showprogress)
        QMetaObject.connectSlotsByName(showprogress)
Ejemplo n.º 24
0
    def setupUi(self):


        #self.threadclass = level()
        #self.threadclass.start()
      
        #self.connect(self, QtCore.SIGNAL('LEVEL'), self.threadclass) 

        self.setWindowTitle("RNEL Elevator Controller")
        rowSpacer = QtGui.QSpacerItem(1, 20)
        columnSpacer = QtGui.QSpacerItem(50, 1)

        # Highlight input that is currently selected
        self.setFocusPolicy(QtCore.Qt.ClickFocus)

        # Create UI elements
        label_banner = QtGui.QLabel()
        label_banner.setText("")
        label_banner.setPixmap(QtGui.QPixmap(":/RNELicon/RNELBanner.png"))

        font = QtGui.QFont("Helvetica", 12, 75)
        font.setBold(True)
        label_motorState = QtGui.QLabel("Stepper Motor Parameters")
        label_motorState.setFont(font)

        # label_task = QtGui.QLabel("Select a Task")
        # label_time = QtGui.QLabel("Time Between Levels (seconds):")
        label_steps = QtGui.QLabel("Distance (in):")
        label_wheeldiameter = QtGui.QLabel("Wheel Diameter (in)")
        label_direction = QtGui.QLabel("Direction:")
        label_mode = QtGui.QLabel("Mode:")
        #label_torque = QtGui.QLabel("Torque:")
		
        label_capacitance = QtGui.QLabel("Capacitance: ") #LOOK HERE	
        label_capacitance.setFont(font)

        self.capacitance = QtGui.QLCDNumber(self) #LOOK HERE 
        self.capacitance.setFont(font)
        palette = QPalette()
       # palette.setBrush(QtGui.QPalette.Light, QtCore.Qt.black)
        brush = QtGui.QBrush(QtGui.QColor(0,0,0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
        self.capacitance.setPalette(palette)

        self.capacitance.setDigitCount(8)
        self.threadclass = Capacitance()
        self.threadclass.start()
		
        self.connect(self.threadclass, QtCore.SIGNAL('CAP'), self.updateCapacitance)        
        
        self.capacitance.display(0) # just so something is there
                
        # self.comboBox_task = QtGui.QComboBox()
        # self.comboBox_task.addItems(["Alternating Reward Well Task", "Fixed Reward Well Task"])
        # self.comboBox_task.setCurrentIndex(0)
        self.lineEdit_time = QtGui.QLineEdit()
        self.lineEdit_time.setMaximumSize(QtCore.QSize(100, 30))
        self.lineEdit_time.setText("0")
        self.lineEdit_distance = QtGui.QLineEdit()
        self.lineEdit_distance.setMaximumSize(QtCore.QSize(100, 30))
        self.lineEdit_distance.setText("0")
        self.lineEdit_wheeldiameter = QtGui.QLineEdit()
        self.lineEdit_wheeldiameter.setText("1")
        self.comboBox_direction = QtGui.QComboBox()
        self.comboBox_direction.addItems(["Up", "Down"])
        self.comboBox_mode = QtGui.QComboBox()
        self.comboBox_mode.addItems(["1/1", "1/2", "1/4", "1/8", "1/16", "1/32", "1/64", "1/128"])
        self.comboBox_mode.setCurrentIndex(0)
        #self.comboBox_torque = QtGui.QComboBox()
        #self.comboBox_torque.addItems(["10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%"])
        #self.comboBox_torque.setCurrentIndex(4)

        #Preset Levels >>> assign each to a 12" distance later

        self.preset_checkbox = QtGui.QCheckBox("Use preset elevator levels")
        self.preset_checkbox.setCheckState(False)
        self.preset_checkbox.setTristate(False)
        label_level = QtGui.QLabel("Level:")
        self.comboBox_level = QtGui.QComboBox()
        self.comboBox_level.addItems(["1", "2", "3"])
        self.comboBox_level.setEnabled(False)

        label_assign = QtGui.QLabel("Assign position to level?")
        self.btn_assign = QtGui.QPushButton("Assign")
        self.btn_assign.setEnabled(False)

        self.btn_run = QtGui.QPushButton("Run")
        self.btn_doorstat = QtGui.QPushButton("Open/Close")
        self.progress_bar = QtGui.QProgressBar()
        self.btn_doorstat = QtGui.QPushButton("Open/Close")

        label_history = QtGui.QLabel("Command History")
        label_history.setFont(font)
        self.command_history = QtGui.QPlainTextEdit()
        self.command_history.setMaximumSize(QtCore.QSize(1000, 500))
        self.command_history.setReadOnly(True)
        self.command_history.appendPlainText("Note: The speed will be scaled according to the microstepping mode.")
        self.command_history.appendPlainText("Note: The time and distance inputs must be positive integers. Numbers that are not integers will be rounded down.")
        self.command_history.appendPlainText("")

        font = QtGui.QFont("Helvetica", 12)
        label_instructions = QtGui.QLabel("Please visit the following site for instructions:")
        label_instructions.setFont(font)

        label_website = QtGui.QLabel()
        label_website.setFont(font)
        label_website.setText("<a href=\"https://github.com/kemerelab/Elevator/\">Elevator Maze</a>")
        label_website.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse)
        label_website.setOpenExternalLinks(True)

        # Format UI elements
        formLayout = QtGui.QFormLayout()
        formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        formLayout.setLabelAlignment(QtCore.Qt.AlignLeft)
        formLayout.addRow(label_time, self.lineEdit_time)
        formLayout.addRow(label_steps, self.lineEdit_distance)
        formLayout.addRow(label_direction, self.comboBox_direction)
        formLayout.addRow(label_mode, self.comboBox_mode)
        #formLayout.addRow(label_torque, self.comboBox_torque)
        formLayout.addRow(label_wheeldiameter, self.lineEdit_wheeldiameter)
       

        formLayout2 = QtGui.QFormLayout()
        formLayout2.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        formLayout2.setLabelAlignment(QtCore.Qt.AlignLeft)
        formLayout2.addRow(label_level, self.comboBox_level)

        formLayout2.addRow(label_capacitance, self.capacitance) #LOOK HERE

        verticalLayout = QtGui.QVBoxLayout()
        verticalLayout.addWidget(self.preset_checkbox)
        verticalLayout.addLayout(formLayout2)
        verticalLayout.addStretch()
        verticalLayout.addWidget(label_assign)
        verticalLayout.addWidget(self.btn_assign, 0, QtCore.Qt.AlignHCenter)

        horizontalLayout = QtGui.QHBoxLayout()
        horizontalLayout.addLayout(formLayout)
        horizontalLayout.addSpacerItem(columnSpacer)
        horizontalLayout.addLayout(verticalLayout)

        verticalLayout2 = QtGui.QVBoxLayout(self)
        verticalLayout2.setContentsMargins(30, 20, 30, 20)
        verticalLayout2.setSizeConstraint(QtGui.QLayout.SetFixedSize)
        verticalLayout2.addWidget(label_banner, 0, QtCore.Qt.AlignHCenter)
        verticalLayout2.addSpacerItem(rowSpacer)
        verticalLayout2.addWidget(label_motorState)
        verticalLayout2.addLayout(horizontalLayout)
        verticalLayout2.addWidget(self.btn_run, 0, QtCore.Qt.AlignHCenter)
        verticalLayout2.addWidget(self.btn_doorstat, 0, QtCore.Qt.AlignRight)
        verticalLayout2.addWidget(self.progress_bar)
        verticalLayout2.addSpacerItem(rowSpacer)
        formLayout3 = QtGui.QFormLayout()
        verticalLayout2.addLayout(formLayout3)


        formLayout3.addRow(label_capacitance, self.capacitance) #LOOK HERE
     
        verticalLayout2.addWidget(label_history)
        verticalLayout2.addWidget(self.command_history)
        verticalLayout2.addSpacerItem(rowSpacer)
        verticalLayout2.addWidget(label_instructions)
        verticalLayout2.addWidget(label_website)



        self.btn_run.clicked.connect(self.collectMotorData)
        self.btn_doorstat.clicked.connect(self.sendServoData)
        self.preset_checkbox.stateChanged.connect(self.updateUI)
        self.comboBox_level.currentIndexChanged.connect(self.updateUI)
        self.btn_assign.clicked.connect(self.assignPosition)
        self.btn_assign.clicked.connect(self.updateUI)
Ejemplo n.º 25
0
class QColorScheme():
    """Class to ease custom colors of PyQt apps
    baseColor: This is the main background color.
    highlightColor: Typically contrasting the baseColor (e.g. used to highlight current focus)
    spread: Float value indicating the brightness range generated by generateColors (1.5-2.0 seems most reasonable)
    """
    def __init__(self,
                 baseColor=QColor(50, 50, 50),
                 highlightColor=QColor(247, 147, 30),
                 spread=2.5):
        """Constructor
        By default a nukeish color scheme (dark slate + orange highlight) is created
        This can be overriden by either supplying colors or by loading a different
        scheme from disc via the load settings
        """
        self.palette = QPalette()
        self.baseColor = baseColor
        self.highlightColor = highlightColor
        self.spread = spread
        self.generateScheme()
        QApplication.setStyle("Plastique")

    def __lightness(self, color):
        """Returns simple averaged lightness of a QColor
        Newer Qt Versions implement this as part of QColor
        Reimplemented for backwards-compatibility
        """
        hsv = color.toHsv()
        return hsv.valueF()

    def generateScheme(self, apply=True):
        """Generate color palette
        By default the generated palette is also applied to the whole application
        To override supply the apply=False argument
        """
        BASE_COLOR = self.baseColor
        HIGHLIGHT_COLOR = self.highlightColor
        BRIGHTNESS_SPREAD = self.spread

        if self.__lightness(BASE_COLOR) > 0.5:
            SPREAD = 100 / BRIGHTNESS_SPREAD
        else:
            SPREAD = 100 * BRIGHTNESS_SPREAD

        if self.__lightness(HIGHLIGHT_COLOR) > 0.6:
            HIGHLIGHTEDTEXT_COLOR = BASE_COLOR.darker(SPREAD * 2)
        else:
            HIGHLIGHTEDTEXT_COLOR = BASE_COLOR.lighter(SPREAD * 2)

        self.palette.setBrush(QPalette.Window, QBrush(BASE_COLOR))

        self.palette.setBrush(QPalette.WindowText,
                              QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.Foreground,
                              QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.Base, QBrush(BASE_COLOR))
        self.palette.setBrush(QPalette.AlternateBase,
                              QBrush(BASE_COLOR.darker(SPREAD)))
        self.palette.setBrush(QPalette.ToolTipBase, QBrush(BASE_COLOR))
        self.palette.setBrush(QPalette.ToolTipText,
                              QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.Text,
                              QBrush(BASE_COLOR.lighter(SPREAD * 1.2)))
        self.palette.setBrush(QPalette.Button, QBrush(BASE_COLOR))
        self.palette.setBrush(QPalette.ButtonText,
                              QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.BrightText,
                              QBrush(QColor(240, 240, 240)))

        self.palette.setBrush(QPalette.Light,
                              QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.Midlight,
                              QBrush(BASE_COLOR.lighter(SPREAD / 2)))
        self.palette.setBrush(QPalette.Dark, QBrush(BASE_COLOR.darker(SPREAD)))
        self.palette.setBrush(QPalette.Mid, QBrush(BASE_COLOR))
        self.palette.setBrush(QPalette.Shadow,
                              QBrush(BASE_COLOR.darker(SPREAD * 2)))

        self.palette.setBrush(QPalette.Highlight, QBrush(HIGHLIGHT_COLOR))
        self.palette.setBrush(QPalette.HighlightedText,
                              QBrush(HIGHLIGHTEDTEXT_COLOR))
        if apply:
            QApplication.setPalette(self.palette)

    def applyStyle(self, target=QApplication):
        """Apply the color scheme in self.palette
        When called without arguments the whole application will be styled
        If a widget is supplied as argument only this widget will be styled
        """
        target.setPalette(self.palette)

    def colorFromStringTuple(self, tuple):
        return QColor(int(tuple[0]), int(tuple[1]), int(tuple[2]))

    def loadSimpleScheme(self, file, apply=True):
        scheme = ConfigParser.ConfigParser()
        scheme.read(file)
        self.baseColor = self.colorFromStringTuple(
            scheme.get("AutoColors", "baseColor").split(","))
        self.highlightColor = self.colorFromStringTuple(
            scheme.get("AutoColors", "highlightColor").split(","))
        self.spread = float(scheme.get("AutoColors", "spread"))
        if apply:
            self.generateScheme()
        else:
            self.generateScheme(apply=False)

    def loadScheme(self, file):
        """TODO: Implement
        """
        raise NotImplementedError
    def __init__(self, parent):
        QDialog.__init__(self, parent)

        palette = QPalette();
        brush = QBrush(QColor(255, 255, 255, 255));
        brush.setStyle(Qt.SolidPattern);
        palette.setBrush(QPalette.Active, QPalette.Base, brush);
        palette.setBrush(QPalette.Active, QPalette.Window, brush);
        palette.setBrush(QPalette.Inactive, QPalette.Base, brush);
        palette.setBrush(QPalette.Inactive, QPalette.Window, brush);
        palette.setBrush(QPalette.Disabled, QPalette.Base, brush);
        palette.setBrush(QPalette.Disabled, QPalette.Window, brush);
        self.setPalette(palette);

        self.ui = Ui_FlightPlannerBase()
        self.ui.setupUi(self)

        
        self.newDlgExisting = False
        
        self.chbHideCloseInObst = QCheckBox(self.ui.grbResult)
        font = QFont()
        font.setBold(False)
        font.setWeight(50)
        self.chbHideCloseInObst.setFont(font)
        self.chbHideCloseInObst.setObjectName("chbHideCloseInObst")
        self.ui.vlResultGroup.addWidget(self.chbHideCloseInObst)
        self.chbHideCloseInObst.setText("Hide close-in obstacles")
        self.chbHideCloseInObst.setVisible(False)
        self.ui.tblHistory.setSelectionBehavior(1)
        # self.ui.tabCtrlGeneral.setTabsClosable(True)

        self.ui.btnUpdateQA.setVisible(False)
        self.ui.btnUpdateQA_2.setVisible(False)

        ''' combo boxes event '''
        self.ui.cmbObstSurface.currentIndexChanged.connect(self.cmbObstSurfaceChanged)
        self.ui.cmbUnits.currentIndexChanged.connect(self.changeResultUnit)
        ''' buttons clicked connect '''
        self.ui.btnClose.clicked.connect(self.reject)
        self.ui.btnClose_2.clicked.connect(self.reject)
        self.ui.btnHistoryClose.clicked.connect(self.reject)
        self.ui.btnConstruct.clicked.connect(self.btnConstruct_Click)
        self.ui.btnEvaluate.clicked.connect(self.btnEvaluate_Click)
        self.ui.btnOpenData.clicked.connect(self.openData)
        self.ui.btnSaveData.clicked.connect(self.saveData)
        self.ui.btnPDTCheck.clicked.connect(self.btnPDTCheck_Click)
        self.ui.btnExportResult.clicked.connect(self.exportResult)
        self.ui.tblHistory.clicked.connect(self.tblHistory_Click)
        self.ui.btnUpdateQA.clicked.connect(self.btnUpdateQA_Click)
        self.ui.btnUpdateQA_2.clicked.connect(self.btnUpdateQA_2_Click)
        self.ui.btnCriticalLocate.clicked.connect(self.criticalLocate)
        self.connect(self.ui.tblObstacles, SIGNAL("tableViewObstacleMouseReleaseEvent_rightButton"), self.tableViewObstacleMouseTeleaseEvent_rightButton)
        self.connect(self.ui.tblObstacles, SIGNAL("pressedEvent"), self.tblObstacles_pressed)
        ''' properties '''
        self.parametersPanel = None
        self.obstaclesModel = None
        self.surfaceType = ""
        self.surfaceSubGroupNames = []

        self.uiStateInit()
        self.obstacleTableInit()
        self.newDlgExisting = True
        self.resultColumnNames = []

        self.stdItemModelHistory = QStandardItemModel()
        # self.stdItemModelHistory.
        self.ui.tblHistory.setModel(self.stdItemModelHistory)

        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/btnImage/dlgIcon.png"), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)

        self.resultLayerList = []
        self.symbolLayers = []
        self.selectedObstacleMoselIndex = None
        self.changedCriticalObstacleValue = []
Ejemplo n.º 27
0
Archivo: scj.py Proyecto: Ptaah/SCJ
    def setupUi(self):
        self.setObjectName("SCJ")
        self.setFixedSize(600,260)
        #self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setObjectName("verticalLayout")
        #self.infoText = QTextEdit(self)
        self.infoText = QLabel(self)
        palette = QPalette()
        brush = QBrush(QColor(245, 245, 245))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Normal, QPalette.Background, brush)
        self.infoText.setPalette(palette)
        self.infoText.setAutoFillBackground(True)
        self.infoText.setFixedHeight(200)
        self.infoText.setObjectName("infoText")
        #self.infoText.setReadOnly(True)
        self.infoText.setWordWrap(True)
        self.verticalLayout.addWidget(self.infoText)
        # Manage Actions buttons
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        ## Format de sortie
        self.outlabel = QLabel(self.trUtf8("Choix du format de destination"))
        self.horizontalLayout.addWidget(self.outlabel)
        self.output = QComboBox()
        self.output.addItems(self.modes)
        self.output.setCurrentIndex(self.output.findText(self.mode))
        self.horizontalLayout.addWidget(self.output)
        # Buttons
        self.fermer = QPushButton(self)
        self.fermer.setObjectName("fermer")
        self.horizontalLayout.addWidget(self.fermer)
        self.convertDir = QPushButton(self)
        self.convertDir.setObjectName("convertDir")
        self.horizontalLayout.addWidget(self.convertDir)
        self.convertFile = QPushButton(self)
        self.convertFile.setObjectName("convertFile")
        self.horizontalLayout.addWidget(self.convertFile)
        self.verticalLayout.addLayout(self.horizontalLayout)

        # Layout for allButtons
        self.allLayout = QHBoxLayout()
        # Add startAll bouton
        self.startallbtn = QPushButton(self)
        self.allLayout.addWidget(self.startallbtn)
        self.startallbtn.hide()
        self.verticalLayout.addLayout(self.allLayout)
        # Add delAll bouton
        self.delallbtn = QPushButton(self)
        self.allLayout.addWidget(self.delallbtn)
        self.delallbtn.hide()
        # Mode avec scroll
        self.frame = QFrame()
        self.frame.setMinimumSize(520,250)
        self.frame.setMaximumWidth(520)
        self.scroll = QScrollArea()
        self.scroll.setMinimumHeight(180)
        self.jobsLayout = QVBoxLayout(self.frame)
        self.jobsLayout.setSizeConstraint(QLayout.SetMinAndMaxSize)
        #self.jobsLayout.setSizeConstraint(QLayout.SetMinimumSize)
        #self.jobsLayout.setSizeConstraint(QLayout.SetMaximumSize)
        self.scroll.setWidget(self.frame)
        self.scroll.setWidgetResizable(False)
        self.verticalLayout.addWidget(self.scroll)
        self.scroll.hide()

        # Mode sans scroll
        #self.jobsLayout = QVBoxLayout()
        #self.verticalLayout.addLayout(self.jobsLayout)

        # Add a strech to the bottom of the window
        self.verticalLayout.insertStretch(-1)
Ejemplo n.º 28
0
class QColorScheme():
    """Class to ease custom colors of PyQt apps
    baseColor: This is the main background color.
    highlightColor: Typically contrasting the baseColor (e.g. used to highlight current focus)
    spread: Float value indicating the brightness range generated by generateColors (1.5-2.0 seems most reasonable)
    """
    
    def __init__(self,baseColor=QColor(50,50,50), highlightColor=QColor(247,147,30), spread=2.5, monochromeText=False, apply=True):
        """Constructor
        By default a nuke-like color scheme (dark slate + orange highlight) is created
        This can be overriden by either supplying colors or by loading a different
        scheme from disc via the load settings
        """
        self.palette = QPalette()
        self.baseColor = baseColor
        self.highlightColor = highlightColor
        self.spread = spread
        self.generateScheme(apply=apply, monochromeText=monochromeText)
        QApplication.setStyle("Plastique")
    
    def __lightness(self, color):
        """Returns simple averaged lightness of a QColor
        Newer Qt Versions implement this as part of QColor
        Reimplemented for backwards-compatibility
        """
        hsv = color.toHsv()
        return hsv.valueF()
    
#    def setColor(self, target=QApplication, Group=None, Role=None, Color=QColor()):
#        """Override any color in the given widget's palette
#        """
#        palette = target.palette()
#        palette.setBrush(getattr(QPalette, Role),Color)
#        target.setPalette(palette)
    
    def generateScheme(self, apply=True, monochromeText=True):
        """Generate color palette
        By default the generated palette is also applied to the whole application
        To override supply the apply=False argument
        """
        BASE_COLOR = self.baseColor
        HIGHLIGHT_COLOR = self.highlightColor
        BRIGHTNESS_SPREAD = self.spread
        
        if self.__lightness(BASE_COLOR) > 0.5:
            SPREAD = 100/BRIGHTNESS_SPREAD
        else:
            SPREAD = 100*BRIGHTNESS_SPREAD
        
        if self.__lightness(HIGHLIGHT_COLOR)>0.6:
            HIGHLIGHTEDTEXT_COLOR= BASE_COLOR.darker(SPREAD*2)
        else:
            HIGHLIGHTEDTEXT_COLOR= BASE_COLOR.lighter(SPREAD*2)
        
        self.palette.setBrush(QPalette.Window, QBrush(BASE_COLOR))
        
        self.palette.setBrush(QPalette.WindowText, QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.Foreground, QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.Base, QBrush(BASE_COLOR))
        self.palette.setBrush(QPalette.AlternateBase, QBrush(BASE_COLOR.darker(SPREAD)))
        self.palette.setBrush(QPalette.ToolTipBase, QBrush(BASE_COLOR))
        self.palette.setBrush(QPalette.ToolTipText, QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.Text, QBrush(BASE_COLOR.lighter(SPREAD*1.2)))
        self.palette.setBrush(QPalette.Button, QBrush(BASE_COLOR))
        self.palette.setBrush(QPalette.ButtonText, QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.BrightText, QBrush(QColor(240, 240, 240)))
        
        self.palette.setBrush(QPalette.Light, QBrush(BASE_COLOR.lighter(SPREAD)))
        self.palette.setBrush(QPalette.Midlight, QBrush(BASE_COLOR.lighter(SPREAD/2)))
        self.palette.setBrush(QPalette.Dark, QBrush(BASE_COLOR.darker(SPREAD)))
        self.palette.setBrush(QPalette.Mid, QBrush(BASE_COLOR))    
        self.palette.setBrush(QPalette.Shadow, QBrush(BASE_COLOR.darker(SPREAD*2)))    
        
        self.palette.setBrush(QPalette.Highlight, QBrush(HIGHLIGHT_COLOR))
        self.palette.setBrush(QPalette.HighlightedText, QBrush(HIGHLIGHTEDTEXT_COLOR))
        
        if monochromeText:
            lightness = self.__lightness(BASE_COLOR.lighter(SPREAD*1.2))
            textColor = QColor(lightness*255,lightness*255,lightness*255)
            self.palette.setBrush(QPalette.WindowText, QBrush(textColor))
            self.palette.setBrush(QPalette.Text, QBrush(textColor))
            self.palette.setBrush(QPalette.ButtonText, QBrush(textColor))
            self.palette.setBrush(QPalette.ToolTipText, QBrush(textColor))

        if apply:
            QApplication.setPalette(self.palette)   
    
    def applyScheme(self, target=QApplication):
        """Apply the color scheme in self.palette
        When called without arguments the whole application will be styled
        If a widget is supplied as argument only this widget will be styled
        """
        target.setPalette(self.palette)
    
    def colorFromStringTuple(self,tuple):
        return QColor(int(tuple[0]),int(tuple[1]),int(tuple[2]))
        
    def loadSimpleScheme(self, file, apply=True):
        scheme = ConfigParser.ConfigParser()
        scheme.read(file)
        self.baseColor = self.colorFromStringTuple(scheme.get("AutoColors", "baseColor").split(","))
        self.highlightColor = self.colorFromStringTuple(scheme.get("AutoColors", "highlightColor").split(","))
        self.spread = float(scheme.get("AutoColors", "spread"))
        if apply:
            self.generateScheme()
        else:
            self.generateScheme(apply=False)
    
    def loadScheme(self, file):
        """TODO: Implement
        """
        raise NotImplementedError     
Ejemplo n.º 29
0
 def setBackgroundImage(self, backgroundImg):
     palette = QPalette()
     pixmap = QPixmap(backgroundImg)
     brush = QBrush(pixmap)
     palette.setBrush(QtGui.QPalette.Background, brush)
     self.setPalette(palette)
    def initUI(self):
        QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))
        self.resize(800,600)
        self.center()
        self.setWindowTitle('Character Creation')
        self.setWindowIcon(QtGui.QIcon('icon.png'))
        palette	= QPalette()
        palette.setBrush(QPalette.Background,QBrush(QPixmap("bg.jpg")))
        # Layout
        grid = QtGui.QGridLayout()
        self.setLayout(grid)

        #
        # Strengths:
        # + Less variable handling
        # Weaknesses:
        # + Unable to assign tooltips
        # + DRY
        #
        grid.addWidget(QtGui.QPushButton("new"),0,0)
        grid.addWidget(QtGui.QPushButton("open"),0,1)
        grid.addWidget(QtGui.QPushButton("save"),0,2)
        grid.addWidget(QtGui.QPushButton("export"),0,3)
        grid.addWidget(QtGui.QPushButton("json"),0,4)
        #
        # Strengths:
        # + Less variable handling
        # Weaknesses:
        # + Unable to assign tooltips
        # + Pretty useless since you cant modify button names like this
        #
        for x in range(0,4):
            grid.addWidget(QtGui.QPushButton("btn"),1,x)
        #
        # Strengths:
        # + Less variable handling
        # Weaknesses:
        # + Unable to assign tooltips
        # + You must know the row in advance via this syntax
        #
        [grid.addWidget(QtGui.QPushButton(y),2,x) for x,y in enumerate(["A", "B", "C", "D", "E"])]

        #
        # Strengths:
        # + You get to practice your typing skills
        # + It looks like you've done alot of work due to the high lines of code
        #
        # Weakness:
        # + Continue with this approach and you will not have a concise program
        # +
        btn_create_world = QtGui.QPushButton('Create World', self)
        btn_create_world.setToolTip('This creates a new world for aRPG MUD.')
        btn_create_world.resize(btn_create_world.sizeHint())
        btn_create_world.move(50, 50)

        btn_load_world = QtGui.QPushButton('Load World', self)
        btn_load_world.setToolTip('This loads an existing world for aRPG MUD.')
        btn_load_world.resize(btn_load_world.sizeHint())
        btn_load_world.move(50, 100)

        #
        # Strengths:
        # + Less variable handling
        # + The least syntax heavy
        # Weaknesses:
        # +
        # +
        grid.addWidget(self.createButton("Swag",3,0,"Lots of swag"))
        #
        # Strengths:
        # +
        # + The least syntax heavy
        # Weaknesses:
        # + The createButton() approach does not work well with enumerate since you cant handle tooltips
        # +

        [grid.addWidget(self.createButton(y,4,x, "")) for x,y in enumerate(["Woo", "Meow", "Woof", "Jam"])]
        self.setPalette(palette)

        self.show()
Ejemplo n.º 31
0
 def setPalette(self, onto):
     """sets a background palette for widget onto"""
     palette = QPalette()
     mybrush = self.brush(onto.size())
     palette.setBrush(QPalette.Window, mybrush)
     onto.setPalette(palette)