Python PyQt5.QtGui.QFont() Examples

The following are code examples for showing how to use PyQt5.QtGui.QFont(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: Python-GUI   Author: arpitj07   File: Project.py    MIT License 7 votes vote down vote up
def boxclose(self):
        teamname = self.open_screen.OpenTheTeam.text()
        myteam= sqlite3.connect('TEAM.db')
        curser= myteam.cursor()
        curser.execute("SELECT PLAYERS from team WHERE NAMES= '"+teamname+"';")
        hu= curser.fetchall()
        self.listWidget.clear()
        for i in range(len(hu)):
            item= QtWidgets.QListWidgetItem(hu[i][0])
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            item.setFont(font)
            item.setBackground(QtGui.QColor('sea green'))
            self.listWidget.addItem(item)
            
        self.openDialog.close() 
Example 2
Project: dcc   Author: amimo   File: sourcewindow.py    Apache License 2.0 6 votes vote down vote up
def _get_format_from_style(self, token, style):
        """ Returns a QTextCharFormat for token by reading a Pygments style.
        """
        result = QtGui.QTextCharFormat()
        for key, value in list(style.style_for_token(token).items()):
            if value:
                if key == 'color':
                    result.setForeground(self._get_brush(value))
                elif key == 'bgcolor':
                    result.setBackground(self._get_brush(value))
                elif key == 'bold':
                    result.setFontWeight(QtGui.QFont.Bold)
                elif key == 'italic':
                    result.setFontItalic(True)
                elif key == 'underline':
                    result.setUnderlineStyle(
                        QtGui.QTextCharFormat.SingleUnderline)
                elif key == 'sans':
                    result.setFontStyleHint(QtGui.QFont.SansSerif)
                elif key == 'roman':
                    result.setFontStyleHint(QtGui.QFont.Times)
                elif key == 'mono':
                    result.setFontStyleHint(QtGui.QFont.TypeWriter)
        return result 
Example 3
Project: pymovie   Author: bob-anderson-ok   File: apertureNameDialog.py    MIT License 6 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(609, 84)
        Dialog.setMinimumSize(QtCore.QSize(600, 0))
        Dialog.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.apertureNameEdit = QtWidgets.QLineEdit(Dialog)
        font = QtGui.QFont()
        font.setPointSize(13)
        self.apertureNameEdit.setFont(font)
        self.apertureNameEdit.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.apertureNameEdit.setMaxLength(80)
        self.apertureNameEdit.setObjectName("apertureNameEdit")
        self.verticalLayout.addWidget(self.apertureNameEdit)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 0, 1, 1, 1)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 4
Project: kucher   Author: Zubax   File: utils.py    GNU General Public License v3.0 6 votes vote down vote up
def _get_monospace_font_impl(small=False) -> QFont:
    begun = time.monotonic()
    multiplier = 0.8 if small else 1.0
    min_font_size = min(7, QFont().pointSize())
    preferred = ['Consolas', 'DejaVu Sans Mono', 'Monospace', 'Lucida Console', 'Monaco']
    for name in preferred:
        font = QFont(name)
        if QFontInfo(font).fixedPitch():
            font.setPointSize(round(max(min_font_size, QFont().pointSize() * multiplier)))
            _logger.info('Selected monospace font (%.6f seconds): %r', time.monotonic() - begun, font.toString())
            return font

    font = QFont()
    font.setStyleHint(QFont().Monospace)
    font.setFamily('monospace')
    _logger.info('Using fallback monospace font (%.6f seconds): %r', time.monotonic() - begun, font.toString())
    return font 
Example 5
Project: Python-GUI   Author: arpitj07   File: scorewidnow.py    MIT License 6 votes vote down vote up
def setupUi(self, ScoreWindow):
        ScoreWindow.setObjectName("ScoreWindow")
        ScoreWindow.resize(471, 386)
        self.centralwidget = QtWidgets.QWidget(ScoreWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.Score = QtWidgets.QLineEdit(self.centralwidget)
        self.Score.setGeometry(QtCore.QRect(180, 180, 113, 22))
        self.Score.setObjectName("Score")
        self.teamscore = QtWidgets.QLabel(self.centralwidget)
        self.teamscore.setGeometry(QtCore.QRect(180, 130, 151, 20))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.teamscore.setFont(font)
        self.teamscore.setObjectName("teamscore")
        ScoreWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(ScoreWindow)
        self.statusbar.setObjectName("statusbar")
        ScoreWindow.setStatusBar(self.statusbar)

        self.retranslateUi(ScoreWindow)
        QtCore.QMetaObject.connectSlotsByName(ScoreWindow) 
Example 6
Project: eddy   Author: obdasystems   File: Unsatisfiable_Entity_Explorer.py    GNU General Public License v3.0 6 votes vote down vote up
def doAddExplanation(self, node, explanation):

        if explanation is not None and len(explanation)>0:
            exp_to_add = QtGui.QStandardItem()
            exp_to_add.setText('<Explanation(s)> \n**(click to open Explanation Explorer)')

            font = QtGui.QFont()
            font.setBold(True)
            font.setItalic(True)
            font.setUnderline(True)

            exp_to_add.setFont(font)

            exp_to_add.setData(explanation)
            parent = self.parentFor(node)
            parent.appendRow(exp_to_add) 
Example 7
Project: dunya-desktop   Author: MTG   File: table.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        QTableView.__init__(self, parent=parent)

        # setting the table for no edit and row selection
        self.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.setSelectionBehavior(QAbstractItemView.SelectRows)
        # self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.setMouseTracking(True)
        self.horizontalHeader().setStretchLastSection(True)
        font = QFont()
        font.setPointSize(13)
        self.horizontalHeader().setFont(font)

        # hiding the vertical headers
        self.verticalHeader().hide()

        # arranging the artist column for being multi-line
        self.setWordWrap(True)
        self.setTextElideMode(Qt.ElideMiddle)

        self._last_index = QPersistentModelIndex()
        self.viewport().installEventFilter(self)

        self._set_font() 
Example 8
Project: dunya-desktop   Author: MTG   File: dockwidget.py    GNU General Public License v3.0 6 votes vote down vote up
def _set_label_downloaded(self):
        """Sets the label 'Downloaded'."""
        font = QFont()
        font.setFamily("Garuda")
        self.label_downloaded.setFont(font)
        self.label_downloaded.setIndent(15) 
Example 9
Project: hexutil   Author: stephanh42   File: example.py    MIT License 6 votes vote down vote up
def __init__(self, *args, **kws):
        super().__init__(*args, **kws)
        self.setMouseTracking(True) # we want to receive mouseMoveEvents

        self.level = Level(500)
        self.player = hexutil.origin
        self.hexgrid = hexutil.HexGrid(24)

        # initialize GUI objects needed for painting
        self.font = QtGui.QFont("Helvetica", 20)
        self.font.setStyleHint(QtGui.QFont.SansSerif)
        self.pen = QtGui.QPen()
        self.pen.setWidth(2)
        self.select_brush = QtGui.QBrush(QtGui.QColor(127, 127, 255, 127))
        self.unseen_brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 127))

        self.update_fov() 
Example 10
Project: plexdesktop   Author: coryo   File: delegates.py    GNU General Public License v3.0 6 votes vote down vote up
def placeholder_thumb_generator(title, size=150):
    """Returns a QPixmap of size with the first letter of each word in title"""
    initials = ' '.join([x[0] for x in title.split(' ') if len(x) > 2])
    key = 'placeholder' + initials
    img = QtGui.QPixmapCache.find(key)
    if img:
        return img
    qsize = QtCore.QSize(size, size)
    circle_color = QtGui.QColor(50, 50, 50)
    text_color = QtGui.QColor(75, 75, 75)
    rect = QtCore.QRect(QtCore.QPoint(0, 0), QtCore.QPoint(size, size))
    center = QtCore.QPoint(size / 2, size / 2)
    img = QtGui.QPixmap(qsize)
    img.fill(QtCore.Qt.transparent)
    p = QtGui.QPainter(img)
    p.setFont(QtGui.QFont('Open Sans', size / 4, weight=QtGui.QFont.Bold))
    p.setBrush(QtGui.QBrush(circle_color))
    p.setPen(circle_color)
    p.setRenderHint(QtGui.QPainter.Antialiasing, True)
    p.drawEllipse(center, size / 2 - 1, size / 2 - 1)
    p.setPen(text_color)
    p.drawText(rect, QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter, initials)
    QtGui.QPixmapCache.insert(key, img)
    return img 
Example 11
Project: JI-Live-Danmu-Client   Author: SJTU-UMJI-Tech   File: Marquee.py    MIT License 5 votes vote down vote up
def initUi(self, text, color, screenWidth, screenHeight):
        # self.setStyleSheet("border:1px solid blue;")
        self.doubleText = text + " " + text
        self.setFont(QFont('SimHei', 24, 100))
        self.myRect = self.fontMetrics().boundingRect(text)
        self.setGeometry(screenWidth - self.FIXED_WIDTH - 40,
                         screenHeight - self.height() - 60,
                         self.FIXED_WIDTH + 20,
                         self.myRect.height() + 10)
        self.initLabel(self.label, self.doubleText)
        self.label.anim = QPropertyAnimation(self.label, b'geometry')
        self.label.anim.setDuration(self.ANIM_TIME)
        self.label.anim.setStartValue(
            QRect(
                0, 0,
                self.fontMetrics().boundingRect(self.doubleText).width() + 20,
                self.myRect.height() + 10))
        self.label.anim.setEndValue(
            QRect(
                -(self.myRect.width() + 20), 0,
                self.fontMetrics().boundingRect(self.doubleText).width() + 20,
                self.myRect.height() + 10))
        self.label.anim.setLoopCount(-1)
        self.label.anim.start()
        # self.label.setStyleSheet("border:1px solid red;")
        self.setChangeRGB(self.RAINBOW_RGB_LIST[self.clrIdx],
                          self.RAINBOW_RGB_LIST[(self.clrIdx + 1) % 7])
        self.label.show() 
Example 12
Project: JI-Live-Danmu-Client   Author: SJTU-UMJI-Tech   File: Marquee.py    MIT License 5 votes vote down vote up
def initLabel(self, label, text):
        label.setText(text)
        label.setFont(QFont('SimHei', 24, 100))
        eff = QGraphicsDropShadowEffect()
        eff.setColor(QColor(6, 6, 6))
        eff.setBlurRadius(5)
        eff.setOffset(1.5, 1.5)
        label.setGraphicsEffect(eff)
        label.setGeometry(0, 0,
                          self.fontMetrics().boundingRect(text).width() + 20,
                          self.fontMetrics().boundingRect(text).height() + 10) 
Example 13
Project: JI-Live-Danmu-Client   Author: SJTU-UMJI-Tech   File: Danmu.py    MIT License 5 votes vote down vote up
def __init__(self, text, color, top, window):
        super(Danmu, self).__init__(window)
        # clean invalid characters
        text = re.sub(r'/Emoji\d+|/表情|^ | $', '',
                      text.replace('\n', ' '))[0:MAX_STR_LEN]
        self.top = top
        self.setTextFormat(Qt.PlainText)
        self.setText(text)
        # self.setWindowFlags(Qt.FramelessWindowHint)
        # self.setAttribute(Qt.WA_TranslucentBackground)
        self.setAttribute(Qt.WA_TransparentForMouseEvents, True)
        self.setFont(QFont('SimHei', FONT_SIZE, 100))
        # set size of label
        myRect = self.fontMetrics().boundingRect(text)
        self.setFixedSize(myRect.width() + 20, myRect.height() + 10)
        self.setColor(color)
        self.setShadow(QColor('#060606'), 5, 1.5)
        # self.setStyleSheet("border:1px solid red;") 
Example 14
Project: dcc   Author: amimo   File: sourcewindow.py    Apache License 2.0 5 votes vote down vote up
def __init__(self, parent=None, lines=[]):
        super(SourceDocument, self).__init__(parent)
        self.parent = parent

        self.setDefaultFont(QtGui.QFont('Monaco', 9, QtGui.QFont.Light))

        cursor = QtGui.QTextCursor(self)  # position=0x0
        self.binding = {}

        # save the cursor position before each interesting element
        for section, L in lines:
            for t in L:
                if t[0] in BINDINGS_NAMES:
                    self.binding[cursor.position()] = t
                cursor.insertText(t[1]) 
Example 15
Project: pymovie   Author: bob-anderson-ok   File: aperturesFileTagDialog.py    MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(600, 102)
        Dialog.setMinimumSize(QtCore.QSize(400, 0))
        Dialog.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.apertureGroupTagEdit = QtWidgets.QLineEdit(Dialog)
        font = QtGui.QFont()
        font.setPointSize(13)
        self.apertureGroupTagEdit.setFont(font)
        self.apertureGroupTagEdit.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.apertureGroupTagEdit.setMaxLength(80)
        self.apertureGroupTagEdit.setObjectName("apertureGroupTagEdit")
        self.verticalLayout.addWidget(self.apertureGroupTagEdit)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setCenterButtons(True)
        self.buttonBox.setObjectName("buttonBox")
        self.horizontalLayout.addWidget(self.buttonBox)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 16
Project: kucher   Author: Zubax   File: utils.py    GNU General Public License v3.0 5 votes vote down vote up
def get_monospace_font(small=False) -> QFont:
    # We have to copy the result because we don't want to share the same instance globally - users may mutate it
    return QFont(_get_monospace_font_impl(small)) 
Example 17
Project: kucher   Author: Zubax   File: utils.py    GNU General Public License v3.0 5 votes vote down vote up
def _unittest_icons():
    import math
    import glob
    from PyQt5.QtWidgets import QApplication, QMainWindow, QGroupBox, QGridLayout, QLabel, QSizePolicy
    from PyQt5.QtGui import QFont, QFontMetrics

    app = QApplication([])

    all_icons = list(map(lambda x: os.path.splitext(os.path.basename(x))[0],
                         glob.glob(os.path.join(get_absolute_path('view', 'icons'), '*'))))
    print('All icons:', len(all_icons), all_icons)

    grid_size = int(math.ceil(math.sqrt(len(all_icons))))

    icon_size = QFontMetrics(QFont()).height()

    def render_icon(name: str, row: int, col: int):
        icon = get_icon(name)
        icon_label = QLabel()
        icon_label.setAlignment(Qt.AlignCenter)
        icon_label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        icon_label.setPixmap(icon.pixmap(icon_size, icon_size))
        layout.addWidget(icon_label, row, col)

    win = QMainWindow()
    container = QGroupBox(win)
    layout = QGridLayout()

    for idx, ic in enumerate(all_icons):
        render_icon(ic, idx // grid_size, idx % grid_size)

    container.setLayout(layout)
    win.setCentralWidget(container)
    win.show()

    for _ in range(1000):
        time.sleep(0.005)
        app.processEvents()

    win.close() 
Example 18
Project: kucher   Author: Zubax   File: __init__.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: QWidget):
        super(_TableModel, self).__init__(parent)

        self._data: TaskStatisticsView = TaskStatisticsView()

        self._icon_size = QFontMetrics(QFont()).height() 
Example 19
Project: kucher   Author: Zubax   File: __init__.py    GNU General Public License v3.0 5 votes vote down vote up
def headerData(self, section: int, orientation: int, role=None):
        if role == Qt.DisplayRole:
            if orientation == Qt.Horizontal:
                return self.COLUMNS[section][0]
            else:
                task_enum = list(self._data.entries.keys())[section]
                return get_human_friendly_task_name(task_enum, short=True)

        if role in (Qt.ToolTipRole, Qt.StatusTipRole):
            if orientation == Qt.Horizontal:
                return self.COLUMNS[section][1]
            else:
                task_enum = list(self._data.entries.keys())[section]
                return get_human_friendly_task_name(task_enum)

        if role == Qt.DecorationRole:
            if orientation == Qt.Vertical:
                task_enum = list(self._data.entries.keys())[section]
                try:
                    icon_name = get_icon_name_for_task_id(task_enum)
                except KeyError:
                    pass
                else:
                    return get_icon_pixmap(icon_name, self._icon_size)

        if role == Qt.TextAlignmentRole:
            return Qt.AlignCenter

        if role == Qt.FontRole:
            if orientation == Qt.Vertical:
                if list(self._data.entries.keys())[section] == self._get_running_task_id():
                    font = QFont()
                    font.setBold(True)
                    return font

        return QVariant() 
Example 20
Project: kucher   Author: Zubax   File: placeholder_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: QWidget):
        super(PlaceholderWidget, self).__init__(parent)

        label = QLabel(self)
        label.setText('Task-specific status information is not available')
        label.setWordWrap(True)
        label.setAlignment(Qt.AlignCenter)

        font: QFont = label.font()
        font.setItalic(True)
        label.setFont(font)

        layout = QVBoxLayout()
        layout.addWidget(label)
        self.setLayout(layout) 
Example 21
Project: kucher   Author: Zubax   File: fault_status_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: QWidget):
        super(Widget, self).__init__(parent)

        self._last_displayed: TaskSpecificStatusReport.Fault = None

        self._line_height = QFontMetrics(QFont()).height()

        self._task_icon_display = QLabel(self)
        self._task_name_display = self._make_line_display()

        self._error_code_dec = self._make_line_display('Exit code in decimal')
        self._error_code_hex = self._make_line_display('Same exit code in hexadecimal')
        self._error_code_bin = self._make_line_display('Same exit code in binary, for extra convenience')

        self._error_description_display = self._make_line_display('Error description', False)
        self._error_comment_display = self._make_text_display()

        self.setLayout(
            lay_out_vertically(
                lay_out_horizontally(QLabel('The task', self),
                                     self._task_icon_display,
                                     (self._task_name_display, 3)),
                lay_out_horizontally(QLabel('has failed with exit code', self),
                                     (self._error_code_dec, 1),
                                     (self._error_code_hex, 1),
                                     (self._error_code_bin, 2),
                                     QLabel('which means:', self)),
                lay_out_horizontally((self._error_description_display, 1)),
                lay_out_horizontally((self._error_comment_display, 1)),
                (None, 1),
            )
        ) 
Example 22
Project: kucher   Author: Zubax   File: run_status_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: QWidget):
        super(_DQDisplayWidget, self).__init__(parent)

        def make_label(text: str = '') -> QLabel:
            w = QLabel(text, self)
            w.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
            font = QFont()
            font.setBold(True)
            w.setFont(font)
            return w

        self._ud = make_label()
        self._uq = make_label()
        self._id = make_label()
        self._iq = make_label()

        self._ud.setToolTip('Direct axis voltage')
        self._uq.setToolTip('Quadrature axis voltage')
        self._id.setToolTip('Direct axis current')
        self._iq.setToolTip('Quadrature axis current')

        # 0  1  2
        # 1 Ud Uq
        # 2 Id Iq
        layout = QGridLayout(self)
        layout.addWidget(QLabel('U<sub>DQ</sub>', self), 0, 0)
        layout.addWidget(QLabel('I<sub>DQ</sub>', self), 1, 0)
        layout.addWidget(self._ud, 0, 1)
        layout.addWidget(self._uq, 0, 2)
        layout.addWidget(self._id, 1, 1)
        layout.addWidget(self._iq, 1, 2)
        layout.addWidget(make_label('V'), 0, 3)
        layout.addWidget(make_label('A'), 1, 3)
        layout.setColumnStretch(0, 4)
        layout.setColumnStretch(1, 2)
        layout.setColumnStretch(2, 2)
        layout.setColumnStretch(3, 1)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout) 
Example 23
Project: kucher   Author: Zubax   File: run_status_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def _make_vertical_separator(parent: QWidget) -> QWidget:
    # https://stackoverflow.com/questions/10053839/how-does-designer-create-a-line-widget
    line = QFrame(parent)
    line.setFrameShape(QFrame.VLine)
    line.setStyleSheet('QFrame { color: palette(mid); };')
    line.setMinimumWidth(QFontMetrics(QFont()).width('__') * 2)
    return line 
Example 24
Project: kucher   Author: Zubax   File: model.py    GNU General Public License v3.0 5 votes vote down vote up
def get_font() -> QFont:
        return get_monospace_font(small=True) 
Example 25
Project: kucher   Author: Zubax   File: model.py    GNU General Public License v3.0 5 votes vote down vote up
def _data_font(self, index: QModelIndex) -> QFont:
        row, column = index.row(), index.column()
        node = self._unwrap(index)

        if column == self.ColumnIndices.VALUE:
            if node.state == node.State.PENDING:
                return self._italic_font

            if self.flags(index) & Qt.ItemIsEditable:
                return self._underlined_font

        return self._regular_font 
Example 26
Project: kucher   Author: Zubax   File: group_box_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def set_icon(self, icon_name: str):
        if self._current_icon == icon_name:
            return

        _logger.debug('Changing icon from %r to %r', self._current_icon, icon_name)
        self._current_icon = icon_name

        icon_size = QFontMetrics(QFont()).height()
        icon_path = get_icon_path(icon_name)

        # This hack adds a custom icon to the GroupBox: make it checkable, and then, using styling, override
        # the image of the check box with the custom icon.
        self.setCheckable(True)     # This is needed to make the icon visible
        self.setStyleSheet(f'''
            QGroupBox::indicator {{
                width:  {icon_size}px;
                height: {icon_size}px;
                image: url({icon_path});
            }}
        ''')

        # We don't actually want it to be checkable, so override this thing to return it back to normal again
        # noinspection PyUnresolvedReferences
        self.toggled.connect(lambda _: self.setChecked(True)) 
Example 27
Project: kucher   Author: Zubax   File: value_display_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,
                 parent: QWidget,
                 title: str,
                 placeholder_text: typing.Optional[str] = None,
                 with_comment: bool = False,
                 tooltip: typing.Optional[str] = None):
        super(ValueDisplayWidget, self).__init__(parent)

        self._placeholder_text = str(placeholder_text or '')

        self._value_display = QLabel(self)
        self._value_display.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
        bold_font = QFont()
        bold_font.setBold(True)
        self._value_display.setFont(bold_font)

        if with_comment:
            self._comment = _Comment(self)
        else:
            self._comment = None

        self._default_tooltip = str(tooltip or '')
        self.setToolTip(self._default_tooltip)
        self.setStatusTip(self.toolTip())

        title_label = QLabel(title)
        title_label.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)

        layout = QHBoxLayout()
        layout.addWidget(title_label, 1)
        layout.addWidget(self._value_display, 1)
        if self._comment is not None:
            layout.addWidget(self._comment)

        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        self.reset() 
Example 28
Project: kucher   Author: Zubax   File: value_display_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: QWidget):
        super(_Comment, self).__init__(parent)
        self.setAlignment(Qt.AlignCenter)
        self._icon_size = QFontMetrics(QFont()).height()        # As large as font
        self._pixmap_cache: typing.Dict[str, QPixmap] = {}
        self._current_icon_name: typing.Optional[str] = None
        # Initializing defaults
        self.reset() 
Example 29
Project: geoscience   Author: rolandhill   File: SectionGrid.py    GNU General Public License v3.0 5 votes vote down vote up
def setStyle(self, layer, labelSuffix='', labels=True):
        # Set the line style
        r = layer.renderer()
        r.symbol().setColor(QtGui.QColor('grey'))
        r.symbol().setOpacity(0.5)

        #Set the label style
        if labels:
            settings = QgsPalLayerSettings()
            textFormat = QgsTextFormat()
            textFormat.setFont(QtGui.QFont("Arial", 10))
            textFormat.setColor(QtGui.QColor('grey'))
            textFormat.setOpacity(0.5)
            settings.setFormat(textFormat)
            if labelSuffix == '':
                settings.fieldName = 'Label'
            else:
    #            settings.fieldName = 'Label'
                settings.fieldName = str.format("format( '%%1%%2',  format_number(Label, 0), ' %s')" % labelSuffix)
                settings.isExpression = True
            settings.formatNumbers = True
            settings.decimals = 0
            settings.placement = QgsPalLayerSettings.Line
            labeling = QgsVectorLayerSimpleLabeling(settings)
            layer.setLabeling(labeling)
            layer.setLabelsEnabled(True) 
Example 30
Project: bssrdf-estimate   Author: tatsy   File: console_widget.py    MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        super(ConsoleWidget, self).__init__(parent)

        self.textEdit = QTextEdit()
        self.textEdit.setFont(QFont('Consolas'))
        self.clearButton = QPushButton()
        self.clearButton.setText('Clear')

        self.vboxLayout = QVBoxLayout()
        self.vboxLayout.addWidget(self.textEdit)
        self.vboxLayout.addWidget(self.clearButton)
        self.setLayout(self.vboxLayout)

        self.clearButton.clicked.connect(self.clearConsoleTexts) 
Example 31
Project: Python-GUI   Author: arpitj07   File: New.py    MIT License 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(100, 40, 201, 81))
        font = QtGui.QFont()
        font.setPointSize(9)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")

        
        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(150, 190, 111, 28))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")
        
        self.lineEdit = QtWidgets.QLineEdit(Form)
        self.lineEdit.setGeometry(QtCore.QRect(100, 140, 201, 22))
        self.lineEdit.setObjectName("lineEdit")

        
        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 32
Project: Python-GUI   Author: arpitj07   File: Project.py    MIT License 5 votes vote down vote up
def combo2(self):
        myteam=sqlite3.connect("TEAM.db")
        cu= myteam.cursor()
        
        team = self.eval_screen.SelectTeam.currentText()
        cu.execute("SELECT PlAYERS from team WHERE NAMES='"+team+"';")
        player= cu.fetchall()
        self.eval_screen.PlayerList.clear()
        for i in range(len(player)):
            item= QtWidgets.QListWidgetItem(player[i][0])
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            item.setFont(font)
            item.setBackground(QtGui.QColor('#ffff99'))
            self.eval_screen.PlayerList.addItem(item)
        
        cu.execute("SELECT SCORES from team WHERE NAMES='"+team+"';")
        score=cu.fetchall()
        self.teamscore=[]
        for i in range(len(score)):
            self.teamscore.append(score[i][0])
    
        self.eval_screen.ScoreList.clear()
        for i in range(len(score)):
            items= QtWidgets.QListWidgetItem(str(score[i][0]))
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            items.setFont(font)
            items.setBackground(QtGui.QColor('#fdc086'))
            self.eval_screen.ScoreList.addItem(items) 
Example 33
Project: Linalfred   Author: PeterHo   File: maineditbox.py    MIT License 5 votes vote down vote up
def setEditBoxFont(self):
        font = QFont()
        font.setPointSize(self.dlg.theme.editBoxFontSize)
        self.setFont(font) 
Example 34
Project: HippMapp3r   Author: mgoubran   File: gui_options.py    GNU General Public License v3.0 5 votes vote down vote up
def print_help(main, helpfun):
    main.setWindowTitle('Help function')
    scrollarea = QtWidgets.QScrollArea()

    helplbl = QtWidgets.QLabel()
    helplbl.setText(helpfun)
    font = QtGui.QFont('Mono', 9, QtGui.QFont.Light)
    helplbl.setFont(font)
    helplbl.setWordWrap(True)

    scrollarea.setWidget(helplbl)
    #scrollarea.setWidgetResizable(False)
    scrollarea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
    scrollarea.setAttribute(QtCore.Qt.WA_DeleteOnClose)
    main.setCentralWidget(scrollarea)

    main.move(QtWidgets.QApplication.desktop().screen().rect().center() - main.rect().center())
    main.show()

    QtWidgets.QApplication.processEvents() 
Example 35
Project: pyweed   Author: iris-edu   File: WaveformDialog.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, value):
        super(KeepIndicatorTableWidgetItem, self).__init__()
        self.setKeep(value)
        # Use a large font size for the checkboxes
        font = QtGui.QFont()
        font.setPointSize(self.fontSize)
        self.setFont(font) 
Example 36
Project: cct   Author: awacha   File: scripteditor.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        QtGui.QSyntaxHighlighter.__init__(self, *args, **kwargs)
        self.keywordformat = QtGui.QTextCharFormat()
        self.keywordformat.setFontWeight(QtGui.QFont.Bold)
        self.keywordformat.setForeground(QtCore.Qt.darkMagenta)
        self.keywords_re = [re.compile(r'\b' + c.name + r'\b') for c in Command.allcommands()]
        self.commentformat = QtGui.QTextCharFormat()
        self.commentformat.setForeground(QtCore.Qt.lightGray)
        self.comment_re = re.compile('#.*$')
        self.labelformat = QtGui.QTextCharFormat()
        self.labelformat.setForeground(QtCore.Qt.blue)
        self.label_re = re.compile(r'^\s*\@.*$') 
Example 37
Project: cct   Author: awacha   File: motorlist.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def data(self, index: QtCore.QModelIndex, role=None):
        motorname = sorted(self.credo.motors.keys())[index.row()]
        motor = self.credo.motors[motorname]
        assert isinstance(motor, Motor)
        if role == QtCore.Qt.DisplayRole:
            if index.column() == 0:
                return motorname
            elif index.column() == 1:
                return '{:.4f}'.format(motor.get_variable('softleft'))
            elif index.column() == 2:
                return '{:.4f}'.format(motor.get_variable('softright'))
            elif index.column() == 3:
                return '{:.4f}'.format(motor.get_variable('actualposition'))
            elif index.column() == 4:
                return '{:.4f}'.format(motor.get_variable('actualspeed'))
            elif index.column() == 5:
                return ''
            elif index.column() == 6:
                return ''
            elif index.column() == 7:
                return str(motor.get_variable('load'))
            elif index.column() == 8:
                return ', '.join(motor.decode_error_flags())
            else:
                return None
        elif role == QtCore.Qt.CheckStateRole:
            if index.column() == 5:
                return [QtCore.Qt.Unchecked, QtCore.Qt.Checked][motor.get_variable('leftswitchstatus')]
            elif index.column() == 6:
                return [QtCore.Qt.Unchecked, QtCore.Qt.Checked][motor.get_variable('rightswitchstatus')]
            else:
                return None
        elif role == QtCore.Qt.FontRole:
            if index.column() == 3:
                font = QtGui.QFont()
                font.setBold(True)
                return font
            else:
                return None
        else:
            return None 
Example 38
Project: pyaudiorestoration   Author: HENDRIX-ZT2   File: widgets.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, ):
		QtWidgets.QLabel.__init__(self, )
		self.def_text = "\n          - Note\n        -.- Hz\n-:--:--:--- h:m:s:ms"
		myFont2=QtGui.QFont("Monospace")
		myFont2.setStyleHint(QtGui.QFont.TypeWriter)
		self.setFont(myFont2) 
Example 39
Project: tf-pose   Author: SrikanthVelpuri   File: FlowchartTemplate_pyqt5.py    Apache License 2.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(529, 329)
        self.selInfoWidget = QtWidgets.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName("selInfoWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget)
        self.selDescLabel.setText("")
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName("selDescLabel")
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText("")
        self.selNameLabel.setObjectName("selNameLabel")
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName("selectedTree")
        self.selectedTree.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtWidgets.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName("hoverText")
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName("view")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 40
Project: MeiTingTrunk   Author: Xunius   File: _MainFrame.py    GNU General Public License v3.0 5 votes vote down vote up
def createScratchTab(self):

        scroll=QtWidgets.QScrollArea(self)
        scroll.setWidgetResizable(True)
        frame=QtWidgets.QFrame()
        v_layout=QtWidgets.QVBoxLayout()

        self.scratchpad_textedit=QtWidgets.QTextEdit(self)
        self.scratchpad_textedit.setFont(self.settings.value(
            '/display/fonts/scratch_pad',QFont))
        self.scratchpad_textedit.setSizePolicy(getXExpandYExpandSizePolicy())

        v_layout.addWidget(self.scratchpad_textedit)
        frame.setLayout(v_layout)
        scroll.setWidget(frame)

        return scroll 
Example 41
Project: MeiTingTrunk   Author: Xunius   File: _MainFrame.py    GNU General Public License v3.0 5 votes vote down vote up
def createBiBTab(self):

        frame=QtWidgets.QWidget()
        scroll=QtWidgets.QScrollArea(self)
        scroll.setWidgetResizable(True)
        scroll.setWidget(frame)
        v_layout=QtWidgets.QVBoxLayout()

        self.copy_bib_button=QtWidgets.QToolButton(self)
        self.copy_bib_button.setText('Copy')
        self.copy_bib_button.setIcon(QIcon.fromTheme('edit-copy',
                self.style().standardIcon(QStyle.SP_FileDialogDetailedView)))
        self.copy_bib_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        h_layout=QtWidgets.QHBoxLayout()
        h_layout.addWidget(self.copy_bib_button)
        h_layout.addStretch()

        self.bib_textedit=QtWidgets.QTextEdit(self)
        self.bib_textedit.setReadOnly(True)
        self.bib_textedit.setFont(self.settings.value('/display/fonts/bibtex',QFont))
        v_layout.addLayout(h_layout)
        v_layout.addWidget(self.bib_textedit)
        frame.setLayout(v_layout)
        self.copy_bib_button.clicked.connect(self.copyBibButtonClicked)

        return scroll 
Example 42
Project: SpriteMator   Author: rafaelvasco   File: application.py    Apache License 2.0 5 votes vote down vote up
def _load_assets():

        # Fonts #

        QFontDatabase.addApplicationFont(":/fonts/font_nokia")
        QFontDatabase.addApplicationFont(":/fonts/font_flx")

        default_font = QFont("Nokia Cellphone FC")
        default_font.setPointSize(12)

        small_font = QFont("flxpixl")
        small_font.setPointSize(12)

        ResourcesCache.register_resource("BigFont", default_font)
        ResourcesCache.register_resource("SmallFont", small_font)

        # Pixmaps #

        checker_tile_light = utils.generate_checkerboard_tile(8, QColor(238, 238, 238),
                                                              QColor(255, 255, 255))
        checker_tile_dark = utils.generate_checkerboard_tile(8, QColor(59, 59, 59),
                                                             QColor(63, 63, 63))

        ResourcesCache.register_resource("CheckerTileLight", checker_tile_light)
        ResourcesCache.register_resource("CheckerTileDark", checker_tile_dark)

        tool_cursor_1 = QPixmap(':/images/tool_cursor_1')

        ResourcesCache.register_resource('ToolCursor1', tool_cursor_1) 
Example 43
Project: eddy   Author: obdasystems   File: qt.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, family, size=12, weight=-1, **kwargs):
        """
        Contruct a new Font instance using the given parameters.
        :type family: str
        :type size: float
        :type weight: float
        """
        if not _MACOS:
            size = int(round(size * 0.75))
        super().__init__(family, size, weight)
        self.setBold(kwargs.get('bold', False))
        self.setItalic(kwargs.get('italic', False))
        self.setCapitalization(kwargs.get('capitalization', QtGui.QFont.MixedCase))
        self.setStyleHint(kwargs.get('style', QtGui.QFont.AnyStyle)) 
Example 44
Project: eddy   Author: obdasystems   File: pdf.py    GNU General Public License v3.0 5 votes vote down vote up
def append_row_and_column_to_table(self,iri,prefix,brush,bold=None):

        item_iri = QtWidgets.QTableWidgetItem()
        item_iri.setText(iri)

        if brush is not None:
            item_iri.setBackground(brush)

        item_prefix = QtWidgets.QTableWidgetItem()
        item_prefix.setText(prefix)

        if bold:
            font_iri = QtGui.QFont(item_iri.text())
            font_iri.setBold(True)
            item_iri.setFont(font_iri)

            font_prefix = QtGui.QFont(item_prefix.text())
            font_prefix.setBold(True)
            item_prefix.setFont(font_prefix)

        if brush is not None:
            item_prefix.setBackground(brush)

        self.table.setItem(self.table.rowCount() - 1, 0, item_iri)
        self.table.setItem(self.table.rowCount() - 1, 1, item_prefix)

        self.table.setRowCount(self.table.rowCount() + 1) 
Example 45
Project: data-structure   Author: yunowo   File: main_stats_tab.py    GNU General Public License v3.0 5 votes vote down vote up
def show_bar_chart(self):
        t20 = list(reversed(list(islice(self.d.items(), 20))))
        bs = QBarSet("")
        bs.append([c[1] for c in t20])
        hbs = QHorizontalBarSeries()
        hbs.append(bs)
        hbs.setBarWidth(0.6)
        hbs.setLabelsVisible(True)
        hbs.setLabelsPosition(QHorizontalBarSeries.LabelsInsideEnd)

        font = QFont()
        font.setFamily('Segoe UI')
        font.setPixelSize(10)
        x = QValueAxis()
        y = QBarCategoryAxis()
        y.append([c[0] for c in t20])
        x.setGridLineVisible(False)
        y.setGridLineVisible(False)
        x.setLabelsFont(font)
        y.setLabelsFont(font)

        c = QChart()
        c.addSeries(hbs)
        c.setAxisY(y, hbs)
        c.setAxisX(x, hbs)
        x.applyNiceNumbers()
        c.setAnimationOptions(QChart.SeriesAnimations)
        c.setBackgroundRoundness(0)
        c.legend().hide()
        c.layout().setContentsMargins(0, 0, 0, 0)

        if self.cv is not None:
            self.w.bar_chart_container.removeWidget(self.cv)
        self.cv = QChartView(c)
        self.cv.setRenderHint(QPainter.Antialiasing)
        self.w.bar_chart_container.addWidget(self.cv) 
Example 46
Project: data-structure   Author: yunowo   File: common.py    GNU General Public License v3.0 5 votes vote down vote up
def font():
    f = QtGui.QFont()
    f.setFamily('微软雅黑')
    return f 
Example 47
Project: pdash   Author: CPChain   File: __init__.py    GNU General Public License v3.0 5 votes vote down vote up
def init_font(application):
    # load fonts
    utils.load_fonts(abs_path('fonts'))
    font_name = "Microsoft Sans Serif" if app.is_windows() else "SF UI Display"
    font = QFont(font_name)
    application.setFont(font) 
Example 48
Project: dunya-desktop   Author: MTG   File: general_design.py    GNU General Public License v3.0 5 votes vote down vote up
def _set_status_bar(self):
        self.statusbar.setMinimumSize(QtCore.QSize(0, 18))
        font = QFont()
        font.setPointSize(9)
        self.statusbar.setFont(font) 
Example 49
Project: dunya-desktop   Author: MTG   File: table.py    GNU General Public License v3.0 5 votes vote down vote up
def _set_font(self):
        """Sets the font of the table"""
        font = QFont()
        font.setPointSize(FONT_SIZE)
        self.setFont(font) 
Example 50
Project: dunya-desktop   Author: MTG   File: tabwidget.py    GNU General Public License v3.0 5 votes vote down vote up
def _set_font(self):
        font = QFont()
        font.setPointSize(10)
        self.setFont(font) 
Example 51
Project: dunya-desktop   Author: MTG   File: queryframe.py    GNU General Public License v3.0 5 votes vote down vote up
def _set_label_filtering(self):
        """Sets the size policies of filtering label"""
        size_policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(
            self.label_filtering.sizePolicy().hasHeightForWidth())
        self.label_filtering.setSizePolicy(size_policy)

        # font for filtering label
        font = QFont()
        font.setPointSize(11)
        self.label_filtering.setFont(font) 
Example 52
Project: dunya-desktop   Author: MTG   File: queryframe.py    GNU General Public License v3.0 5 votes vote down vote up
def _set_line_edit_filter(self):
        """Sets the size policies of line edit filter"""
        font = QFont()
        font.setPointSize(10)
        self.lineEdit_filter.setFont(font) 
Example 53
Project: dunya-desktop   Author: MTG   File: combobox.py    GNU General Public License v3.0 5 votes vote down vote up
def set_placeholder_text(self, text):
        font = QFont()
        font.setPointSize(FONT_SIZE)

        self.lineEdit().setPlaceholderText(text)
        self.lineEdit().setFont(font) 
Example 54
Project: visma   Author: aerospaceresearch   File: window.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()
        font = QtGui.QFont()
        font.setPointSize(12)
        self.setFont(font)

        appIcon = QtGui.QIcon()
        # FIXME: Use fixed file path
        appIcon.addFile(os.path.abspath('assets/icons/16x16.png'))
        appIcon.addFile(os.path.abspath('assets/icons/32x32.png'))
        appIcon.addFile(os.path.abspath('assets/icons/64x64.png'))
        self.setWindowIcon(appIcon) 
Example 55
Project: plexdesktop   Author: coryo   File: delegates.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        s = Settings()
        browser_font_size = int(s.value('browser_font', 9))
        self.title_font = QtGui.QFont('Open Sans Extrabold', browser_font_size)
        self.summary_font = QtGui.QFont('Open Sans',
                                        browser_font_size * 0.95,
                                        QtGui.QFont.Bold)
        self.title_font_metrics = QtGui.QFontMetrics(self.title_font)
        self.summary_font_metrics = QtGui.QFontMetrics(self.title_font)
        self.last_icon_size = self.parent().iconSize().height() 
Example 56
Project: plexdesktop   Author: coryo   File: photo_viewer.py    GNU General Public License v3.0 5 votes vote down vote up
def show_indicator(self):
        self.indicator = self.scene.addText(
            'Loading', QtGui.QFont('Helvetica', 16, 1))
        self.indicator.setDefaultTextColor(QtGui.QColor('red'))
        viwport_center = self.ui.view.mapToScene(
            self.ui.view.viewport().geometry().center())
        self.indicator.setPos(viwport_center - self.indicator.boundingRect().center()) 
Example 57
Project: modtool_gui   Author: swap-nil7   File: gui.py    GNU General Public License v3.0 5 votes vote down vote up
def setup_newmod(self):
        """ Setup the newmod tab on the MainWindow """
        self.newmod = QtWidgets.QWidget()
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.newmod.setFont(font)
        self.newmod.setObjectName("newmod")
        self.grid_newmod = QtWidgets.QGridLayout(self.newmod)
        self.grid_newmod.setObjectName("grid_newmod")
        self.newmod_options = QtWidgets.QGroupBox(self.newmod)
        font = QtGui.QFont()
        font.setFamily("Carlito")
        font.setPointSize(12)
        font.setBold(False)
        font.setWeight(50)
        self.newmod_options.setFont(font)
        self.newmod_options.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.newmod_options.setObjectName("newmod_options")
        self.grid_newmod_options = QtWidgets.QGridLayout(self.newmod_options)
        self.grid_newmod_options.setObjectName("grid_newmod_options")
        self.label_newmod_modname = QtWidgets.QLabel(self.newmod_options)
        self.label_newmod_modname.setObjectName("label_newmod_modname")
        self.grid_newmod_options.addWidget(self.label_newmod_modname, 0, 0, 1, 1)
        self.newmod_run = QtWidgets.QPushButton(self.newmod_options)
        self.newmod_run.setToolTip("")
        self.newmod_run.setDefault(False)
        self.newmod_run.setFlat(False)
        self.newmod_run.setObjectName("newmod_run")
        self.grid_newmod_options.addWidget(self.newmod_run, 1, 0, 1, 1)
        self.newmod_modname = QtWidgets.QLineEdit(self.newmod_options)
        self.newmod_modname.setObjectName("newmod_modname")
        self.grid_newmod_options.addWidget(self.newmod_modname, 0, 1, 1, 1)
        self.grid_newmod.addWidget(self.newmod_options, 0, 1, 1, 1)
        self.commands.addTab(self.newmod, "") 
Example 58
Project: modtool_gui   Author: swap-nil7   File: gui.py    GNU General Public License v3.0 5 votes vote down vote up
def setup_disable(self):
        """ Setup disable tab in the MainWindow """
        self.disable = QtWidgets.QWidget()
        self.disable.setObjectName("disable")
        self.grid_disable = QtWidgets.QGridLayout(self.disable)
        self.grid_disable.setObjectName("grid_disable")
        self.disable_options = QtWidgets.QGroupBox(self.disable)
        font = QtGui.QFont()
        font.setFamily("Carlito")
        font.setPointSize(12)
        font.setBold(False)
        font.setWeight(50)
        self.disable_options.setFont(font)
        self.disable_options.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.disable_options.setObjectName("disable_options")
        self.grid_disable_options = QtWidgets.QGridLayout(self.disable_options)
        self.grid_disable_options.setObjectName("grid_disable_options")
        self.disable_run = QtWidgets.QPushButton(self.disable_options)
        self.disable_run.setToolTip("")
        self.disable_run.setDefault(False)
        self.disable_run.setFlat(False)
        self.disable_run.setObjectName("disable_run")
        self.grid_disable_options.addWidget(self.disable_run, 2, 0, 1, 1)
        self.label_disable_blockname = QtWidgets.QLabel(self.disable_options)
        self.label_disable_blockname.setObjectName("label_disable_blockname")
        self.grid_disable_options.addWidget(self.label_disable_blockname, 0, 0, 1, 1)
        self.disable_blockname = QtWidgets.QLineEdit(self.disable_options)
        self.disable_blockname.setObjectName("disable_blockname")
        self.grid_disable_options.addWidget(self.disable_blockname, 0, 2, 1, 1)
        self.grid_disable.addWidget(self.disable_options, 0, 0, 1, 1)
        self.disable_candidates = QtWidgets.QGroupBox(self.disable)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.disable_candidates.setFont(font)
        self.disable_candidates.setObjectName("disable_candidates")
        self.grid_disable.addWidget(self.disable_candidates, 0, 1, 1, 1)
        self.commands.addTab(self.disable, "") 
Example 59
Project: modtool_gui   Author: swap-nil7   File: gui.py    GNU General Public License v3.0 5 votes vote down vote up
def setup_makeyaml(self):
        """ Setup the makeyaml tab in the MainWindow """
        self.makeyaml = QtWidgets.QWidget()
        self.makeyaml.setObjectName("makeyaml")
        self.grid_makeyaml = QtWidgets.QGridLayout(self.makeyaml)
        self.grid_makeyaml.setObjectName("grid_makeyaml")
        self.makeyaml_options = QtWidgets.QGroupBox(self.makeyaml)
        font = QtGui.QFont()
        font.setFamily("Carlito")
        font.setPointSize(12)
        font.setBold(False)
        font.setWeight(50)
        self.makeyaml_options.setFont(font)
        self.makeyaml_options.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.makeyaml_options.setObjectName("makeyaml_options")
        self.grid_makeyaml_options = QtWidgets.QGridLayout(self.makeyaml_options)
        self.grid_makeyaml_options.setObjectName("grid_makeyaml_options")
        self.makeyaml_blockname = QtWidgets.QLineEdit(self.makeyaml_options)
        self.makeyaml_blockname.setObjectName("makeyaml_blockname")
        self.grid_makeyaml_options.addWidget(self.makeyaml_blockname, 0, 2, 1, 1)
        self.label_makeyaml_blockname = QtWidgets.QLabel(self.makeyaml_options)
        self.label_makeyaml_blockname.setObjectName("label_makeyaml_blockname")
        self.grid_makeyaml_options.addWidget(self.label_makeyaml_blockname, 0, 0, 1, 1)
        self.makeyaml_run = QtWidgets.QPushButton(self.makeyaml_options)
        self.makeyaml_run.setToolTip("")
        self.makeyaml_run.setDefault(False)
        self.makeyaml_run.setFlat(False)
        self.makeyaml_run.setObjectName("makeyaml_run")
        self.grid_makeyaml_options.addWidget(self.makeyaml_run, 2, 0, 1, 1)
        self.grid_makeyaml.addWidget(self.makeyaml_options, 0, 0, 1, 1)
        self.makeyaml_candidates = QtWidgets.QGroupBox(self.makeyaml)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.makeyaml_candidates.setFont(font)
        self.makeyaml_candidates.setObjectName("makeyaml_candidates")
        self.grid_makeyaml.addWidget(self.makeyaml_candidates, 0, 1, 1, 1)
        self.commands.addTab(self.makeyaml, "") 
Example 60
Project: modtool_gui   Author: swap-nil7   File: gui.py    GNU General Public License v3.0 5 votes vote down vote up
def setup_remove(self):
        """ Setup the remove tab in the MainWindow """
        self.remove = QtWidgets.QWidget()
        self.remove.setObjectName("remove")
        self.grid_remove = QtWidgets.QGridLayout(self.remove)
        self.grid_remove.setObjectName("grid_remove")
        self.remove_options = QtWidgets.QGroupBox(self.remove)
        font = QtGui.QFont()
        font.setFamily("Carlito")
        font.setPointSize(12)
        font.setBold(False)
        font.setWeight(50)
        self.remove_options.setFont(font)
        self.remove_options.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.remove_options.setObjectName("remove_options")
        self.grid_remove_options = QtWidgets.QGridLayout(self.remove_options)
        self.grid_remove_options.setObjectName("grid_remove_options")
        self.remove_blockname = QtWidgets.QLineEdit(self.remove_options)
        self.remove_blockname.setObjectName("remove_blockname")
        self.grid_remove_options.addWidget(self.remove_blockname, 0, 2, 1, 1)
        self.label_remove_blockname = QtWidgets.QLabel(self.remove_options)
        self.label_remove_blockname.setObjectName("label_remove_blockname")
        self.grid_remove_options.addWidget(self.label_remove_blockname, 0, 0, 1, 1)
        self.remove_run = QtWidgets.QPushButton(self.remove_options)
        self.remove_run.setToolTip("")
        self.remove_run.setDefault(False)
        self.remove_run.setFlat(False)
        self.remove_run.setObjectName("remove_run")
        self.grid_remove_options.addWidget(self.remove_run, 2, 0, 1, 1)
        self.grid_remove.addWidget(self.remove_options, 0, 0, 1, 1)
        self.remove_candidates = QtWidgets.QGroupBox(self.remove)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.remove_candidates.setFont(font)
        self.remove_candidates.setObjectName("remove_candidates")
        self.grid_remove.addWidget(self.remove_candidates, 0, 1, 1, 1)
        self.commands.addTab(self.remove, "") 
Example 61
Project: persepolis   Author: persepolisdm   File: persepolis.py    GNU General Public License v3.0 5 votes vote down vote up
def setPersepolisFont(self, font, font_size, custom_font):
        # font and font_size
        self.persepolis_font = font
        self.persepolis_font_size = font_size

        if custom_font == 'yes':
            self.setFont(QFont(font, font_size))
# color_scheme 
Example 62
Project: XulDebugTool   Author: starcor-company   File: AboutWindow.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def initAboutTitle(self):
        self.aboutTitle = QtWidgets.QLabel(self)
        self.aboutTitle.setGeometry(QtCore.QRect(0, 18, 400, 100))
        self.aboutTitle.setStyleSheet("QLabel{background: black; color: white;}")
        font = QFont()
        font.setPointSize(32)
        self.aboutTitle.setAlignment(Qt.AlignCenter)
        self.aboutTitle.setFont(font)
        self.aboutTitle.setObjectName("label_2")
        self.aboutTitle.setText("XulDebugTool") 
Example 63
Project: FIRST-plugin-ida   Author: vrtadmin   File: first.py    GNU General Public License v2.0 5 votes vote down vote up
def data(self, index, role=Qt.DisplayRole):
                '''The data stored under the given role for the item referred
                to by the index.

                Args:
                    index (:obj:`QtCore.QModelIndex`): Index
                    role (:obj:`Qt.ItemDataRole`): Default :obj:`Qt.DisplayRole`

                Returns:
                    data
                '''
                if role == Qt.DisplayRole:
                    row = self._data[index.row()]
                    if (index.column() == 0) and (type(row) != dict):
                        return row

                    elif index.column() < self.columnCount():
                        if type(row) == dict:
                            if self.header[index.column()] in row:
                                return row[self.header[index.column()]]
                            elif self.header[index.column()].lower() in row:
                                return row[self.header[index.column()].lower()]

                        return row[index.column()]

                    return None

                elif role == Qt.FontRole:
                    return QtGui.QFont().setPointSize(30)

                elif role == Qt.DecorationRole and index.column() == 0:
                    return None

                elif role == Qt.TextAlignmentRole:
                    return Qt.AlignLeft; 
Example 64
Project: Physics_Project   Author: QuandisS   File: setting_form.py    Apache License 2.0 4 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(200, 100)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(0, 0, 471, 251))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(self.gridLayoutWidget)
        font = QtGui.QFont()
        font.setPointSize(19)
        font.setBold(False)
        font.setItalic(False)
        font.setUnderline(False)
        font.setWeight(50)
        font.setStrikeOut(False)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.comboBox = QtWidgets.QComboBox(self.gridLayoutWidget)
        self.comboBox.setObjectName("comboBox")
        self.gridLayout.addWidget(self.comboBox, 1, 0, 1, 1)
        self.pushButton = QtWidgets.QPushButton(self.gridLayoutWidget)
        self.pushButton.setObjectName("pushButton")
        self.gridLayout.addWidget(self.pushButton, 2, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 471, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.centralwidget.setLayout(self.gridLayout)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        #test
        #self.add_item('test') 
Example 65
Project: dcc   Author: amimo   File: binwindow.py    Apache License 2.0 4 votes vote down vote up
def __init__(self, parent, source, title):
        super(binWidget, self).__init__()
        Observable.__init__(self)
        self.parent = parent

        self.title = title
        self.active = False
        # offset for text window
        # self.data = mapped
        self.dataOffset = 0

        self.dataModel = source
        self.cursor = Cursor(0, 0)

        self.themes = {
            'font': QtGui.QFont('Monaco', 9, QtGui.QFont.Light),
            'background': QtGui.QColor(0x00, 0x2b, 0x36),
            'background_cursor': QtGui.QColor(255, 255, 0),
            'selection': QtGui.QColor(125, 255, 0),
            'pen': QtGui.QColor(0xb5, 0x89, 0x00)
        }

        self.multipleViewModes = []
        for view_mode in self.dataModel.GetViews():
            v = view_mode(self.themes, self.size().width(), self.size().height(), self.dataModel, self.cursor, self)
            textDecorator = HighlightASCII(TextDecorator(v))

            v.setTransformationEngine(textDecorator)

            self.multipleViewModes.append(v)

        self.viewMode = self.multipleViewModes[0]

        self.Banners = Banners()

        self.Banners.add(FileAddrBanner(self.themes, self.dataModel, self.viewMode))
        self.Banners.add(TopBanner(self.themes, self.dataModel, self.viewMode))
        self.Banners.add(BottomBanner(self.themes, self.dataModel, self.viewMode))

        self.offsetWindow_h = 0
        self.offsetWindow_v = 0
        self.searchable = Searchable(self.dataModel, self.viewMode)

        self.initUI()

        self.searchWindow = SearchWindow(self, None, self.searchable)

        self.addHandler(self.searchable)
        self.addHandler(self.Banners)

        self.notify(self.viewMode) 
Example 66
Project: raspiblitz   Author: rootzoll   File: invoice.py    MIT License 4 votes vote down vote up
def setupUi(self, DialogSelectInvoice):
        DialogSelectInvoice.setObjectName("DialogSelectInvoice")
        DialogSelectInvoice.resize(480, 320)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(DialogSelectInvoice.sizePolicy().hasHeightForWidth())
        DialogSelectInvoice.setSizePolicy(sizePolicy)
        DialogSelectInvoice.setStyleSheet("")
        self.buttonBox = QtWidgets.QDialogButtonBox(DialogSelectInvoice)
        self.buttonBox.setGeometry(QtCore.QRect(102, 110, 320, 340))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
        self.buttonBox.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(28)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.buttonBox.setFont(font)
        self.buttonBox.setStyleSheet("background-color: lightgrey;\n"
"font: 28pt \"Arial\";")
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Yes)
        self.buttonBox.setObjectName("buttonBox")
        self.label = QtWidgets.QLabel(DialogSelectInvoice)
        self.label.setGeometry(QtCore.QRect(102, 30, 320, 64))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(20)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setStyleSheet("")
        self.label.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop)
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(DialogSelectInvoice)
        self.label_2.setGeometry(QtCore.QRect(0, 0, 47, 318))
        self.label_2.setText("")
        self.label_2.setPixmap(QtGui.QPixmap(":/RaspiBlitz/images/RaspiBlitz_Logo_Main_270.png"))
        self.label_2.setScaledContents(True)
        self.label_2.setObjectName("label_2")

        self.retranslateUi(DialogSelectInvoice)
        self.buttonBox.accepted.connect(DialogSelectInvoice.accept)
        self.buttonBox.rejected.connect(DialogSelectInvoice.reject)
        QtCore.QMetaObject.connectSlotsByName(DialogSelectInvoice) 
Example 67
Project: raspiblitz   Author: rootzoll   File: off.py    MIT License 4 votes vote down vote up
def setupUi(self, DialogConfirmOff):
        DialogConfirmOff.setObjectName("DialogConfirmOff")
        DialogConfirmOff.resize(480, 320)
        DialogConfirmOff.setStyleSheet("background-color: rgb(255, 128, 128)")
        self.label_2 = QtWidgets.QLabel(DialogConfirmOff)
        self.label_2.setGeometry(QtCore.QRect(9, 9, 16, 16))
        self.label_2.setMaximumSize(QtCore.QSize(110, 320))
        self.label_2.setText("")
        self.label_2.setPixmap(QtGui.QPixmap(":/RaspiBlitz/images/RaspiBlitz_Logo_Main_rotate.png"))
        self.label_2.setScaledContents(True)
        self.label_2.setIndent(-4)
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(DialogConfirmOff)
        self.label_3.setGeometry(QtCore.QRect(0, 0, 47, 318))
        self.label_3.setText("")
        self.label_3.setPixmap(QtGui.QPixmap(":/RaspiBlitz/images/RaspiBlitz_Logo_Main_270.png"))
        self.label_3.setScaledContents(True)
        self.label_3.setObjectName("label_3")
        self.label = QtWidgets.QLabel(DialogConfirmOff)
        self.label.setGeometry(QtCore.QRect(102, 30, 320, 64))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(20)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setStyleSheet("")
        self.label.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop)
        self.label.setObjectName("label")
        self.buttonBox = QtWidgets.QDialogButtonBox(DialogConfirmOff)
        self.buttonBox.setGeometry(QtCore.QRect(102, 110, 320, 340))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
        self.buttonBox.setSizePolicy(sizePolicy)
        self.buttonBox.setMinimumSize(QtCore.QSize(0, 0))
        self.buttonBox.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(28)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.buttonBox.setFont(font)
        self.buttonBox.setStyleSheet("background-color: lightgrey;\n"
"font: 28pt \"Arial\";")
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Retry|QtWidgets.QDialogButtonBox.Yes)
        self.buttonBox.setObjectName("buttonBox")

        self.retranslateUi(DialogConfirmOff)
        self.buttonBox.rejected.connect(DialogConfirmOff.reject)
        self.buttonBox.accepted.connect(DialogConfirmOff.accept)
        QtCore.QMetaObject.connectSlotsByName(DialogConfirmOff) 
Example 68
Project: kucher   Author: Zubax   File: phase_manipulation_widget.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self,
                 parent:            QWidget,
                 commander:         Commander):
        super(Widget, self).__init__(parent)

        self._commander = commander
        self._event_suppression_depth = 0

        self._sync_checkbox = QCheckBox(self)
        self._sync_checkbox.setIcon(get_icon('link'))
        self._sync_checkbox.setChecked(True)
        self._sync_checkbox.stateChanged.connect(self._on_sync_checkbox_changed)
        self._sync_checkbox.setToolTip('Always same value for all phases')
        self._sync_checkbox.setStatusTip(self._sync_checkbox.toolTip())

        self._send_button = \
            make_button(self,
                        text='Execute',
                        icon_name='send-up',
                        tool_tip='Sends the command to the device; also, while this button is checked (pressed), '
                                 'commands will be sent automatically every time the controls are changed by the user.',
                        checkable=True,
                        checked=False,
                        on_clicked=self._on_send_button_changed)

        self._phase_controls = [
            SpinboxLinkedWithSlider(self,
                                    minimum=0.0,
                                    maximum=100.0,
                                    step=1.0,
                                    slider_orientation=SpinboxLinkedWithSlider.SliderOrientation.HORIZONTAL)
            for _ in range(3)
        ]

        for pc in self._phase_controls:
            pc.spinbox_suffix = ' %'
            pc.value_change_event.connect(self._on_any_control_changed)

        def make_fat_label(text: str) -> QLabel:
            lbl = QLabel(text, self)
            font: QFont = lbl.font()
            font.setBold(True)
            lbl.setFont(font)
            return lbl

        top_layout_items = []

        for index, pc in enumerate(self._phase_controls):
            top_layout_items.append(lay_out_horizontally(
                make_fat_label('ABC'[index]),
                pc.spinbox,
                (pc.slider, 1),
            ))

        self.setLayout(
            lay_out_horizontally(*(top_layout_items + [self._sync_checkbox, self._send_button]))
        ) 
Example 69
Project: Python-GUI   Author: arpitj07   File: Project.py    MIT License 4 votes vote down vote up
def removelist1(self, item):
        
         if self.BATSMAN.isChecked()==True:
            self.listWidget_2.takeItem(self.listWidget_2.row(item))
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            item.setFont(font)
            self.listWidget.addItem(item)
            self.batsmancount+=1
            self.totalcount=self.listWidget.count()
            self.error()
            self.Batcount.setText(str(self.batsmancount))
            self.playerscount.setText(str(self.totalcount))

         elif self.WICKETKEEPER.isChecked()==True:
            self.listWidget_2.takeItem(self.listWidget_2.row(item))
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            item.setFont(font)
            self.listWidget.addItem(item)
            self.wkeepercount+=1
            self.totalcount=self.listWidget.count()
            self.error()
            self.Wkcount.setText(str(self.wkeepercount))
            self.playerscount.setText(str(self.totalcount))

         elif self.ALLROUNDER.isChecked()==True:
            self.listWidget_2.takeItem(self.listWidget_2.row(item))
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            item.setFont(font)
            self.listWidget.addItem(item)
            self.allcount+=1
            self.totalcount=self.listWidget.count()
            self.error()
            self.Alrcount.setText(str(self.allcount))
            self.playerscount.setText(str(self.totalcount))

         else :
            self.listWidget_2.takeItem(self.listWidget_2.row(item))
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            item.setFont(font)
            self.listWidget.addItem(item)
            self.ballcount+=1
            self.totalcount=self.listWidget.count()
            self.error()
            self.Bowlcount.setText(str(self.ballcount))
            self.playerscount.setText(str(self.totalcount)) 
Example 70
Project: HippMapp3r   Author: mgoubran   File: gui.py    GNU General Public License v3.0 4 votes vote down vote up
def main():
    app = QtWidgets.QApplication(sys.argv)

    mainwidget = QtWidgets.QWidget()
    mainwidget.resize(150, 550)

    font = QtGui.QFont('Mono', 10, QtGui.QFont.Light)
    mainwidget.setFont(font)
    mainwidget.move(QtWidgets.QApplication.desktop().screen().rect().center() - mainwidget.rect().center())

    ver = hippmapper.__version__
    mainwidget.setWindowTitle("HippMapp3r %s" % ver)

    p = mainwidget.palette()
    # p.setColor(mainwidget.backgroundRole(), QtCore.Qt.black)
    mainwidget.setPalette(p)

    vbox = QtWidgets.QVBoxLayout(mainwidget)

    gui_file = os.path.realpath(__file__)
    hyper_home = Path(gui_file).parents[0]
    hyper_mother = Path(gui_file).parents[1]

    pic = QtWidgets.QLabel()
    pixmap = QtGui.QPixmap("%s/docs/images/hippmapper_icon.png" % hyper_mother)

    pixmaps = pixmap.scaled(270, 150)  # QtCore.Qt.KeepAspectRatio
    pic.setPixmap(pixmaps)
    pic.setAlignment(QtCore.Qt.AlignCenter)

    vbox.addWidget(pic)

    tabs = QtWidgets.QTabWidget()
    tabs.setTabBar(HorzTabBarWidget(width=150, height=50))

    for m, mod in enumerate(modules):

        widget = QtWidgets.QWidget()
        widget.layout = QtWidgets.QVBoxLayout()

        for b in range(len(nested_dict[mod]['functions'])):
            btn = fun_button(nested_dict, mod, b, hyper_home)
            widget.layout.addWidget(btn)

        widget.setLayout(widget.layout)
        tabs.addTab(widget, mod)

    tabs.setTabPosition(QtWidgets.QTabWidget.West)

    vbox.addWidget(tabs)

    mainwidget.setLayout(vbox)
    mainwidget.show()

    sys.exit(app.exec_()) 
Example 71
Project: openeo-qgis-plugin   Author: Open-EO   File: openeo_connector_dialog.py    Apache License 2.0 4 votes vote down vote up
def process_selected(self):
        """
        Gets called if a new process is selected at the process combobox.
        It loads all agruments with their type and an example (if exist) into the value
        """
        self.processTableWidget.clear()
        for p in self.processes:
            if "id" in p:
                if p['id'] == str(self.processBox.currentText()):
                    process = p
                    if "parameters" in process:
                        # info(self.iface, "New Process {}".format(process['parameters']))
                        self.processTableWidget.setRowCount(len(process['parameters']))
                        self.processTableWidget.setColumnCount(3)
                        self.processTableWidget.setHorizontalHeaderLabels(['Parameter', 'Type', 'Example'])
                        header = self.processTableWidget.horizontalHeader()
                        header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
                        header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
                        header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch)

                        counter = 0
                        for key, val in process['parameters'].items():
                            # if key != "data" and key != "imagery":
                            qitem = QTableWidgetItem(key)
                            qitem.setFlags(QtCore.Qt.ItemIsEnabled)
                            if "required" in val:
                                if val["required"]:
                                    boldFont = QtGui.QFont()
                                    boldFont.setBold(True)
                                    qitem.setFont(boldFont)

                            self.processTableWidget.setItem(counter, 0, qitem)
                            if "schema" in val:
                                if "type" in val["schema"]:
                                    type = QTableWidgetItem(str(val['schema']['type']))
                                    type.setFlags(QtCore.Qt.ItemIsEnabled)
                                    self.processTableWidget.setItem(counter, 1, type)
                                if "examples" in val["schema"]:
                                    # type = QTableWidgetItem(str(val['schema']['type']))
                                    # type.setFlags(QtCore.Qt.ItemIsEnabled)
                                    # self.processTableWidget.setItem(counter, 2, type)
                                    example = QTableWidgetItem(str(val['schema']['examples'][0]))
                                    example.setFlags(QtCore.Qt.ItemIsEnabled)
                                    self.processTableWidget.setItem(counter, 2, example)
                                else:
                                    example = QTableWidgetItem("")
                                    example.setFlags(QtCore.Qt.ItemIsEnabled)
                                    self.processTableWidget.setItem(counter, 2, example)
                            counter += 1
                        return
                    else:
                        info(self.iface, "New Process: Parameters not found") 
Example 72
Project: tf-pose   Author: SrikanthVelpuri   File: FlowchartCtrlTemplate_pyqt5.py    Apache License 2.0 4 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(217, 499)
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setVerticalSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.loadBtn = QtWidgets.QPushButton(Form)
        self.loadBtn.setObjectName("loadBtn")
        self.gridLayout.addWidget(self.loadBtn, 1, 0, 1, 1)
        self.saveBtn = FeedbackButton(Form)
        self.saveBtn.setObjectName("saveBtn")
        self.gridLayout.addWidget(self.saveBtn, 1, 1, 1, 2)
        self.saveAsBtn = FeedbackButton(Form)
        self.saveAsBtn.setObjectName("saveAsBtn")
        self.gridLayout.addWidget(self.saveAsBtn, 1, 3, 1, 1)
        self.reloadBtn = FeedbackButton(Form)
        self.reloadBtn.setCheckable(False)
        self.reloadBtn.setFlat(False)
        self.reloadBtn.setObjectName("reloadBtn")
        self.gridLayout.addWidget(self.reloadBtn, 4, 0, 1, 2)
        self.showChartBtn = QtWidgets.QPushButton(Form)
        self.showChartBtn.setCheckable(True)
        self.showChartBtn.setObjectName("showChartBtn")
        self.gridLayout.addWidget(self.showChartBtn, 4, 2, 1, 2)
        self.ctrlList = TreeWidget(Form)
        self.ctrlList.setObjectName("ctrlList")
        self.ctrlList.headerItem().setText(0, "1")
        self.ctrlList.header().setVisible(False)
        self.ctrlList.header().setStretchLastSection(False)
        self.gridLayout.addWidget(self.ctrlList, 3, 0, 1, 4)
        self.fileNameLabel = QtWidgets.QLabel(Form)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.fileNameLabel.setFont(font)
        self.fileNameLabel.setText("")
        self.fileNameLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.fileNameLabel.setObjectName("fileNameLabel")
        self.gridLayout.addWidget(self.fileNameLabel, 0, 1, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 73
Project: MeiTingTrunk   Author: Xunius   File: doc_table.py    GNU General Public License v3.0 4 votes vote down vote up
def data(self, index, role):
        if not index.isValid():
            return QVariant()

        #if role == Qt.BackgroundRole:
            #if index.row()%2==0:
                #return QBrush(QColor(230,230,249))
                #pass

        if role == Qt.FontRole:
            font=self.settings.value('display/fonts/doc_table',QFont)
            if self.arraydata[index.row()][9] in [None, 'false']:
                font.setBold(True)
            else:
                font.setBold(False)
            return font

        if role==Qt.DisplayRole:
            if index.column() in self.icon_sec_indices:
                return
            elif index.column()==self.headerdata.index('added'):
                added=self.arraydata[index.row()][index.column()]
                if added:
                    # convert time to str
                    added=int(added[:10])
                    added=datetime.fromtimestamp(added)
                    if added.year==datetime.today().year:
                        added=added.strftime('%b-%d')
                    else:
                        added=added.strftime('%b-%d-%y')
                    return QVariant(added)
                else:
                    return
            else:
                return QVariant(self.arraydata[index.row()][index.column()])

        if role==Qt.EditRole:
            return QVariant(self.arraydata[index.row()][index.column()])

        #if role==Qt.TextAlignmentRole:
            #return Qt.AlignCenter
        if index.column() in self.check_sec_indices and role==Qt.CheckStateRole:
            if self.arraydata[index.row()][index.column()].isChecked():
                return Qt.Checked
            else:
                return Qt.Unchecked
        if index.column() in self.icon_sec_indices and role==Qt.DecorationRole:
            if self.arraydata[index.row()][index.column()]:
                return self.icon_section['has_file']
            else:
                return None

        if role != Qt.DisplayRole:
            return QVariant() 
Example 74
Project: data-structure   Author: yunowo   File: about.py    GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, about_dialog):
        about_dialog.setObjectName("about_dialog")
        about_dialog.setWindowModality(QtCore.Qt.WindowModal)
        about_dialog.resize(400, 280)
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
        about_dialog.setPalette(palette)
        font = QtGui.QFont()
        font.setFamily("微软雅黑")
        about_dialog.setFont(font)
        about_dialog.setModal(True)
        self.buttonbox = QtWidgets.QDialogButtonBox(about_dialog)
        self.buttonbox.setGeometry(QtCore.QRect(150, 240, 211, 32))
        self.buttonbox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonbox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
        self.buttonbox.setObjectName("buttonbox")
        self.header = QtWidgets.QLabel(about_dialog)
        self.header.setGeometry(QtCore.QRect(150, 20, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.header.setFont(font)
        self.header.setObjectName("header")
        self.info = QtWidgets.QLabel(about_dialog)
        self.info.setGeometry(QtCore.QRect(150, 50, 251, 191))
        self.info.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.info.setObjectName("info")
        self.logo = QtWidgets.QLabel(about_dialog)
        self.logo.setGeometry(QtCore.QRect(20, 20, 100, 100))
        self.logo.setText("")
        self.logo.setPixmap(QtGui.QPixmap(":/icon/img/logo.png"))
        self.logo.setScaledContents(True)
        self.logo.setObjectName("logo")

        self.retranslateUi(about_dialog)
        self.buttonbox.accepted.connect(about_dialog.accept)
        self.buttonbox.rejected.connect(about_dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(about_dialog) 
Example 75
Project: BBoxEE   Author: persts   File: annotation_widget.py    GNU General Public License v3.0 4 votes vote down vote up
def display_bboxes(self):
        """Display bboxes in graphics scene."""
        if self.bboxes:
            for bbox in self.bboxes:
                self.graphics_scene.removeItem(bbox)
            self.bboxes = []
        if (self.data is not None and
                self.current_file_name in self.data['images']):
            rec = self.data['images'][self.current_file_name]
            annotations = rec['annotations']
            width = self.current_img_size[0]
            height = self.current_img_size[1]
            for index, annotation in enumerate(annotations):
                bbox = annotation['bbox']
                x = annotation['bbox']['xmin'] * width
                y = annotation['bbox']['ymin'] * height
                top_left = QtCore.QPointF(x, y)

                x = annotation['bbox']['xmax'] * width
                y = annotation['bbox']['ymax'] * height
                bottom_right = QtCore.QPointF(x, y)

                rect = QtCore.QRectF(top_left, bottom_right)
                if index == self.selected_row:
                    pen = QtGui.QPen(QtGui.QBrush(QtCore.Qt.red,
                                                  QtCore.Qt.SolidPattern), 3)
                else:
                    pen = QtGui.QPen(QtGui.QBrush(QtCore.Qt.yellow,
                                                  QtCore.Qt.SolidPattern), 3)
                    if (annotation['created_by'] == 'machine' and
                            annotation['updated_by'] == ''):
                        pen = QtGui.QPen(QtGui.QBrush(QtCore.Qt.green,
                                                      QtCore.Qt.SolidPattern),
                                         3)
                graphics_item = self.graphics_scene.addRect(rect, pen)
                # display annotation data center in bounding box.
                if self.checkBoxDisplayAnnotationData.isChecked():
                    font = QtGui.QFont()
                    font.setPointSize(int(rect.width() * 0.065))
                    s = "{}\nTruncated: {}\nOccluded: {}\nDifficult: {}"
                    content = (s.
                               format(annotation['label'],
                                      annotation['truncated'],
                                      annotation['occluded'],
                                      annotation['difficult']))
                    text = QtWidgets.QGraphicsTextItem(content)
                    text.setFont(font)
                    text.setPos(rect.topLeft().toPoint())
                    text.setDefaultTextColor(QtCore.Qt.yellow)
                    x_offset = text.boundingRect().width() / 2.0
                    y_offset = text.boundingRect().height() / 2.0
                    x = (rect.width() / 2.0) - x_offset
                    y = (rect.height() / 2.0) - y_offset
                    text.moveBy(x, y)
                    text.setParentItem(graphics_item)
                self.bboxes.append(graphics_item)
                if index == self.selected_row:
                    self.graphicsView.selected_bbox = graphics_item 
Example 76
Project: phidl   Author: amccaugh   File: quickplotter.py    MIT License 4 votes vote down vote up
def __init__(self):
        super(ViewerWindow,self).__init__()

        self.setGeometry(QRect(100, 100, 800, 600))
        self.setWindowTitle("PHIDL quickplot");

        # Create "grid size = 40.0" label
        self.gridsize_label = QLabel('ABCDEF', self)
        self.gridsize_label.setFont(QtGui.QFont('SansSerif', 10))
        self.gridsize_label.move(0, 200)
        self.gridsize_label.setAlignment(Qt.AlignLeft)
        self.gridsize_label.setStyleSheet('color: gray')
        self.gridsize_label.setFixedWidth(120)
        self.gridsize_label.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)

        # Create "X=40.001, Y = 70.183" label
        self.position_label = QLabel('ABCDEF', self)
        self.position_label.setFont(QtGui.QFont('SansSerif', 10))
        self.position_label.move(50, 200)
        self.position_label.setAlignment(Qt.AlignRight)
        self.position_label.setStyleSheet('color: gray')
        self.position_label.setFixedWidth(240)
        self.position_label.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)

        # Create "Press ? for help" label
        self.help_label = QLabel('ABCDEF', self)
        self.help_label.setFont(QtGui.QFont('SansSerif', 10))
        self.help_label.move(50, 200)
        self.help_label.setAlignment(Qt.AlignCenter)
        self.help_label.setStyleSheet('color: gray')
        self.help_label.setFixedWidth(200)
        self.help_label.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)


        # Create label useful for debugging
        self.debug_label = QLabel('', self)
        self.debug_label.setFont(QtGui.QFont('SansSerif', 10))
        self.debug_label.move(200, 200)
        self.debug_label.setAlignment(Qt.AlignCenter)
        self.debug_label.setStyleSheet('color: gray')
        self.debug_label.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)



        # Create QGraphicsView
        self.viewer = Viewer(gridsize_label = self.gridsize_label,
                             position_label = self.position_label,
                             help_label = self.help_label)
        self.setCentralWidget(self.viewer)

        # Reorder widgets
        self.gridsize_label.raise_()
        self.position_label.raise_()
        self.debug_label.raise_()
        self.help_label.raise_()
        self.show() 
Example 77
Project: phidl   Author: amccaugh   File: quickplotter.py    MIT License 4 votes vote down vote up
def __init__(self, gridsize_label, position_label, help_label):
        QGraphicsView.__init__(self)

        self.gridsize_label = gridsize_label
        self.position_label = position_label
        self.help_label = help_label

        # Create a QGraphicsScene which this view looks at
        self.scene = QGraphicsScene(self)
        self.scene.setSceneRect(QRectF())
        self.setScene(self.scene)

        # Customize QGraphicsView
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setInteractive(False)
        self.scale(1,-1) # Flips around the Y axis
         # Use OpenGL http://ralsina.me/stories/BBS53.html
#        self.setViewport(QtOpenGL.QGLWidget())
        self.rubberBand = QRubberBand(QRubberBand.Rectangle, self)
        self.pen = QPen(QtCore.Qt.black, 0)
        self.portpen = QPen(PORT_COLOR, 3)
        self.portpen.setCosmetic(True) # Makes constant width
        self.portfont = QtGui.QFont('Arial', pointSize = 14)
        self.portfontcolor = PORT_COLOR
        self.subportpen = QPen(SUBPORT_COLOR, 3)
        self.subportpen.setCosmetic(True) # Makes constant width
        self.subportfont = QtGui.QFont('Arial', pointSize = 14)
        self.subportfontcolor = SUBPORT_COLOR

        # Tracking ports

        # Various status variables
        self._mousePressed = None
        self._rb_origin = QPoint()
        self.zoom_factor_total = 1

        # Grid variables
        self.gridpen = QPen(QtCore.Qt.black, 0)
        self.gridpen.setStyle(QtCore.Qt.DotLine)
        self.gridpen.setDashPattern([1,4])
        self.gridpen.setColor(QtGui.QColor(0, 0, 0, 125))
#        self.gridpen = QPen(QtCore.Qt.black, 1)
#        self.gridpen.setCosmetic(True) # Makes constant width
        self.scene_polys = []

        self.initialize() 
Example 78
Project: confidential-debt-simplification   Author: ric2b   File: ui_main.py    GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(544, 527)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.main_layout = QtWidgets.QVBoxLayout()
        self.main_layout.setObjectName("main_layout")
        self.info_group_box = QtWidgets.QGroupBox(self.centralwidget)
        self.info_group_box.setObjectName("info_group_box")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.info_group_box)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.balance_label = QtWidgets.QLabel(self.info_group_box)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.balance_label.setFont(font)
        self.balance_label.setObjectName("balance_label")
        self.horizontalLayout.addWidget(self.balance_label)
        self.balance_value = QtWidgets.QLabel(self.info_group_box)
        self.balance_value.setObjectName("balance_value")
        self.horizontalLayout.addWidget(self.balance_value)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.label = QtWidgets.QLabel(self.info_group_box)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.verticalLayout_2.addWidget(self.label)
        self.transactions_list = QtWidgets.QListWidget(self.info_group_box)
        self.transactions_list.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.transactions_list.setObjectName("transactions_list")
        self.verticalLayout_2.addWidget(self.transactions_list)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.uome_button = QtWidgets.QPushButton(self.info_group_box)
        self.uome_button.setObjectName("uome_button")
        self.horizontalLayout_2.addWidget(self.uome_button)
        self.invite_button = QtWidgets.QPushButton(self.info_group_box)
        self.invite_button.setObjectName("invite_button")
        self.horizontalLayout_2.addWidget(self.invite_button)
        self.refresh_button = QtWidgets.QPushButton(self.info_group_box)
        self.refresh_button.setObjectName("refresh_button")
        self.horizontalLayout_2.addWidget(self.refresh_button)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)
        self.transactions_list.raise_()
        self.label.raise_()
        self.main_layout.addWidget(self.info_group_box)
        self.verticalLayout.addLayout(self.main_layout)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
Example 79
Project: modtool_gui   Author: swap-nil7   File: gui.py    GNU General Public License v3.0 4 votes vote down vote up
def setup_rename(self):
        """ Setup the rename tab in the MainWindow """
        self.rename = QtWidgets.QWidget()
        self.rename.setObjectName("rename")
        self.grid_rename = QtWidgets.QGridLayout(self.rename)
        self.grid_rename.setObjectName("grid_rename")
        self.rename_options = QtWidgets.QGroupBox(self.rename)
        font = QtGui.QFont()
        font.setFamily("Carlito")
        font.setPointSize(12)
        font.setBold(False)
        font.setWeight(50)
        self.rename_options.setFont(font)
        self.rename_options.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.rename_options.setObjectName("rename_options")
        self.grid_rename_options = QtWidgets.QGridLayout(self.rename_options)
        self.grid_rename_options.setObjectName("grid_rename_options")
        self.label_rename_oldname = QtWidgets.QLabel(self.rename_options)
        self.label_rename_oldname.setObjectName("label_rename_oldname")
        self.grid_rename_options.addWidget(self.label_rename_oldname, 0, 0, 1, 1)
        self.rename_oldname = QtWidgets.QLineEdit(self.rename_options)
        self.rename_oldname.setObjectName("rename_oldname")
        self.grid_rename_options.addWidget(self.rename_oldname, 0, 2, 1, 1)
        self.rename_run = QtWidgets.QPushButton(self.rename_options)
        self.rename_run.setToolTip("")
        self.rename_run.setDefault(False)
        self.rename_run.setFlat(False)
        self.rename_run.setObjectName("rename_run")
        self.grid_rename_options.addWidget(self.rename_run, 3, 0, 1, 1)
        self.rename_newname = QtWidgets.QLineEdit(self.rename_options)
        self.rename_newname.setObjectName("rename_newname")
        self.grid_rename_options.addWidget(self.rename_newname, 1, 2, 1, 1)
        self.label_rename_newname = QtWidgets.QLabel(self.rename_options)
        self.label_rename_newname.setObjectName("label_rename_newname")
        self.grid_rename_options.addWidget(self.label_rename_newname, 1, 0, 1, 1)
        self.grid_rename.addWidget(self.rename_options, 0, 0, 1, 1)
        self.rename_candidates = QtWidgets.QGroupBox(self.rename)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.rename_candidates.setFont(font)
        self.rename_candidates.setObjectName("rename_candidates")
        self.grid_rename.addWidget(self.rename_candidates, 0, 1, 1, 1)
        self.commands.addTab(self.rename, "") 
Example 80
Project: modtool_gui   Author: swap-nil7   File: gui.py    GNU General Public License v3.0 4 votes vote down vote up
def setup_common_params(self):
        """ Setup the coomon tab in the MainWindow """
        self.common_params = QtWidgets.QWidget()
        self.common_params.setObjectName("common_params")
        self.grid_common = QtWidgets.QGridLayout(self.common_params)
        self.grid_common.setObjectName("grid_common")
        self.common_options = QtWidgets.QGroupBox(self.common_params)
        font = QtGui.QFont()
        font.setFamily("Carlito")
        font.setPointSize(12)
        font.setBold(False)
        font.setWeight(50)
        self.common_options.setFont(font)
        self.common_options.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.common_options.setObjectName("common_options")
        self.grid_common_options = QtWidgets.QGridLayout(self.common_options)
        self.grid_common_options.setObjectName("grid_common_options")
        self.directory = QtWidgets.QLineEdit(self.common_options)
        self.directory.setObjectName("directory")
        self.grid_common_options.addWidget(self.directory, 0, 1, 1, 1)
        self.skip_swig = QtWidgets.QCheckBox(self.common_options)
        self.skip_swig.setObjectName("skip_swig")
        self.grid_common_options.addWidget(self.skip_swig, 2, 1, 1, 1)
        self.label_directory = QtWidgets.QLabel(self.common_options)
        self.label_directory.setObjectName("label_directory")
        self.grid_common_options.addWidget(self.label_directory, 0, 0, 1, 1)
        self.skip_lib = QtWidgets.QCheckBox(self.common_options)
        self.skip_lib.setObjectName("skip_lib")
        self.grid_common_options.addWidget(self.skip_lib, 1, 1, 1, 1)
        self.label_skip_dir = QtWidgets.QLabel(self.common_options)
        self.label_skip_dir.setObjectName("label_skip_dir")
        self.grid_common_options.addWidget(self.label_skip_dir, 1, 0, 1, 1)
        self.skip_python = QtWidgets.QCheckBox(self.common_options)
        self.skip_python.setObjectName("skip_python")
        self.grid_common_options.addWidget(self.skip_python, 3, 1, 1, 1)
        self.skip_grc = QtWidgets.QCheckBox(self.common_options)
        self.skip_grc.setObjectName("skip_grc")
        self.grid_common_options.addWidget(self.skip_grc, 4, 1, 1, 1)
        self.scm_mode = QtWidgets.QComboBox(self.common_options)
        self.scm_mode.setObjectName("scm_mode")
        self.scm_mode.addItem("")
        self.scm_mode.addItem("")
        self.scm_mode.addItem("")
        self.grid_common_options.addWidget(self.scm_mode, 5, 1, 1, 1)
        self.label_scm_mode = QtWidgets.QLabel(self.common_options)
        self.label_scm_mode.setObjectName("label_scm_mode")
        self.grid_common_options.addWidget(self.label_scm_mode, 5, 0, 1, 1)
        self.grid_common.addWidget(self.common_options, 0, 0, 1, 1)
        self.commands.addTab(self.common_params, "")