Esempio n. 1
0
   def createWidgets(self):
      # Create the widgets used in the main window and other parts of the script.
      
      # --- Text Area ----
      self.textArea = QTextEdit()                     # Text editor
      self.textArea.setFont(QFont("Courier", 14))     # Keepin' it simple

      # -- Console Area ---
      self.consoleArea = QTextEdit()                  # Console Area 
      consolePalette = QPalette()                     # A bit more complex
      bgColor = QColor(0, 0, 0)                       #   Green Text with  
      txColor = QColor(0, 255, 0)                     #   Black background 
      consolePalette.setColor(QPalette.Base, bgColor) # 
      consolePalette.setColor(QPalette.Text, txColor) # 
      self.consoleArea.setPalette(consolePalette)     # 
      self.consoleArea.setFont(QFont("Courier", 14))  # Font name and size
      self.consoleArea.setReadOnly(True)              # Read only  

      # --- Debug Area ---
      self.debugArea = QTextEdit()                    # Debug Area
      debugPalette = QPalette()                       # Palette for area
      bgColor = QColor(0, 0, 0)                       # Black Background 
      debugPalette.setColor(QPalette.Base, bgColor)   #
      txColor = QColor(255, 0, 0)                     # Red Text
      debugPalette.setColor(QPalette.Text, txColor)   #
      self.debugArea.setPalette(debugPalette)         #
      self.debugArea.setFont(QFont("Courier", 14))    # Font name and size
      self.debugArea.setReadOnly(True)                # Read only
   
      # --- Results Area ---
      self.resultsArea = QTextEdit()                  # Results Area
      consolePalette = QPalette()                     # A bit more complex
      bgColor = QColor(0, 0, 0)                       #   White Text with  
      txColor = QColor(255, 255, 255)                 #   Black background 
      consolePalette.setColor(QPalette.Base, bgColor) # 
      consolePalette.setColor(QPalette.Text, txColor) # 
      self.resultsArea.setPalette(consolePalette)     # 
      self.resultsArea.setFont(QFont("Courier", 10))  # Font name and size
      self.resultsArea.setReadOnly(True)              # Read only  
      
      # --- Tab Area ---  
      self.tabs = QTabWidget()                       # Tabs
      self.tabs.addTab(self.consoleArea, 'Console')  # Add Console Area tab 
      self.tabs.addTab(self.debugArea,   'Debug'  )  # Add Debug Area tab
      self.tabs.addTab(self.resultsArea, 'Results')  # Add Results Area tab
      # TODO: Change the tab indexes to meaningful words not just 0,1,2
      self.tabs.setTabIcon(0, QIcon(os.path.join(RESOURCE_PATH, "Run.png"     ))) # Add Icon to tab  
      self.tabs.setTabIcon(1, QIcon(os.path.join(RESOURCE_PATH, "Debug.png"   ))) # Add Icon to tab
      self.tabs.setTabIcon(2, QIcon(os.path.join(RESOURCE_PATH, "results.png" ))) # Add Icon to tab
      self.tabs.setIconSize(QSize(30,30))
      self.tabs.setTabShape(QTabWidget.Triangular)   # Set tab shape
def display(sc, title="SVG scene"):
    """Display a scene in a Qdialog
	
	:Parameters:
	 - `sc` (`SVGScene`)
	 - `title` (str) - window title
	"""
    qapp = QApplication.instance()
    if qapp is None:
        qapp = QApplication([])

    dial = QDialog()
    dial.setWindowTitle(title)
    dial.setPalette(QPalette(QColor(255, 255, 255)))
    lay = QVBoxLayout(dial)

    w = QSvgWidget(dial)
    data = QByteArray(str(to_xml(sc)))
    w.load(data)

    r = w.renderer()
    w.setMinimumSize(r.defaultSize())
    lay.addWidget(w)

    dial.show()

    qapp.exec_()
Esempio n. 3
0
 def __init__(self, parent: QWidget = None):
     ContainerWidget.__init__(self, parent)
     pal = QPalette(self.palette())
     self.setMinimumSize(250, 250)
     pal.setColor(QPalette.Background, QColor(55, 50, 47))
     self.setAutoFillBackground(True)
     self.setPalette(pal)
Esempio n. 4
0
    def __init__(self, parent=None):
        super(RenamingOptionsPage, self).__init__(parent)
        self.ui = Ui_RenamingOptionsPage()
        self.ui.setupUi(self)

        self.ui.ascii_filenames.clicked.connect(self.update_examples)
        self.ui.windows_compatibility.clicked.connect(self.update_examples)
        self.ui.rename_files.clicked.connect(self.update_examples)
        self.ui.move_files.clicked.connect(self.update_examples)
        self.ui.move_files_to.editingFinished.connect(self.update_examples)

        self.ui.move_files.toggled.connect(
            partial(enabledSlot, self.toggle_file_moving))
        self.ui.rename_files.toggled.connect(
            partial(enabledSlot, self.toggle_file_renaming))
        self.ui.file_naming_format.textChanged.connect(self.check_formats)
        self.ui.file_naming_format_default.clicked.connect(
            self.set_file_naming_format_default)
        self.highlighter = TaggerScriptSyntaxHighlighter(
            self.ui.file_naming_format.document())
        self.ui.move_files_to_browse.clicked.connect(self.move_files_to_browse)

        textEdit = self.ui.file_naming_format
        self.textEditPaletteNormal = textEdit.palette()
        self.textEditPaletteReadOnly = QPalette(self.textEditPaletteNormal)
        disabled_color = self.textEditPaletteNormal.color(
            QPalette.Inactive, QPalette.Window)
        self.textEditPaletteReadOnly.setColor(QPalette.Disabled, QPalette.Base,
                                              disabled_color)
Esempio n. 5
0
    def paintEvent(self, event):
        self.painter = QPainter()
        self.painter.begin(self)
        if self.zoom >= 3:
            self.painter.setPen(QPalette().foreground().color())

            # draw horizontal lines
            for i in range(self.image.width() + 1):
                self.painter.drawLine(self.zoom * i,
                                      0,
                                      self.zoom * i,
                                      self.zoom * self.image.height())

            # draw vertical lines
            for j in range(self.image.height() + 1):
                self.painter.drawLine(0,
                                      self.zoom * j,
                                      self.zoom * self.image.width(),
                                      self.zoom * j)

            for i in range(self.image.width()):
                for j in range(self.image.height()):
                    rect = self.pixelRect(i, j)
                    if not event.region().intersected(rect).isEmpty():
                        color = QColor.fromRgba(self.image.pixel(QPoint(i, j)))
                        if color.red() < 255:
                            self.painter.fillRect(rect, self.QT_WHITE)
                        self.painter.fillRect(rect, color)
        self.painter.end()
Esempio n. 6
0
    def __init__(self, parent, codigo_inicial=None):
        super(InterpreteLanas, self).__init__()
        self.ventana = parent

        self.refreshMarker = False
        self.multiline = False
        self.command = ''
        self.history = []
        self.historyIndex = -1

        self.interpreterLocals = {'raw_input': self.raw_input,
                                  'input': self.input,
                                  'sys': sys,
                                  'help': help,
                                  'ayuda': self.help}

        palette = QPalette()
        palette.setColor(QPalette.Text, QColor(0, 0, 0))
        self.setPalette(palette)

        if codigo_inicial:
            self.insertar_codigo_falso(codigo_inicial)

        self.marker()
        self.setUndoRedoEnabled(False)
        self.setContextMenuPolicy(Qt.NoContextMenu)

        self.timer_cursor = QTimer()
        self.timer_cursor.start(1000)
        self.timer_cursor.timeout.connect(self.marker_si_es_necesario)
Esempio n. 7
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)
Esempio n. 8
0
    def __init__(self, parent=None):
        Qwt.QwtPlot.__init__(self, parent )
        self.grid=None
        self.setTitle( "Watching TV during a weekend" )
        canvas = Qwt.QwtPlotCanvas()
        canvas.setPalette( QPalette(Qt.gray) )
        canvas.setBorderRadius( 10 )
        self.setCanvas( canvas )

        self.plotLayout().setAlignCanvasToScales( True )

        self.setAxisTitle( Qwt.QwtPlot.yLeft, "Number of People" )
        self.setAxisTitle( Qwt.QwtPlot.xBottom, "Number of Hours" )

        self.legend = Qwt.QwtLegend()
        self.legend.setDefaultItemMode( Qwt.QwtLegendData.Checkable )
        self.insertLegend( self.legend, Qwt.QwtPlot.RightLegend )
        self.populate()

        self.legend.checked['QVariant','bool','int'].connect(self.showItem )

        self.replot() # creating the legend items
        """self.items = Qwt.QwtPlotDict.itemList( Qwt.QwtPlotItem.Rtti_PlotHistogram )
        for i in range(len(self.items)):
            if ( i == 0 ):
                #const QVariant 
                itemInfo = itemToInfo( self.items[i] )
                #QwtLegendLabel *
                legendLabel = legend.legendWidget( itemInfo )
                if ( legendLabel ):
                    legendLabel.setChecked( True )
                self.items[i].setVisible( True )
            else:
                self.items[i].setVisible( False )"""
        self.setAutoReplot( True )
Esempio n. 9
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())
Esempio n. 10
0
    def updateFilledCircle(self, s):
        size = s * self.zoom
        pixmap = QPixmap(self.width(), self.height())
        pixmap.fill(Qt.transparent)
        #painter filled ellipse
        p = QPalette()
        painter = QPainter()
        painter.begin(pixmap)
        painter.setRenderHint(QPainter.Antialiasing)
        brush = QBrush(p.link().color())
        painter.setBrush(brush)
        painter.setOpacity(0.4)
        painter.drawEllipse(
            QRect(self.width() / 2 - size / 2,
                  self.height() / 2 - size / 2, size, size))
        painter.end()
        #painter ellipse 2
        painter2 = QPainter()
        painter2.begin(pixmap)
        painter2.setRenderHint(QPainter.Antialiasing)
        pen2 = QPen(Qt.green)
        pen2.setWidth(1)
        painter2.setPen(pen2)
        painter2.drawEllipse(
            QRect(self.width() / 2 - size / 2,
                  self.height() / 2 - size / 2, size, size))
        painter2.end()

        self.ellipseLabel.setPixmap(QPixmap(pixmap))
        self.lastSize = s
Esempio n. 11
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)
    def __init__(self, parent=None):
        super(AbstractTraitDots, self).__init__(parent)

        self.__minimum = 0
        self.__maximum = 5
        self.__readOnly = False
        self.__value = 0

        # Es gibt anfangs keine verbotenen Werte, also nur eine leere Liste erstellen
        self.__forbiddenValues = []

        # Standardwerte setzen
        self.setMinimum(0)
        self.setMaximum(5)

        # setValue() muß nach dem Füllen der MyAllowedValues-Liste aufgurefen werden, damit die List Einträge besitzt, bevort sie abgefragt wird.
        self.setValue(0)

        # Widget darf nur proportional in seiner Größe verändert werden?
        # Minimalgröße festlegen
        self.__minimumSizeY = 8
        minimumSizeX = self.__minimumSizeY * self.__maximum
        self.setMinimumSize(minimumSizeX, self.__minimumSizeY)
        self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)

        # Setze Farben abhängig von der verwendeten Palette.
        __palette = QPalette()
        self._colorEmpty = __palette.text().color()
        self._colorFull = __palette.highlight().color()
        self._colorFrame = __palette.highlight().color()

        self.maximumChanged.connect(self.resetMinimumSize)
Esempio n. 13
0
    def __init__(self, direction):
        self.dns_lookup_id = 0  
        QDialog.__init__(self)
        self.setupUi(self)
        if (direction == 'OUT'):
            text = 'is trying to connect to'
        if (direction == 'IN'):
            text = 'is being connected to from'
        self.setWindowTitle("Leopard Flower firewall")
        self.label_text.setText(text)
        self.pushButton_allow.clicked.connect(self.allowClicked)
        self.pushButton_deny.clicked.connect(self.denyClicked)
        self.pushButton_hide.setVisible(False)
        self.tableWidget_details.setVisible(False)
        self.rejected.connect(self.escapePressed)
        self.finished.connect(self.dialogFinished)

        fullpath_text = QTableWidgetItem("Full path")
        self.tableWidget_details.setItem(0,0,fullpath_text)
        pid_text = QTableWidgetItem("Process ID")
        self.tableWidget_details.setItem(1,0,pid_text)
        remoteip_text = QTableWidgetItem("Remote IP")
        self.tableWidget_details.setItem(2,0,remoteip_text)
        remotedomain_text = QTableWidgetItem("Remote domain")
        self.tableWidget_details.setItem(3,0,remotedomain_text)
        remoteport_text = QTableWidgetItem("Remote port")
        self.tableWidget_details.setItem(4,0,remoteport_text)
        localport_text = QTableWidgetItem("Local port")
        self.tableWidget_details.setItem(5,0,localport_text)
        #make the incoming dialog stand out. It is not common to receive incoming connections
        if (direction == 'IN'):
            pal = QPalette()
            col = QColor(255, 0, 0, 127)
            pal.setColor(QPalette.Window, col)
            self.setPalette(pal)
Esempio n. 14
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)
Esempio n. 15
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)
Esempio n. 16
0
 def colorChoseButtonClicked(self):
     self.colorDialog.show()
     result = self.colorDialog.exec_()
     if result:
         self.selectDock.colorChooserButton.setPalette(
             QPalette(self.colorDialog.currentColor()))
         self.rectColor = self.colorDialog.currentColor()
         self.iface.mapCanvas().refresh()
Esempio n. 17
0
 def setQuickColor( self, color ):
     """
     Sets the quick color for the palette to the given color.
     
     :param      color | <QColor>
     """
     colorset = XPaletteColorSet()
     colorset.setPalette(QPalette(color))
     self.setColorSet(colorset)
Esempio n. 18
0
 def palette(self):
     if self.__palette is None:
         scene = self.scene()
         if scene is not None:
             return scene.palette()
         else:
             return QPalette()
     else:
         return self.__palette
Esempio n. 19
0
 def __init__(self, parent=None):
     super().__init__(parent)
     palette = QPalette(self.palette())
     palette.setColor(QPalette.Highlight, QColor(Qt.green))
     palette.setColor(QPalette.Window, QColor(Qt.red))
     self.setPalette(palette)
     self.setRange(0, self.MAX)
     self.setTextVisible(False)
     self.buffer = AverageDeque()
    def __init__(self, c, *args, **kwargs):
        QwtDialNeedle.__init__(self, *args, **kwargs)
        palette = QPalette()
        for i in range(QPalette.NColorGroups
                       ):  # ( int i = 0; i < QPalette.NColorGroups; i++ )
            palette.setColor(i, palette.Text, c)

        palette.setColor(QPalette.Base, QColor(0, 0, 0))
        self.setPalette(palette)
Esempio n. 21
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)
Esempio n. 22
0
 def set_palette(self, background, foreground):
     """
     Set text editor palette colors:
     background color and caret (text cursor) color
     """
     palette = QPalette()
     palette.setColor(QPalette.Base, background)
     palette.setColor(QPalette.Text, foreground)
     self.setPalette(palette)
Esempio n. 23
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)
Esempio n. 24
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     self.setMinimumSize(3 * Info.dpi, 3 * Info.dpi)
     self.setWindowTitle('OpenIris: Workspace')
     pal = QPalette(self.palette())
     pal.setColor(self.backgroundRole(), QColor(105, 100, 97))
     self.setPalette(pal)
     self.setAutoFillBackground(True)
     self.__c_widget = OIWSWidget(1, 1, self)
     self.__c_widget.setGeometry(0, 0, self.width(), self.height())
Esempio n. 25
0
    def validateString(self):
        """Override this to provide validation of the contained string. NOT SUPPORTED YET!"""
        string_to_validate = str(self.box_string.text())

        if self.__validator is not None:
            status = self.__validator.validate(string_to_validate)

            if not status:
                self.setValidationMessage(str(status),
                                          HelpedWidget.EXCLAMATION)
                palette = QPalette()
                palette.setColor(QPalette.Text, Qt.red)
                self.box_string.setPalette(palette)
            else:
                self.setValidationMessage("")
                palette = QPalette()
                palette.setColor(QPalette.Text, Qt.black)
                self.box_string.setPalette(palette)
                self.stringBoxChanged()
Esempio n. 26
0
 def setHighlighted(self, highlight):
     """ Highlight the property by changing the background color of the textfield.
     """
     p = QPalette()
     if highlight:
         p.setColor(QPalette.Active, QPalette.ColorRole(9), Qt.red)
     else:
         p.setColor(QPalette.Active, QPalette.ColorRole(9), Qt.white)
     self._lineEdit.setPalette(p)
     self._textEdit.viewport().setPalette(p)
Esempio n. 27
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)       
Esempio n. 28
0
    def change_palette(self, color):
        """Sets the global tooltip background to the given color and initializes reset"""
        self.old_palette = QToolTip.palette()
        p = QPalette(self.old_palette)
        p.setColor(QPalette.All, QPalette.ToolTipBase, color)
        QToolTip.setPalette(p)

        self.timer = QTimer()
        self.timer.timeout.connect(self.try_reset_palette)
        self.timer.start(
            300)  #short enough not to flicker a wrongly colored tooltip
Esempio n. 29
0
 def __init__(self, parent):
     QToolBar.__init__(self, parent)
     pal = QPalette(self.palette())
     pal.setColor(self.backgroundRole(), QColor(105, 100, 97))
     self.setPalette(pal)
     self.setAutoFillBackground(True)
     self.__objects = []
     self.init()
     self.__type = None
     self.__mode = ViewMode
     self.__menu = None
Esempio n. 30
0
    def __init__(self, parent=None, **kwargs):
        super(AddonManagerWidget, self).__init__(parent, **kwargs)

        self.setLayout(QVBoxLayout())

        self.__header = QLabel(
            wordWrap=True,
            textFormat=Qt.RichText
        )
        self.__search = QLineEdit(
            placeholderText=self.tr("Filter")
        )

        self.layout().addWidget(self.__search)

        self.__view = view = QTreeView(
            rootIsDecorated=False,
            editTriggers=QTreeView.NoEditTriggers,
            selectionMode=QTreeView.SingleSelection,
            alternatingRowColors=True
        )
        self.__view.setItemDelegateForColumn(0, TristateCheckItemDelegate())
        self.layout().addWidget(view)

        self.__model = model = QStandardItemModel()
        model.setHorizontalHeaderLabels(["", "Name", "Version", "Action"])
        model.dataChanged.connect(self.__data_changed)
        proxy = QSortFilterProxyModel(
            filterKeyColumn=1,
            filterCaseSensitivity=Qt.CaseInsensitive
        )
        proxy.setSourceModel(model)
        self.__search.textChanged.connect(proxy.setFilterFixedString)

        view.setModel(proxy)
        view.selectionModel().selectionChanged.connect(
            self.__update_details
        )
        header = self.__view.header()
        header.setResizeMode(0, QHeaderView.Fixed)
        header.setResizeMode(2, QHeaderView.ResizeToContents)

        self.__details = QTextBrowser(
            frameShape=QTextBrowser.NoFrame,
            readOnly=True,
            lineWrapMode=QTextBrowser.WidgetWidth,
            openExternalLinks=True,
        )

        self.__details.setWordWrapMode(QTextOption.WordWrap)
        palette = QPalette(self.palette())
        palette.setColor(QPalette.Base, Qt.transparent)
        self.__details.setPalette(palette)
        self.layout().addWidget(self.__details)