Exemple #1
0
    def __init__(self, parent=None, userData=None,inspector = True):
        QWebView.__init__(self, parent)  

        settings = QWebSettings.globalSettings()
        settings.setFontFamily(QWebSettings.StandardFont, 'Helvetica')
        settings.setFontSize(QWebSettings.DefaultFontSize, 12)

        self.webpage = page = PtWebPage(self)        
        self.setPage(page) 
        self.connect(self, SIGNAL('loadFinished(bool)'), self.onLoadFinished)
        self.settings().setAttribute(
                    QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
        #path = os.getcwd()
        #self.settings().setUserStyleSheetUrl(QUrl.fromLocalFile(path + "/myCustom.css"))

        font = QFont("Helvetica")
        font.setPixelSize(12)
        self.setFont(font)
        # or globally:
        # QWebSettings.globalSettings().setAttribute(
        #     QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
        if inspector:
            self.inspector = QWebInspector()
            self.inspector.setPage(self.page())
            self.inspector.hide()

        self.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.page().linkClicked.connect(self._on_page_link_clicked)
Exemple #2
0
 def __init__(self, app=None):
     super(NewWindow, self).__init__()
     self.app = app
     glo = QVBoxLayout(self)
     if os.name == 'nt':
         icp = r_path('static\\images\\favicon.png')
     else:
         icp = r_path('static/images/favicon.png')
     # need to used objective message boxs instead of functions to set font
     self.Arial = QFont("", 15, QFont.Bold)
     self.Arials = QFont("", 10, QFont.Bold)
     # Language support varibels used by translate func
     self.Arabic = None
     self.Runningo = False
     icon = QIcon(icp)
     self.SelfIinit(icon)
     self.center()
     self.Llists(glo)
     self.set_Abutton(icp, glo)
     self.Lists(glo)
     self.Flabel(glo)
     self.set_button(glo)
     self.setLayout(glo)
     mip = self.slchange()
     self.P = rwser(mip[1].split(',')[1], mip[0], self.app)
     self.activateWindow()
     self.show()
Exemple #3
0
    def __init__(self, title, subtitle, icon_path):
        """
        :param title: str title
        :param subtitle: str subtitle
        :param icon_path: path of picture
        """
        super(MyLable, self).__init__()
        self.lb_title = QLabel(title)
        self.lb_title.setFont(QFont("Arial", 10, QFont.Bold))
        self.lb_subtitle = QLabel(subtitle)
        self.lb_subtitle.setFont(QFont("Arial", 8, QFont.StyleItalic))

        self.lb_subtitle1 = QLabel(subtitle)
        self.lb_subtitle1.setFont(QFont("Arial", 8, QFont.StyleItalic))

        self.lb_icon = QLabel()
        self.lb_icon.setFixedSize(40, 40)
        pixMap = QPixmap(icon_path).scaled(self.lb_icon.width(), self.lb_icon.height())
        self.lb_icon.setPixmap(pixMap)

        self.lb_icon1 = QLabel()
        self.lb_icon1.setFixedSize(40, 40)
        pixMap1 = QPixmap(icon_path).scaled(self.lb_icon.width(), self.lb_icon.height())
        self.lb_icon1.setPixmap(pixMap1)

        self.double_click_fun = None
        self.init_ui()
Exemple #4
0
 def setTitleFont(self):
     '''
     Sets font for the widget text
     '''
     fontValue = QFont('Times New Roman')
     fontValue.setPointSize(fontValue.pointSize() + 15)
     self.setFont(fontValue)
Exemple #5
0
def createFontBoxesFor(parent,
                       name,
                       family,
                       size,
                       *,
                       mono=False,
                       tooltips=None,
                       which="Font"):
    font = QFont(family, size)
    fontComboBox = QFontComboBox(parent)
    if not mono:
        fontFilter = QFontComboBox.ScalableFonts
    else:
        fontFilter = (QFontComboBox.ScalableFonts
                      | QFontComboBox.MonospacedFonts)
    fontComboBox.setFontFilters(fontFilter)
    fontComboBox.setCurrentFont(font)
    fontSizeSpinBox = QSpinBox(parent)
    fontSizeSpinBox.setAlignment(Qt.AlignRight)
    fontSizeSpinBox.setRange(6, 36)
    fontSizeSpinBox.setSuffix(" pt")
    fontSizeSpinBox.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
    fontSizeSpinBox.setValue(font.pointSize())
    if tooltips is not None:
        tooltips.append((fontComboBox, """\
<p><b>{0} Font</b></p><p>The font family to use for the {0} Font.</p>""".
                         format(which)))
        tooltips.append((fontSizeSpinBox, """\
<p><b>{0} Font Size</b></p><p>The font point size to use for the {0}
Font.</p>""".format(which)))
    setattr(parent, "{}FontComboBox".format(name.lower()), fontComboBox)
    setattr(parent, "{}FontSizeSpinBox".format(name.lower()), fontSizeSpinBox)
Exemple #6
0
	def optionsf(self):
		self.opt = optdlg(self)
		self.opt.spinBox.setProperty("value", int(self.fontsize))
		font = QFont()
		font.setPixelSize(int(self.fontsize))
		self.opt.sampletxt.setFont(font)

		if str(self.clipauto) == "True":
			self.opt.checkclip.setChecked(True)
		elif str(self.clipauto) == "False":
			self.opt.checkclip.setChecked(False)

		if str(self.histdock) == "True":
			self.opt.checkshowhistdock.setChecked(True)
		elif str(self.histdock) == "False":
			self.opt.checkshowhistdock.setChecked(False)

		if str(self.bkmdock) == "True":
			self.opt.checkshowbkmdock.setChecked(True)
		elif str(self.bkmdock) == "False":
			self.opt.checkshowbkmdock.setChecked(False)

		self.opt.show()
		self.connect(self.opt.buttonBox, SIGNAL("accepted()"), self.optok)
		self.connect(self.opt.buttonBox.button(QDialogButtonBox.Apply), SIGNAL("clicked()"), self.optapply)
		self.connect(self.opt.checkdelhist, SIGNAL("stateChanged(int)"), self.deleteallhist)
		self.connect(self.opt.checkshowhistdock, SIGNAL("stateChanged(int)"), self.shownexttime)
		self.connect(self.opt.checkshowbkmdock, SIGNAL("stateChanged(int)"), self.shownexttime)
Exemple #7
0
 def __init__(self):
     super(CC_window, self).__init__()
     self.version = '0.2'
     glo = QVBoxLayout(self)
     self.Runningo = None
     self.Looping = None
     self.P = CC_thread()
     if name == 'nt':
         ficon = r_path('images\\favicon.png')
         licon = r_path('images\\logo.png')
     else:
         ficon = r_path('images/favicon.png')
         licon = r_path('images/logo.png')
     self.tf = QFont("", 13, QFont.Bold)
     self.sf = QFont("", 10, QFont.Bold)
     self.SelfIinit(QIcon(ficon))
     self.center()
     self.a_btn(licon, glo)
     self.ss_btns(glo)
     self.i_list(glo)
     self.cl_btn(glo)
     self.l_btns(glo)
     self.f_btns(glo)
     self.ds_bar(glo)
     self.setLayout(glo)
     self.activateWindow()
     self.show()
Exemple #8
0
def main():

    Config = FabricEngine.FabricUI.Util.Config
    rootCfg = Config()
    cfg = rootCfg.getOrCreateSection("TestSection")
    cfg.setAccess(Config.Access.ReadWrite)

    def assertEqual(a, b):
        assert a == b

    # tests if the value is the same when exported and imported
    def testValues(method, value1, value2):

        v = method(method.__name__ + ".test", value1)
        assertEqual(value1, v)

        v = method(method.__name__ + ".test", value2)
        assertEqual(value1, v)

        v = method(method.__name__ + ".otherTest", value2)
        assertEqual(value2, v)

    testValues(cfg.getOrCreateBool, True, False)
    testValues(cfg.getOrCreateDouble, 3.14, -1.71)
    #testValues( cfg.getOrCreateFloat, -7.953, 1 ) # doesn't work : there are no Float32 in Python
    testValues(cfg.getOrCreateInt, -185, 3347)
    testValues(cfg.getOrCreateQColor, QColor(12, 84, 63),
               QColor(255, 128, 200))
    testValues(cfg.getOrCreateQString, "text1", "${ANOTHER}/Text")
    testValues(cfg.getOrCreateQFont, QFont("Roboto", 10), QFont())

    del rootCfg
Exemple #9
0
 def paintEvent(self, event):
     """ Paints the widgets:
      - paints the background
      - paint each visible blocks that intersects the widget bbox.
     """
     painter = QPainter(self)
     painter.fillRect(event.rect(), self.back_brush)
     painter.setPen(self.text_pen)
     painter.setFont(self.font)
     w = self.width() - 2
     # better name lookup speed
     painter_drawText = painter.drawText
     align_right = Qt.AlignRight
     normal_font = painter.font()
     normal_font.setBold(False)
     bold_font = QFont(normal_font)
     bold_font.setBold(True)
     active = self.editor.codeEdit.textCursor().blockNumber()
     for vb in self.editor.codeEdit.visible_blocks:
         row = vb.row
         if row == active + 1:
             painter.setFont(bold_font)
         else:
             painter.setFont(normal_font)
         painter_drawText(0, vb.top, w, vb.height, align_right,
                          str(row))
     return Panel.paintEvent(self, event)
Exemple #10
0
    def middle_dock_create(self):
        self.frekv = QLabel()
        self.frekv.setFont(QFont("DejaVu Sans", 26))
        self.write_frekv()

        self.btnstepleft = QPushButton("<")
        self.btnseekdown = QPushButton("<<")
        self.btnseekup = QPushButton(">>")
        self.btnstepright = QPushButton(">")

        self.laybtnmv = QHBoxLayout()
        self.laybtnmv.addWidget(self.btnseekdown)
        self.laybtnmv.addWidget(self.btnstepleft)
        self.laybtnmv.addWidget(self.btnstepright)
        self.laybtnmv.addWidget(self.btnseekup)

        self.labelrdsdt = QLabel("RDS")
        self.labelrdsdt.setFont(QFont("DejaVu Sans", 12))

        self.frekvlayout = QHBoxLayout()
        self.frekvlayout.addWidget(self.frekv)
        self.frekvlayout.setAlignment(Qt.AlignCenter)

        self.middlelayout = QVBoxLayout()
        self.middlelayout.addLayout(self.frekvlayout)
        self.middlelayout.addLayout(self.laybtnmv)
        self.middlelayout.addWidget(self.labelrdsdt)
Exemple #11
0
    def initUI(self):
        self.setWindowTitle('TickTackToe 2000')

        self.resize(350, 350)
        self.center()

        self.main_layout = QVBoxLayout()

        self.form_layout = QGridLayout()
        self.main_layout.addLayout(self.form_layout)

        splitter = QSplitter(QtCore.Qt.Horizontal)
        self.main_layout.addWidget(splitter)

        self.game_layout = QGridLayout()
        self.main_layout.addLayout(self.game_layout)

        self.server_label = QLabel("Server: ")
        self.server_input = QLineEdit("127.0.0.1")
        self.form_layout.addWidget(self.server_label, 0, 0)
        self.form_layout.addWidget(self.server_input, 0, 1)

        self.port_label = QLabel("Port: ")
        self.port_input = QLineEdit("1632")
        self.form_layout.addWidget(self.port_label, 1, 0)
        self.form_layout.addWidget(self.port_input, 1, 1)

        self.connect_button = QPushButton("Connect")
        self.connect_button.setMinimumHeight(60)
        self.connect_button.pressed.connect(self.reconnect)
        self.form_layout.addWidget(self.connect_button, 0, 2, 2, 1)

        self.game_fields = {}

        tile_font = QFont()
        tile_font.setPointSize(30)

        for x in range(0, GAME_SIZE):
            for y in range(0, GAME_SIZE):
                f = QPushButton(" ")
                f.setMinimumHeight(90)
                f.setDisabled(True)
                f.setFont(tile_font)
                f.clicked.connect(self.onGameButtonClicked)

                if x in self.game_fields:
                    self.game_fields[x][y] = f
                else:
                    self.game_fields[x] = { 0: f }

                self.game_layout.addWidget(f, y, x)

        central_widget = QtGui.QWidget()
        central_widget.setLayout(self.main_layout)
        self.setCentralWidget(central_widget)

        self.statusBar().showMessage("")

        self.show()
Exemple #12
0
    def sizeHint(self, option, index):
        '''Custom size calculation of our items'''

        uid = to_str(index.data(role=IDROLE)) + 'x' + str(option.rect.width(
        ))  #Fix Bug #967 (sometime uid have some strange unicode chars ... ?)
        try:
            return self.memoized_size[uid]
        except:
            tweet = to_str(index.data(Qt.DisplayRole))

            # One time is enought sizeHint need to be fast

            if not self.fm:
                self.normFont = QFont(option.font)
                self.normFont.setPointSizeF(option.font.pointSizeF() *
                                            self.fsize)
                self.fm = QFontMetrics(self.normFont)

            if not self.minifm:
                self.miniFont = QFont(option.font)
                self.miniFont.setPointSizeF(option.font.pointSizeF() * 0.8 *
                                            self.fsize)
                self.minifm = QFontMetrics(self.miniFont)

            height = self.fm.boundingRect(
                0,
                0,
                option.rect.width() - 75,
                800,
                int(Qt.AlignTop) | int(Qt.AlignLeft) | int(Qt.TextWordWrap),
                tweet,
            ).height()

            reply_text = to_str(index.data(role=REPLYTEXTROLE))
            if reply_text:
                height += self.minifm.boundingRect(
                    0,
                    0,
                    option.rect.width() - 75,
                    800,
                    int(Qt.AlignTop) | int(Qt.AlignLeft)
                    | int(Qt.TextWordWrap),
                    reply_text,
                ).height() + 5

            height += self.minifm.boundingRect(
                0,
                0,
                option.rect.width() - 75,
                800,
                int(Qt.AlignTop) | int(Qt.AlignLeft) | int(Qt.TextWordWrap),
                'LpqAT',
            ).height()
            height += 10  # Spacer

            if height < 70:
                height = 70
            self.memoized_size[uid] = QSize(option.rect.width(), height)
            return self.memoized_size[uid]
Exemple #13
0
 def __init__(self, width=8):
     super(StringHexTableModel, self).__init__()
     self.width = width
     self.byte_data = ""
     self.start_address = 0
     self.set_data("i.MX toolkit \x02\x03 test" * 50, 0xfeedcafe)
     self.font = QFont("Monospace")
     self.font.setStyleHint(QFont.TypeWriter)
Exemple #14
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.displayFont = QFont()
     self.displayFont.setStyleStrategy(QFont.PreferDefault)
     self.updateFont(self.displayFont.family())
     self.currentChar = ""
     self.setMouseTracking(True)
     self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)
Exemple #15
0
    def sizeHint(self, option, index):
        '''Custom size calculation of our items'''

        uid = to_str(index.data(role=IDROLE)) + 'x' + str(option.rect.width()) #Fix Bug #967 (sometime uid have some strange unicode chars ... ?)
        try:
            return self.memoized_size[uid]
        except:
            tweet = to_str(index.data(Qt.DisplayRole))

            # One time is enought sizeHint need to be fast

            if not self.fm:
                self.normFont = QFont(option.font)
                self.normFont.setPointSizeF(option.font.pointSizeF()
                        * self.fsize)
                self.fm = QFontMetrics(self.normFont)

            if not self.minifm:
                self.miniFont = QFont(option.font)
                self.miniFont.setPointSizeF(option.font.pointSizeF()
                        * 0.8 * self.fsize)
                self.minifm = QFontMetrics(self.miniFont)

            height = self.fm.boundingRect(
                0,
                0,
                option.rect.width() - 75,
                800,
                int(Qt.AlignTop) | int(Qt.AlignLeft) | int(Qt.TextWordWrap),
                tweet,
                ).height()

            reply_text = to_str(index.data(role=REPLYTEXTROLE))
            if reply_text:
                height += self.minifm.boundingRect(
                    0,
                    0,
                    option.rect.width() - 75,
                    800,
                    int(Qt.AlignTop) | int(Qt.AlignLeft)
                        | int(Qt.TextWordWrap),
                    reply_text,
                    ).height() + 5

            height += self.minifm.boundingRect(
                0,
                0,
                option.rect.width() - 75,
                800,
                int(Qt.AlignTop) | int(Qt.AlignLeft) | int(Qt.TextWordWrap),
                'LpqAT',
                ).height()
            height += 10  # Spacer

            if height < 70:
                height = 70
            self.memoized_size[uid] = QSize(option.rect.width(), height)
            return self.memoized_size[uid]
Exemple #16
0
 def drawScore(self, painter):
     """ Draw the Score label """
     font = QFont()
     font.setPointSize(24)
     penColor = QColor(238, 250, 12)
     
     painter.setFont(font)
     painter.setPen(penColor)
     painter.drawText(10, 50, "Score: {0:,}".format(self.level.score))
Exemple #17
0
    def __init__(self, parent, order_overview_widget):
        global configuration
        super(PostViewScene, self).__init__(parent)
        self.base_font = QFont()

        self.base_font_big = QFont()
        self.base_font_big.setPointSize(self.base_font.pointSize() * 1.5)
        if configuration.font_select:
            self.base_font_big.setPointSize(self.base_font.pointSize() * 2)
Exemple #18
0
 def drawPaused(self, painter):
     """ Draw the Paused Message """
     font = QFont()
     font.setPointSize(48)
     penColor = QColor(238, 250, 12)
     
     painter.setFont(font)
     painter.setPen(penColor)
     painter.drawText(self.contentsRect(), Qt.AlignCenter, "Paused")
Exemple #19
0
 def drawGameOver(self, painter):
     """ Draw the Game Over Message """
     font = QFont()
     font.setPointSize(48)
     penColor = QColor(255, 0, 0)
     
     painter.setFont(font)
     painter.setPen(penColor)
     painter.drawText(self.contentsRect(), Qt.AlignCenter, "Game Over")
 def setupLevelCompletionLabel(self):
     """ Setup the Power Label """
     self.font = QFont()
     self.font.setPointSize(32)
     
     self.levelCompletionLabel = QLabel("You Won!", self)
     self.levelCompletionLabel.move(32, 16)
     self.levelCompletionLabel.setFont(self.font)
     self.levelCompletionLabel.setVisible(False)
 def setupCompletionDetailsLabel(self):
     """ Setup the Remaining Mines Label """
     self.font = QFont()
     self.font.setPointSize(24)
     
     self.completionDetailsLabel = QLabel("Destroyed!", self)
     self.completionDetailsLabel.move(32, 64)
     self.completionDetailsLabel.setFont(self.font)
     self.completionDetailsLabel.setVisible(False)
Exemple #22
0
class AdjacencyClueView(QFrame):  # Prolly could use a better name
    """ Represents the Adjacency Clue View """
    TRANSPARENCY = 100

    def __init__(self, adjacencyClue, fragilityClue, parent=None):
        """ Initialize the Adjacency Clue View """
        QFrame.__init__(self, parent)
        self.adjacencyClue = adjacencyClue
        self.fragilityClue = fragilityClue
        self.resize(34, 32)
        self.setupClueLabel()

    def setupFont(self):
        """ Setup the Font """
        self.font = QFont()
        self.font.setPointSize(15)

    def setupClueLabel(self):
        """ Setup the Clue Label """
        self.setupFont()
        self.clueLabel = QLabel('', self)
        self.clueLabel.setFont(self.font)
        self.clueLabel.move(0, 0)

    def updateView(self):
        """ Update the View """
        self.clueLabel.setText(self.getLabelText())
        self.setColorBasedOnFragility()
        self.clueLabel.resize(34, self.clueLabel.contentsRect().height())

    def getLabelText(self):
        """ Get the CLue Reading Text """
        adjacentMines = self.adjacencyClue.getAdjacentMinesClue()
        if adjacentMines == 0:
            return ''
        else:
            return str(adjacentMines)

    def setColorBasedOnFragility(self):
        """ Set color of the clue based on adjacency to Fragile Mines """
        color = "rgba({0}, {1}%)".format(self.getColor(), self.TRANSPARENCY)
        self.clueLabel.setStyleSheet("QLabel { color : %s }" % color)

    def getColor(self):
        """ Return color """
        if self.fragilityClue.distance is None:
            return "0, 0, 0"
        elif self.fragilityClue.distance <= 1:
            if self.fragilityClue.count == 1:
                return "227, 68, 20"
            else:
                return "196, 0, 0"
        elif self.fragilityClue.distance > 1 and self.fragilityClue.distance < 4:
            return "244, 244, 0"
        elif self.fragilityClue.distance >= 4:
            return "0, 154, 0"
Exemple #23
0
class AdjacencyClueView(QFrame): # Prolly could use a better name
    """ Represents the Adjacency Clue View """
    TRANSPARENCY = 100
    
    def __init__(self, adjacencyClue, fragilityClue, parent=None):
        """ Initialize the Adjacency Clue View """
        QFrame.__init__(self, parent)
        self.adjacencyClue = adjacencyClue
        self.fragilityClue = fragilityClue
        self.resize(34, 32)
        self.setupClueLabel()
        
    def setupFont(self):
        """ Setup the Font """
        self.font = QFont()
        self.font.setPointSize(15)
        
    def setupClueLabel(self):
        """ Setup the Clue Label """
        self.setupFont()
        self.clueLabel = QLabel('', self)
        self.clueLabel.setFont(self.font)
        self.clueLabel.move(0, 0)
        
    def updateView(self):
        """ Update the View """
        self.clueLabel.setText(self.getLabelText())
        self.setColorBasedOnFragility()
        self.clueLabel.resize(34, self.clueLabel.contentsRect().height())
        
    def getLabelText(self):
        """ Get the CLue Reading Text """
        adjacentMines = self.adjacencyClue.getAdjacentMinesClue()
        if adjacentMines == 0:
            return ''
        else:
            return str(adjacentMines)
        
    def setColorBasedOnFragility(self):
        """ Set color of the clue based on adjacency to Fragile Mines """
        color = "rgba({0}, {1}%)".format(self.getColor(), self.TRANSPARENCY)
        self.clueLabel.setStyleSheet("QLabel { color : %s }" % color)
        
    def getColor(self):
        """ Return color """
        if self.fragilityClue.distance is None:
            return "0, 0, 0"
        elif self.fragilityClue.distance <= 1:
            if self.fragilityClue.count == 1:
                return "227, 68, 20"
            else:
                return "196, 0, 0"
        elif self.fragilityClue.distance > 1 and self.fragilityClue.distance < 4:
            return "244, 244, 0"
        elif self.fragilityClue.distance >= 4:
            return "0, 154, 0"
Exemple #24
0
	def setfontsize(self, i):
		if i >= 8 or i <= 24:
			font = QFont()
			font.setPixelSize(i)
			self.comboBox.setFont(font)
			self.searchbtn.setFont(font)
			self.bkmli.setFont(font)
			self.histli.setFont(font)
			self.listview.setFont(font)
			self.tamtext.setFont(font)
Exemple #25
0
    def __init__(self, view, uistack, widget):
        f = QFont('FreeMono')
        f.setWeight(QFont.Black)
        f.setPixelSize(16)

        self.grids = []
        self.colors = []

        self._view = view

        for p in providers:
            view.colors.addItem(p.name)
        view.colors.currentIndexChanged.connect(self.colorchange)

        self._detailview = view.detail
        self._detailview.scale(10, 10)

        self._lastdepth = -1
        self._detail = None
        self.add()

        view.layer.sliderMoved.connect(self.layer)
        view.detailLayer.sliderMoved.connect(self.detaillayer)

        self._view.add.pressed.connect(self.add)

        def detailevent(event):
            if (isinstance(event, QKeyEvent) and
                    event.text() == u'\t' and
                    event.type() == QEvent.ShortcutOverride):
                widget.keyPressEvent(QKeyEvent(
                    QEvent.KeyPress,
                    event.key(),
                    event.nativeModifiers(),
                    event.text(),
                    event.isAutoRepeat(),
                    event.count()))
                return True
            return QWidget.event(widget, event)

        widget.event = detailevent
        widget.keyPressEvent = self.key

        view.rotation.valueChanged.connect(self.rotate)

        view.layer.setValue(view.layer.maximum())

        self._view.showDetail.pressed.connect(self.showdetail)
        self._view.hideDetail.pressed.connect(self.hidedetail)
        self.hidedetail()

        self._view.pentagon.pressed.connect(self.pentagon)

        self._uistack = uistack
Exemple #26
0
 def font(bold):
     """
     Returns a `QFont` object to be used in `View` derived classes.
     
     :param bold: Indicates whether or not the font will be bold
     """
     
     font = QFont(View.fontFamily, 9, 50, False)
     font.setBold(bold)
     
     return font
Exemple #27
0
    def font(bold):
        """
        Returns a `QFont` object to be used in `View` derived classes.
        
        :param bold: Indicates whether or not the font will be bold
        """

        font = QFont(View.fontFamily, 9, 50, False)
        font.setBold(bold)

        return font
Exemple #28
0
 def __init__(self, txt=None):
     super(ConfigTableHeaderItem, self).__init__(txt)
     # first we customize the appearance
     self.setTextAlignment(Qt.AlignCenter)
     this_font = QFont()
     this_font.setBold(True)
     this_font.setPointSize(7)
     self.setBackground(QBrush(Qt.white))
     self.setFont(this_font)
     self.setForeground(Qt.black)
     self.setFlags(Qt.ItemIsEnabled)
     return
Exemple #29
0
    def init_font_config(self):
        self.disasm_font = QFont("DejaVu Sans Mono", 10)
        font_metrics = QFontMetricsF(self.disasm_font)
        self.disasm_font_height = font_metrics.height()
        self.disasm_font_width = font_metrics.width('A')
        self.disasm_font_ascent = font_metrics.ascent()

        self.symexec_font = QFont("DejaVu Sans Mono", 10)
        font_metrics = QFontMetricsF(self.symexec_font)
        self.symexec_font_height = font_metrics.height()
        self.symexec_font_width = font_metrics.width('A')
        self.symexec_font_ascent = font_metrics.ascent()
Exemple #30
0
 def __init__(self, parent=None):
     super(QConsole, self).__init__(parent)
     font = QFont("Monospace", 9)
     font.setStyleHint(QFont.TypeWriter)
     self.setFont(font)
     # self.setFontWeight(QFont.Light)
     # self.setFontPointSize(9)
     self.setTextColor(QColor("LightGreen"))
     p = self.palette()
     p.setColor(QPalette.Base, QColor(0, 0, 0))
     self.setPalette(p)
     self.setText(">\n")
Exemple #31
0
 def load_layout_list(self, settings):
     self.layout_list.clear()
     for menu_item in settings:
         font = QFont()
         if menu_item == 'pin_notes' or menu_item == 'notes':
             font.setStyle(QFont.StyleItalic)
         else:
             font.setWeight(QFont.DemiBold)
         item = QListWidgetItem(self.layout_labels[menu_item])
         item.setData(Qt.UserRole, menu_item)
         item.setTextAlignment(Qt.AlignCenter)
         item.setFont(font)
         self.layout_list.addItem(item)
Exemple #32
0
 def getFontMetrics(self, family, pixelSize):
     """
 @param  family  str
 @param  pixelSize  int
 @return  QFontMetrics
 """
     key = pixelSize, family
     ret = self.fontMetrics.get(key)
     if not ret:
         font = QFont(family)
         font.setPixelSize(pixelSize)
         ret = self.fontMetrics[key] = QFontMetrics(font)
     return ret
Exemple #33
0
 def paintEvent(self, pe):
     painter = QPainter(self)
     painter.save()
     gradient = QLinearGradient()
     gradient.setStart(self._grad_start)
     gradient.setFinalStop(self._grad_end)
     gradient.setColorAt(0, QColor(230, 230, 230))
     gradient.setColorAt(1, QColor(247, 247, 247))
     brush = QBrush(gradient)
     painter.setBrush(brush)
     pen = QPen(Qt.black)
     pen.setWidth(1)
     painter.setPen(pen)
     painter.drawPath(self._painter_path)
     painter.restore()
     font = QFont()
     font.setFamily("Tahoma")
     font.setPixelSize(11)
     font.setBold(True)
     pen = QPen(Qt.darkGray)
     painter.setPen(pen)
     painter.setFont(font)
     self_rect = QRect(self.rect())
     self_rect.moveTo(self._hor_margin, self._ver_margin // 2)
     painter.drawText(self_rect, Qt.AlignLeft, self._text)
Exemple #34
0
 def initFont(self):
     self.tabStop = 4
     self.font = QFont('Courier')
     self.metrics = QFontMetrics(self.font)
     self.t.setTabStopWidth(self.tabStop * self.metrics.width(' '))
     self.font.setStyleHint(QFont.Monospace)
     self.font.setFixedPitch(True)
     self.font.setPointSize(12)
     self.p = self.t.palette()
     self.p.setColor(QPalette.Base, QColor(0, 0, 0))
     self.p.setColor(QPalette.Text, QColor(255, 255, 255))
     self.t.setPalette(self.p)
     self.t.setFont(self.font)
     self.highlighter = Highlighter(self.t.document())
Exemple #35
0
def CreateFlatButton(action):
    """
	Create a custom flat button and style
	it so that it will look good on all platforms.
	"""

    toolButton = QToolButton()
    toolButton.setIcon(action.icon())
    toolButton.setText(action.text())
    toolButton.setAutoRaise(True)
    toolButton.setIconSize(QSize(32, 32))
    toolButton.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
    if sys.platform.startswith('darwin'):
        # Bug for Mac: QToolButtons do not react to setAutoRaise so
        # can't be made flat when they are not used inside a toolbar.
        # Setting a custom style sheet with border to none fixes this.
        # But then it looses all its highlight and pressed visual cues
        # so some extra styling needs to be done to provide some nice
        # visual feedback on hover and pressed states.
        toolButton.setStyleSheet(
            "QToolButton {"
            "border: none;"
            "} "
            "QToolButton:hover {"
            "background-color: qradialgradient(cx: 0.5, cy: 0.5,"
            "fx: 0.5, fy: 0.5,"
            "radius: 0.5, "
            "stop: 0 rgba(255, 255, 255, 100), "
            "stop: 1 rgba(0, 0, 0, 0));"
            "}"
            "QToolButton:pressed {"
            "background-color: qradialgradient(cx: 0.5, cy: 0.5,"
            "fx: 0.5, fy: 0.5,"
            "radius: 0.5, "
            "stop: 0 rgba(255, 255, 255, 200), "
            "stop: 1 rgba(0, 0, 0, 0));"
            "}")
    font = QFont()
    font.setPixelSize(10)
    toolButton.setFont(font)

    # Connect the clicked signal to the action trigger
    def pushed():
        toolButton.action.triggered.emit()

    setattr(toolButton, "pushed", pushed)
    toolButton.clicked.connect(toolButton.pushed)
    setattr(toolButton, "action", action)

    return toolButton
Exemple #36
0
 def __init__(self, repo, selected_items, parent=None):
     super(CommitDialog, self).__init__(parent=parent)
     self.repo = repo
     self.dialog_buttons.button(QDialogButtonBox.Ok).setEnabled(False)
     self.selected_items = selected_items
     if len(selected_items) == 1 and isinstance(selected_items[0],
             WorkspaceDirectory):
         self.root_dir = selected_items[0]
     else:
         self.root_dir = None
     fixed_font = QFont('Courier', self.message_text.font().pointSize())
     fixed_font.setStyleHint(QFont.Monospace)
     self.message_text.setFont(fixed_font)
     self.text_pos_label.setFont(fixed_font)
     with busy_cursor():
         self.staged_changes_model = StagedChangesModel(repo, self.root_dir,
             parent=self)
         self.local_changes_model = LocalChangesModel(repo.workspace,
             parent=self)
         self.local_changes_model.file_source = lambda: tuple(deep_item
             for selected_item in selected_items
             for deep_item in deep_file_list(selected_item)
             if exclude_unmodified(deep_item) and exclude_ignored(deep_item))
         if self.root_dir:
             self.staged_changes_button.setChecked(True)
             self.show_staged_changes()
         else:
             self.local_changes_button.setChecked(True)
             self.show_local_changes()
         if self.repo.head_ref:
             (self.last_commit,) = self.repo.log(max_commits=1)
         else:
             self.last_commit = None
             self.action_reuse_last_msg.setEnabled(False)
             self.action_reuse_log_msg.setEnabled(False)
             self.amend_checkbox.setEnabled(False)
     self.staged_changes_button.clicked.connect(self.show_staged_changes)
     self.local_changes_button.clicked.connect(self.show_local_changes)
     self.local_changes_model.dataChanged.connect(self.local_change_toggled)
     self.message_text.cursorPositionChanged.connect(self.text_pos_changed)
     self.message_text.textChanged.connect(self.message_text_changed)
     reuse_menu = QMenu()
     reuse_menu.addAction(self.action_reuse_last_msg)
     reuse_menu.addAction(self.action_reuse_log_msg)
     self.reuse_msg_button.setDefaultAction(self.action_reuse_last_msg)
     self.reuse_msg_button.setMenu(reuse_menu)
     self.action_reuse_last_msg.triggered.connect(self.reuse_last_message)
     self.action_reuse_log_msg.triggered.connect(self.select_old_message)
     self.amend_checkbox.toggled.connect(self.amend_toggled)
    def __CreateGrid(self):
        g1 = QGridLayout()
        self.centralWidget().setLayout(g1)

        g1.setSpacing(5)

        bold = QFont()
        bold.setBold(True)
        self.__AddGridLabel(g1, 'Source Directory:', QFont(), 0, 0, -1)
        self.__AddGridLabel(g1, 'Archive Directory:', QFont(), 1, 0, -1)
        self.__AddGridLabel(g1, 'Target Directory:', QFont(), 2, 0, -1)
        self.__AddGridLabel(g1, 'Max Number of Videos:', QFont(), 3, 0, -1)
        self.__AddGridLabel(g1, 'Video File Types:', QFont(), 3, 2, -1)
        #self.__AddGridLabel(g1, 'Max Run Time in Hours:', QFont(), 4, 2, -1)

        g1.addWidget(self.qleSourceDir, 0, 1, 1, 3)
        g1.addWidget(self.qleArchiveDir, 1, 1, 1, 3)
        g1.addWidget(self.qleDestinationDir, 2, 1, 1, 3)
        g1.addWidget(self.qleMaxVidsCap, 3, 1)
        g1.addWidget(self.qleVideoTypes, 3, 3)
        #g1.addWidget(self.qleRunTimeMax, 4, 3)
        
        g1.addWidget(self.qpbRun, 10, 3, alignment = -1)
        
        g1.addWidget(QLabel('', self), 4, 0,) # Empty Column As Separator
        g1.addWidget(QLabel('', self), 5, 0,) # Empty Column As Separator
        
        self.__AddGridLabel(g1, 'Videos Completed:',   bold, 5, 0, -1)
        self.__AddGridLabel(g1, 'Start Time:',         bold, 5, 2, -1)
        self.__AddGridLabel(g1, 'Videos In Progress:', bold, 6, 0, -1)
        self.__AddGridLabel(g1, 'Time Remaining:',     bold, 7, 2, -1)
        self.__AddGridLabel(g1, 'Target Space Left:',  bold, 7, 0, -1)
        self.__AddGridLabel(g1, 'Archive Space Left:', bold, 8, 0, -1)
        self.__AddGridLabel(g1, 'End Time:',           bold, 6, 2, -1)
        self.__AddGridLabel(g1, 'Processing Speed:',   bold, 8, 2, -1)
        
        g1.addWidget(self.qlVidsDone,        5, 1,) 
        g1.addWidget(self.qlVidsInProgress,  6, 1)
        g1.addWidget(self.qlStartTime,       5, 3,) 
        g1.addWidget(self.qlEndTime,         6, 3,) 
        g1.addWidget(self.qlTimeLeft,        7, 3,) 
        g1.addWidget(self.qlDestinationSpace,     7, 1,) 
        g1.addWidget(self.qlArcSpace,        8, 1,)
        g1.addWidget(self.qlProcessingSpeed, 8, 3,)
        
        g1.addWidget(self.qpbSourceDir,      0, 4,)
        g1.addWidget(self.qpbArchiveDir,     1, 4,)
        g1.addWidget(self.qpbTargetDir,      2, 4,)        
        self.show
Exemple #38
0
    def __init__(self, parent, level, levelSelection):
        """ Initialize the Level Overview View """
        QFrame.__init__(self, parent)

        self.resize(self.WIDTH, self.HEIGHT)
        self.level = level
        self.levelSelection = levelSelection

        self.bigFont = QFont()
        self.bigFont.setPointSize(32)

        self.smallFont = QFont()
        self.smallFont.setPointSize(24)

        self.label = self.getLabel(self.smallFont)
Exemple #39
0
    def __init__(self, parent, level, levelSelection):
        """ Initialize the Level Overview View """
        QFrame.__init__(self, parent)

        self.resize(self.WIDTH, self.HEIGHT)
        self.level = level
        self.levelSelection = levelSelection

        self.bigFont = QFont()
        self.bigFont.setPointSize(32)

        self.smallFont = QFont()
        self.smallFont.setPointSize(24)

        self.label = self.getLabel(self.smallFont)
def CreateFlatButton(action):
	"""
	Create a custom flat button and style
	it so that it will look good on all platforms.
	"""

	toolButton = QToolButton()
	toolButton.setIcon(action.icon())
	toolButton.setText(action.text())
	toolButton.setAutoRaise(True)
	toolButton.setIconSize(QSize(32, 32))
	toolButton.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
	if sys.platform.startswith('darwin'):
		# Bug for Mac: QToolButtons do not react to setAutoRaise so
		# can't be made flat when they are not used inside a toolbar.
		# Setting a custom style sheet with border to none fixes this.
		# But then it looses all its highlight and pressed visual cues
		# so some extra styling needs to be done to provide some nice
		# visual feedback on hover and pressed states.
		toolButton.setStyleSheet("QToolButton {"
			"border: none;"
			"} "
			"QToolButton:hover {"
			"background-color: qradialgradient(cx: 0.5, cy: 0.5,"
			"fx: 0.5, fy: 0.5,"
			"radius: 0.5, "
			"stop: 0 rgba(255, 255, 255, 100), "
			"stop: 1 rgba(0, 0, 0, 0));"
			"}"
			"QToolButton:pressed {"
			"background-color: qradialgradient(cx: 0.5, cy: 0.5,"
			"fx: 0.5, fy: 0.5,"
			"radius: 0.5, "
			"stop: 0 rgba(255, 255, 255, 200), "
			"stop: 1 rgba(0, 0, 0, 0));"
			"}")
	font = QFont()
	font.setPixelSize(10)
	toolButton.setFont(font)

	# Connect the clicked signal to the action trigger
	def pushed():
		toolButton.action.triggered.emit()
	setattr(toolButton, "pushed", pushed)
	toolButton.clicked.connect(toolButton.pushed)
	setattr(toolButton, "action", action)

	return toolButton
Exemple #41
0
 def setheader(self):
     font = QFont(u'微软雅黑', 12)
     font.setBold(True)
     self.table.horizontalHeader().setFont(font)  # 设置表头字体
     self.table.setColumnWidth(0, 50)
     self.table.setColumnWidth(1, 50)
     self.table.setColumnWidth(3, 100)
     self.table.horizontalHeader().setSectionResizeMode(
         2, QHeaderView.Stretch)
     self.table.horizontalHeader().setStyleSheet(
         'QHeaderView::section{background:gray}')
     self.table.horizontalHeader().setFixedHeight(50)
     self.table.setColumnHidden(0, True)
     self.btn_set_header.setStyleSheet('background-color:lightblue')
     self.settext(
         u'设置标头字体及字号,隐藏ID列,设置标头除姓名外全部为固定宽度\n,设置姓名列自动扩展宽度,设置标头行高,设置标头背景色')
Exemple #42
0
 def update_tabs(self):
     if self.app.provider.is_authenticated():
         self.ui.authBtn.setText(self.tr('Remove Authorisation'))
     else:
         self.ui.authBtn.setText(self.tr('Authorize'))
     self.ui.autoStart.setCheckState(
         Qt.Checked if os.path.isfile(self.startup_file) else Qt.Unchecked)
     self.ui.noteFont.setCurrentFont(
         QFont(self.app.settings.value(
             'note-font-family',
             DEFAULT_FONT,
         )))
     self.ui.noteSize.setValue(
         int(self.app.settings.value(
             'note-font-size',
             DEFAULT_FONT_SIZE,
         )))
     self.ui.blackTray.setCheckState(Qt.Checked if int(
         self.app.settings.value('black-icon', 0)) else Qt.Unchecked)
     self.ui.progressCheckBox.setCheckState(Qt.Checked if int(
         self.app.settings.value('launcher-progress', 1)) else Qt.Unchecked)
     self.ui.searchOnHome.setCheckState(Qt.Checked if int(
         self.app.provider.get_settings_value('search-on-home') or 1
     ) else Qt.Unchecked)
     self.ui.sortByNotebook.setCheckState(Qt.Checked if int(
         self.app.provider.get_settings_value('sort-by-notebook') or 0
     ) else Qt.Unchecked)
 def __addData(
     self
 ):  #oddly in the vertical mode some data entries seem to be missing
     for col in xrange(len(self.dataTableColumnData)):
         dataList = self.dataTableColumnData[col]
         for row in xrange(len(dataList)):
             try:
                 value = dataList[
                     row]  # don't touch "values"; they could be pre-formatted strings
                 newItem = SortedTableWidgetItem()  # use custom item class
                 newItem.setData(Qt.DisplayRole, value)
                 newItem.setTextAlignment(Qt.AlignRight)
                 newItem.setFont(QFont("Fixed"))
                 if self.isColored:
                     if not (self._mode == MODE_SUBCONDITIONS and row != 2
                             ):  #color only row 2 of subcondition tables
                         color = self._computeColor(value)
                         if color:
                             newItem.setBackground(QBrush(color))
             except Exception, e:
                 logging.debug(
                     "TableWidgetController._updateDataTable(): Could not put value into widget item: %s\nError: %s"
                     % (value, e))
             if self.orientation == ORIENTATION_HORIZONTAL:
                 self.dataTableWidget.setItem(row, col, newItem)
             elif self.orientation == ORIENTATION_VERTICAL:
                 self.dataTableWidget.setItem(col, row, newItem)
Exemple #44
0
 def __init__(self, txt, value, tooltip=None):
     super(ConfigTableItem, self).__init__(txt)
     self.__value = value
     # first we customize the appearance
     self.setTextAlignment(Qt.AlignCenter)
     this_font = QFont()
     this_font.setBold(False)
     this_font.setPointSize(7)
     self.setBackground(QBrush(Qt.white))
     self.setFont(this_font)
     self.setForeground(Qt.black)
     if tooltip is not None:
         self.setToolTip(tooltip)
     # self.setFlags(Qt.ItemIsEnabled | Qt.ItemIsDragEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsSelectable)
     self.setFlags(Qt.ItemIsSelectable)
     return
Exemple #45
0
 def create_main_area(self, layout):
     # Master password
     master_password_label = QLabel("&Master-Passwort:")
     self.master_password_edit = QLineEdit()
     self.master_password_edit.setEchoMode(QLineEdit.EchoMode.Password)
     self.master_password_edit.textChanged.connect(self.masterpassword_changed)
     self.master_password_edit.returnPressed.connect(self.move_focus)
     self.master_password_edit.editingFinished.connect(self.masterpassword_entered)
     self.master_password_edit.setMaximumHeight(28)
     master_password_label.setBuddy(self.master_password_edit)
     layout.addWidget(master_password_label)
     layout.addWidget(self.master_password_edit)
     # Domain
     domain_label = QLabel("&Domain:")
     self.domain_edit = QComboBox()
     self.domain_edit.setEditable(True)
     self.domain_edit.textChanged.connect(self.domain_changed)
     self.domain_edit.currentIndexChanged.connect(self.domain_changed)
     self.domain_edit.lineEdit().editingFinished.connect(self.domain_entered)
     self.domain_edit.lineEdit().returnPressed.connect(self.move_focus)
     self.domain_edit.setMaximumHeight(28)
     domain_label.setBuddy(self.domain_edit)
     layout.addWidget(domain_label)
     layout.addWidget(self.domain_edit)
     # Username
     self.username_label = QLabel("&Username:"******"&Passwortstärke:")
     self.strength_label.setVisible(False)
     self.strength_selector = PasswordStrengthSelector()
     self.strength_selector.set_min_length(4)
     self.strength_selector.set_max_length(36)
     self.strength_selector.setMinimumHeight(60)
     self.strength_selector.set_length(12)
     self.strength_selector.set_complexity(6)
     self.strength_selector.strength_changed.connect(self.strength_changed)
     self.strength_selector.setVisible(False)
     self.strength_label.setBuddy(self.strength_selector)
     layout.addWidget(self.strength_label)
     layout.addWidget(self.strength_selector)
     # Password
     self.password_label = QLabel("&Passwort:")
     self.password_label.setVisible(False)
     self.password = QLabel()
     self.password.setTextFormat(Qt.PlainText)
     self.password.setAlignment(Qt.AlignCenter)
     self.password.setFont(QFont("Helvetica", 18, QFont.Bold))
     self.password.setVisible(False)
     self.password_label.setBuddy(self.password)
     layout.addWidget(self.password_label)
     layout.addWidget(self.password)
    def __init__(self):
        super(LandmarkLocationWidget, self).__init__()
        self._active = False
        self._font = QFont()
        self._font.setPointSize(10)

        self.indexLabel = QLabel()
        self.indexLabel.setMaximumWidth(8)
        self.indexLabel.setMinimumWidth(8)

        self.doneButton = QPushButton("Done")
        self.doneButton.setMaximumWidth(50)
        self.doneButton.setFont(self._font)
        self.doneButton.clicked.connect(self.doneButtonClicked)

        self.fixedButton = QPushButton("")
        self.fixedButton.setFont(self._font)
        self.movingButton = QPushButton("")
        self.movingButton.setFont(self._font)

        layout = QGridLayout()
        layout.setAlignment(Qt.AlignTop)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setHorizontalSpacing(4)
        layout.setVerticalSpacing(0)
        layout.addWidget(self.indexLabel, 0, 0)
        layout.addWidget(self.fixedButton, 0, 1)
        layout.addWidget(self.movingButton, 0, 2)
        layout.addWidget(self.doneButton, 0, 3)
        self.setLayout(layout)
        self._updateState()
Exemple #47
0
 def __init__(self, *args):
     super(HooverBar, self).__init__(*args)
     self.setAcceptHoverEvents(True)
     self.gi = None
     self.description = [""]
     self.base_font = QFont()
     self.setPen(QPen(Qt.transparent))
Exemple #48
0
    def __init__(self, parent, header, device_settings, firmware_settings,
                 error_codes, *args):
        QDialog.__init__(self, parent, *args)
        self.setGeometry(300, 200, 570, 450)
        self.setWindowTitle("Device information")
        table_model = DeviceInformationTable(self, header, device_settings)
        dev_settings_table = QTableView()
        dev_settings_table.setModel(table_model)

        table_model = DeviceInformationTable(self, header, firmware_settings)
        fw_settings_table = QTableView()
        fw_settings_table.setModel(table_model)

        table_model = DeviceInformationTable(self, header, error_codes)
        error_code_table = QTableView()
        error_code_table.setModel(table_model)

        # set font
        # font = QFont("monospace", 10)
        font = QFont("", 10)
        dev_settings_table.setFont(font)
        fw_settings_table.setFont(font)
        # set column width to fit contents (set font first!)
        dev_settings_table.resizeColumnsToContents()
        fw_settings_table.resizeColumnsToContents()
        error_code_table.resizeColumnsToContents()

        tab_view = QTabWidget()
        tab_view.addTab(dev_settings_table, "User settings")
        tab_view.addTab(fw_settings_table, "Firmware settings")
        tab_view.addTab(error_code_table, "Error Codes")

        layout = QVBoxLayout(self)
        layout.addWidget(tab_view)
        self.setLayout(layout)
Exemple #49
0
 def zoomOut(self):
     """ Decrease the size of the font in the TextEditor"""
     doc = self.getWidget().document()
     font = doc.defaultFont()
     font.setPointSize(font.pointSize() - 1)
     font = QFont(font)
     doc.setDefaultFont(font)
    def __init__(self, main_window):

        self._main_window = main_window
        self._instance = None
        self.views_by_category = defaultdict(list)
        self.views = []
        self.dockable_views = []
        self.view_to_dockable = {}

        #
        # Some generic configurations. move to "configurations" module later
        #
        #self.disasm_font = QFont("courier new", 20)
        self.disasm_font = QFont("DejaVu Sans Mono", 10)
        font_metrics = QFontMetricsF(self.disasm_font)
        self.disasm_font_height = font_metrics.height()
        self.disasm_font_width = font_metrics.width('A')
        self.disasm_font_ascent = font_metrics.ascent()

        default_tabs = [
            FunctionsView(self, 'left'),
            DisassemblyView(self, 'right'),
            SymexecView(self, 'right'),
            StatesView(self, 'right'),
            StringsView(self, 'right'),
            ConsoleView(self, 'bottom'),
        ]

        for tab in default_tabs:
            self.add_view(tab, tab.caption, tab.category)
class StatusWidget(QFrame):
    """
	StatusWidget
	"""

    def __init__(self):
        QFrame.__init__(self)

        self._color = [220, 220, 220]

        self._font = QFont()
        self._font.setPixelSize(10)

        self._pen = QPen(QColor(100, 100, 100, 255))

        self.label = QLabel()
        self.label.setWordWrap(True)
        self.label.setFont(self._font)
        self.label.setMaximumWidth(300)
        self.label.setMaximumHeight(36)
        self.label.setMinimumHeight(36)

        layout = QGridLayout()
        layout.setSpacing(0)
        layout.addWidget(self.label)
        self.setLayout(layout)

        self.setMinimumWidth(360)
        self.setMaximumWidth(360)

    def setText(self, text):
        self.label.setText(text)

    def paintEvent(self, ev):
        size = self.size()
        height = size.height() - 5
        width = size.width() - 5

        offset = 0.5
        rect = QRectF(2.0 + offset, 2.0 + offset, width, height)
        painter = QPainter(self)

        painter.setPen(self._pen)
        painter.setBrush(QColor(self._color[0], self._color[1], self._color[2]))
        painter.setRenderHint(QPainter.Antialiasing)
        painter.setRenderHint(QPainter.HighQualityAntialiasing)
        painter.drawRoundedRect(rect, 4, 4)
Exemple #52
0
 def __init__(self, width = 8):
     super(StringHexTableModel, self).__init__()
     self.width = width
     self.byte_data = ""
     self.start_address = 0
     self.set_data("i.MX toolkit \x02\x03 test" * 50, 0xfeedcafe)
     self.font = QFont("Monospace")
     self.font.setStyleHint(QFont.TypeWriter)
 def paintEvent(self, pe):
   painter = QPainter(self)
   painter.save()
   gradient = QLinearGradient()
   gradient.setStart(self._grad_start)
   gradient.setFinalStop(self._grad_end)
   gradient.setColorAt(0, QColor(230, 230, 230))
   gradient.setColorAt(1, QColor(247, 247, 247))
   brush = QBrush(gradient)
   painter.setBrush(brush)
   pen = QPen(Qt.black)
   pen.setWidth(1)
   painter.setPen(pen)
   painter.drawPath(self._painter_path)
   painter.restore()
   font = QFont()
   font.setFamily("Tahoma")
   font.setPixelSize(11)
   font.setBold(True)
   pen = QPen(Qt.darkGray)
   painter.setPen(pen)
   painter.setFont(font)
   self_rect = QRect(self.rect())
   self_rect.moveTo(self._hor_margin, self._ver_margin // 2)
   painter.drawText(self_rect, Qt.AlignLeft, self._text)
Exemple #54
0
    def __init__(self, levelSelection, parent=None):
        """ Initialize the Level Details View """
        QFrame.__init__(self, parent)

        #self.resize(self.WIDTH, self.HEIGHT)
        self.levelSelection = levelSelection
        
        self.smallFont = QFont()
        self.smallFont.setPointSize(14)
        
        self.bigFont = QFont()
        self.bigFont.setPointSize(24)
        
        self.detailsLabel = self.getLabel("Level Details", self.bigFont, alignment=Qt.AlignCenter)
        self.detailsLabel.move(32, 16)
        self.setupGridLabel()
        self.setupDefensesLabels()
        self.setupRatingsLabel()
Exemple #55
0
class LevelOverviewView(QFrame):
    """ Represents the View of the Level Overview """

    WIDTH = 120
    HEIGHT = 64

    def __init__(self, parent, level, levelSelection):
        """ Initialize the Level Overview View """
        QFrame.__init__(self, parent)

        self.resize(self.WIDTH, self.HEIGHT)
        self.level = level
        self.levelSelection = levelSelection

        self.bigFont = QFont()
        self.bigFont.setPointSize(32)

        self.smallFont = QFont()
        self.smallFont.setPointSize(24)

        self.label = self.getLabel(self.smallFont)

    def getLabel(self, font):
        """ Get a Level Label witht he apropriate Font """
        label = QLabel(self.level.name, self)
        label.setFont(self.smallFont)
        label.setAlignment(Qt.AlignCenter)
        label.resize(self.WIDTH, self.HEIGHT)
        return label

    def updateView(self):
        """ Update the View """
        if self.levelSelection.getLevel() is self.level:
            self.label.setFont(self.bigFont)
        else:
            self.label.setFont(self.smallFont)

        self.update()

    def getWidth(self):
        """ Return the Width of the Level Overview View """
        return self.label.contentsRect().width()
Exemple #56
0
	def __init__(self, parent=None):
		super(managebkm, self).__init__(parent)
		appicom = QIcon(":/icons/njnlogo.png")
		self.setWindowIcon(appicom)
		self.setWindowTitle("Nigandu | Manage Book Marks")
		self.setFixedSize(463, 242)

		self.verticalLayoutWidget = QWidget(self)
		self.verticalLayoutWidget.setGeometry(QRect(350, 30, 101, 201))
		self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
		self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
		self.verticalLayout.setContentsMargins(0, 0, 0, 0)
		self.verticalLayout.setObjectName("verticalLayout")

		self.sortbtn = QPushButton(self.verticalLayoutWidget)
		self.sortbtn.setText("&Sort")
		self.verticalLayout.addWidget(self.sortbtn)

		self.deletebtn = QPushButton(self.verticalLayoutWidget)
		self.deletebtn.setText("&Delete")
		self.verticalLayout.addWidget(self.deletebtn)

		self.deleteallbtn = QPushButton(self.verticalLayoutWidget)
		self.deleteallbtn.setText("Delete &All")
		self.verticalLayout.addWidget(self.deleteallbtn)

		self.closebtn = QPushButton(self.verticalLayoutWidget)
		self.closebtn.setText("&Close")
		self.verticalLayout.addWidget(self.closebtn)

		self.listWidget = QListWidget(self)
		self.listWidget.setGeometry(QRect(10, 30, 331, 201))

		self.label = QLabel(self)
		self.label.setGeometry(QRect(20, 10, 91, 25))
		font = QFont()
		font.setPointSize(10)
		self.label.setFont(font)
		self.label.setBuddy(self.listWidget)
		self.label.setText("Book Mark List:")
Exemple #57
0
 def _onStyleChanged(self):
     """ Updates brushes and pens """
     style = self.currentStyle
     self.font = QFont(self.currentStyle.fontName, 7)
     self.font.setBold(True)
     fm = QFontMetricsF(self.editor.codeEdit.font())
     self.size_hint = QSize(16, 16)
     self.back_brush = QBrush(QColor(style.panelsBackgroundColor))
     self.active_line_brush = QBrush(QColor(style.activeLineColor))
     self.separator_pen = QPen(QColor(style.panelSeparatorColor))
     self.normal_pen = QPen(QColor(style.lineNbrColor))
     self.highlight_pen = QPen(QColor(style.tokenColor(Text)))
     self.repaint()
Exemple #58
0
 def __init__(self):
     super(Layer, self).__init__()
     self.orientation = Quaternion()
     self.picked = None
     self.show = QCheckBox()
     self.show.setChecked(True)
     self.alpha_slider = QSlider(QtCore.Qt.Orientation.Horizontal)
     self.alpha_slider.setRange(0, 1024)
     self.alpha_slider.setValue(1024)
     self.alpha_number = QDoubleSpinBox()
     self.alpha_number.setDecimals(3)
     self.alpha_number.setSingleStep(0.01)
     self.alpha_number.setRange(0, 1)
     self.alpha_number.setValue(1)
     self.alpha_slider.valueChanged.connect(self._alphaSliderChanged)
     self.alpha_number.valueChanged.connect(self._alphaNumberChanged)
     self.move = QCheckBox()
     self.move.setChecked(True)
     self.quat = QLineEdit()
     font = QFont('monospace')
     font.setStyleHint(QFont.TypeWriter)
     self.quat.setFont(font)
     default_quat = '+0.000, +1.000, +0.000, +0.000'
     margins = self.quat.textMargins()
     self.quat.setFixedWidth(
         # HACK -------------------------------------------v
         QFontMetrics(self.quat.font()).width(default_quat + '  ') +
         margins.left() + margins.right()
     )
     self.quat.setInputMask('#0.000, #0.000, #0.000, #0.000')
     self.quat.setMaxLength(30)
     self.quat.setText(default_quat)
     self.quat.editingFinished.connect(self._orientationChanged)
     self.nbytes = QLabel()
     self.nbytes.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.nbytes.setText('0')
     self.label = QLabel()
     self.label.setText('<empty>')