Beispiel #1
0
 def index(self, pr_item):
     # paint row & set handle info
     if self.marked_row is not None:
         if self.marked_row == pr_item.row():
             for i in range(self.table.columnCount()):
                 self.handles_table.item(self.marked_row, i).setBackground(Qt.QColor('white'))
             self.marked_row = None
             self.handle_info.clear()
         else:
             for i in range(self.handles_table.columnCount()):
                 self.handles_table.item(self.marked_row, i).setBackground(Qt.QColor('white'))
             self.marked_row = pr_item.row()
             for i in range(self.handles_table.columnCount()):
                 self.handles_table.item(self.marked_row, i).setBackground(Qt.QColor('green'))
             self.handle_info.clear()
             handle = self.handles.get_handle(self.marked_row)
             for key, val in handle.items():
                 self.handle_info.append('Name: ' + key + ' | ' + 'Step: ' + str(val[1]))
     else:
         self.marked_row = pr_item.row()
         for i in range(self.handles_table.columnCount()):
             self.handles_table.item(self.marked_row, i).setBackground(Qt.QColor('green'))
         handle = self.handles.get_handle(self.marked_row)
         for key, val in handle.items():
             self.handle_info.append('Name: ' + key + ' | ' + 'Step: ' + str(val[1]))
Beispiel #2
0
 def index(self, row, column=0):
     # paint row & set handle info
     self.edit_block = True
     if self.marked_row is not None:
         if self.marked_row == row:
             for i in range(self.handles_table.columnCount()):
                 self.handles_table.item(self.marked_row, i).setBackground(
                     Qt.QColor('white'))
             self.marked_row = None
             self.handle_info.clear()
         else:
             for i in range(self.handles_table.columnCount()):
                 self.handles_table.item(self.marked_row, i).setBackground(
                     Qt.QColor('white'))
             self.marked_row = row
             for i in range(self.handles_table.columnCount()):
                 self.handles_table.item(row, i).setBackground(
                     Qt.QColor(21, 139, 195))
             self.handle_info.clear()
             handle_i = self.knobs_info[row]
             for key, val in handle_i.items():
                 self.handle_info.append('Name: ' +
                                         val['name'].split('.')[-1] +
                                         ' | ' + 'Step: ' +
                                         str(val['step']))
     else:
         self.marked_row = row
         for i in range(self.handles_table.columnCount()):
             self.handles_table.item(row, i).setBackground(
                 Qt.QColor(21, 139, 195))
         handle = self.knobs_info[row]
         for key, val in handle.items():
             self.handle_info.append('Name: ' + val['name'].split('.')[-1] +
                                     ' | ' + 'Step: ' + str(val['step']))
     self.edit_block = False
Beispiel #3
0
    def update_feature_table(self):
        self.feature_table.setRowCount(0)
        # disconnect signal, else it would be called when adding a row
        try:
            self.feature_table.cellChanged.disconnect()
        except:
            pass

        # available features
        for row, feature_type in enumerate(FEATURES):
            self.feature_table.insertRow(row)
            feat_item = QTableWidgetItem(feature_type.label)
            feat_item.setCheckState(False)
            b_color = Qt.QColor(255, 255, 255)
            if issubclass(feature_type, UnorderedFeature):
                codebooks = self.store.list_codebooks(feature_type)
                if len(codebooks) == 0:
                    dict_label = 'dictionary required, but none found'
                    b_color = Qt.QColor(255, 230, 230)
                else:
                    dict_label = ' | '.join(codebooks)
                    b_color = Qt.QColor(230, 255, 230)
            else:
                dict_label = 'no dictionary needed'

            dict_item = QTableWidgetItem(dict_label)
            dict_item.setBackground(b_color)
            self.feature_table.setItem(row, 0, feat_item)
            self.feature_table.setItem(row, 1, dict_item)

        self.feature_table.resizeColumnsToContents()
        self.feature_table.cellChanged.connect(self.color_species_table)
Beispiel #4
0
 def painter_set_basic_painter(self):
     self.game_painter.setPen(
         qt.QPen(qt.QColor(0, 0, 0), 1, qtcore.Qt.SolidLine))
     # self.game_painter.setBrush(qtcore.Qt.NoBrush)
     self.game_painter.setBrush(
         qt.QBrush(qt.QColor(254, 254, 254), qtcore.Qt.Dense4Pattern))
     pass
Beispiel #5
0
class Table(Qt.QAbstractTableModel):
    def __init__(self):
        super().__init__()
        self._data = []
        pass

    DISPLAY_WIDTH = 40
    DISPLAY_HEIGHT = 8

    def rowCount(self, index=Qt.QModelIndex()):
        return self.DISPLAY_HEIGHT

    def columnCount(self, index=Qt.QModelIndex()):
        return self.DISPLAY_WIDTH

    ON = Qt.QColor(255, 0, 0)
    OFF = Qt.QColor(0, 0, 0)

    def data(self, index: Qt.QModelIndex, role: int):
        if role == QtCore.Qt.DisplayRole:
            return None

        elif role == QtCore.Qt.SizeHintRole:
            return Qt.QSize(0, 0)
        elif role == QtCore.Qt.BackgroundRole:
            num = index.column()
            if num < len(self._data):
                val = self._data[num]
                MASK = 1 << index.row()
                return self.ON if MASK & val else self.OFF
            return self.OFF

    def addColumn(self, val: int):
        self._data.append(val)
Beispiel #6
0
    def paintEvent(self, event):
        painter = QPainter()
        painter.begin(self)
        painter.setPen(Qt.QPen(Qt.QColor('#3d3c3c')))
        painter.setFont(QFont("MS Shell Dlg 2", 16))

        if self.move_mode_open:
            painter.fillRect(Qt.QRectF(0, 0, 1280, 80), Qt.QColor('#d6ffdd'))
        else:
            painter.fillRect(Qt.QRectF(0, 0, 1280, 80), QtCore.Qt.white)

        if self.alarm or self.inform:
            self.alarm_button.resize(640, 560)
            self.alarm_button.move(0, 160)
            self.inform_button.resize(640, 560)
            self.inform_button.move(640, 160)
        else:
            self.alarm_button.resize(640, 640)
            self.alarm_button.move(0, 80)
            self.inform_button.resize(640, 640)
            self.inform_button.move(640, 80)

        if self.alarm:
            painter.fillRect(Qt.QRectF(0, 80, 1280, 80), Qt.QColor('#ffbfbc'))
            painter.drawText(Qt.QRectF(0, 80, 1280, 80), QtCore.Qt.AlignCenter,
                             'opiekun jest alarmowany')
        elif self.inform:
            painter.fillRect(Qt.QRectF(0, 80, 1280, 80), Qt.QColor('#cceeff'))
            painter.drawText(Qt.QRectF(0, 80, 1280, 80), QtCore.Qt.AlignCenter,
                             'opiekun jest powiadamiany')
        painter.drawText(
            Qt.QRectF(0, 0, 1280,
                      80), QtCore.Qt.AlignCenter, 'sterowanie kursorem jest ' +
            ('włączone' if self.move_mode_open else 'wyłączone'))
        painter.end()
Beispiel #7
0
    def repaint_icon(self, total, left):
        """Draw the timer icon based on total and remaining time."""
        background = Qt.QColor(220, 220, 220, 255)
        black = Qt.QColor(40, 40, 40, 255)
        white = Qt.QColor(255, 255, 255, 255)

        painter = QtGui.QPainter(self.pixmap)
        painter.setRenderHint(painter.Antialiasing)
        painter.setBackground(background)
        painter.eraseRect(0, 0, self.icon_size, self.icon_size)
        painter.translate(self.icon_size / 2, self.icon_size / 2)
        painter.setBrush(white)
        painter.setPen(black)
        r = self.radius
        painter.drawEllipse(-r, -r, r * 2, r * 2)
        painter.setBrush(black)
        if total != 0:
            fc = 5760  # Full clircle.
            start = fc / 4  # 12 o'clock.
            span = fc * left / total
            painter.drawPie(-r, -r, r * 2, r * 2, start, span)
            painter.setBrush(white)
            painter.setPen(white)
        sr = self.small_radius
        painter.drawEllipse(-sr, -sr, sr * 2, sr * 2)
        self.icon = QtGui.QIcon(self.pixmap)
        self.setIcon(self.icon)
Beispiel #8
0
    def __init__(self, text, bgcolor="#ffd700", fgcolor="#000000", delay=1000):
        self.delay = delay
        Qt.QLabel.__init__(
            self, None, QtCore.Qt.WindowStaysOnTopHint
            | QtCore.Qt.FramelessWindowHint
            | QtCore.Qt.Tool)
        self.setMargin(1)
        self.setIndent(0)
        self.setFrameStyle(Qt.QFrame.Plain | Qt.QFrame.Box)
        self.setLineWidth(1)
        self.setText(text)
        self.adjustSize()

        # set the pallete...
        pal = Qt.QPalette()
        pal.setColor(Qt.QPalette.Active, Qt.QPalette.Window,
                     Qt.QColor(bgcolor))
        pal.setColor(Qt.QPalette.Active, Qt.QPalette.WindowText,
                     Qt.QColor(fgcolor))
        pal.setColor(Qt.QPalette.Inactive, Qt.QPalette.Window,
                     Qt.QColor(bgcolor))
        pal.setColor(Qt.QPalette.Inactive, Qt.QPalette.WindowText,
                     Qt.QColor(fgcolor))
        self.setPalette(pal)

        self.enter_timer_id = None
        self.leave_timer_id = None
def getWindowFrameColor():
    # This is the only way to detect that a given color is supported
    brush = GetSysColorBrush(COLOR_ACTIVEBORDER)
    if brush:
        color = GetSysColor(COLOR_ACTIVEBORDER)
        return Qt.QColor(GetRValue(color), GetGValue(color), GetBValue(color))

    return Qt.QColor()
Beispiel #10
0
 def color(self, color):
     if color is None:
         self._color = None
     elif isinstance(color, (list, tuple)):
         self._color = Qt.QColor(*color)
     else:
         self._color = Qt.QColor(color)
     self._on_change()
Beispiel #11
0
 def set_color(self, o_color):
     self.m_o_color = o_color
     self.m_o_pin_color = Qt.QColor(o_color.red() * self.COLOR_MUL,
                                    o_color.green() * self.COLOR_MUL,
                                    o_color.blue() * self.COLOR_MUL)
     self.m_pen.setColor(self.m_o_pin_color)
     self.m_pin_pen.setColor(Qt.QColor(255, 255, 255))
     self.m_brush.setColor(self.m_o_color)
     self.m_pin_brush.setColor(self.m_o_pin_color)
 def update_security_display(self, valid):
     self.__lock_label.setText(UNICODE_PADLOCK)
     palette = self.__lock_label.palette()
     if valid:
         self.__lock_label.setText(u" " + UNICODE_PADLOCK + u" ")
         palette.setColor(Qt.QPalette.Window, Qt.QColor(Qt.Qt.green))
     else:
         self.__lock_label.setText(u" " + UNICODE_OPEN_PADLOCK + u" ")
         palette.setColor(Qt.QPalette.Window, Qt.QColor(Qt.Qt.red))
     self.__lock_label.setPalette(palette)
Beispiel #13
0
    def __init__(self, points):
        super(Barlicity, self).__init__()

        # set up the scene
        scene = QtWidgets.QGraphicsScene(self)
        view = QtWidgets.QGraphicsView(scene)
        self.setCentralWidget(view)
        self.resize(
            Qt.QSize(
                QtWidgets.QDesktopWidget().availableGeometry(
                    self).size().height() * 0.8,
                QtWidgets.QDesktopWidget().availableGeometry(
                    self).size().height() * 0.8))
        view.setSceneRect(QtCore.QRectF(0, 0, 1000, 1000))

        # create and position the scanner circle
        self.circle = QtWidgets.QGraphicsEllipseItem(
            QtCore.QRectF(-50, -50, 100, 100))
        self.circle.setOpacity(0.6)
        self.circle.setBrush(Qt.QColor(0, 100, 255))
        # these two variables are set from the scamp threads, and then they are read during the "do_frame" method (which
        # operates in Qt land) and used to actually position the circle. GUI actions can only be on the main QT thread.
        self.circle_center = (500, 500)
        self.circle_width = scale_factor * (
            WIDTH_AVERAGE + WIDTH_VARIATION * math.sin(WIDTH_START_PHASE))
        # Having defined them, since we're on the Qt thread right now, we position the circle
        self.circle.setPos(*self.circle_center)
        self.circle.setRect(-self.circle_width / 2, -self.circle_width / 2,
                            self.circle_width, self.circle_width)
        scene.addItem(self.circle)

        # the scanner moves around between the different points; this keeps track of where it is
        self.scanner_index = 0

        # create all of the points
        self.points_graphics = []
        for i, point in enumerate(points):
            self.points_graphics.append(
                scene.addEllipse(Qt.QRectF(point[0] - 5, point[1] - 5, 10, 10),
                                 brush=Qt.QColor(0, 0, 0)))
            text = scene.addText(str(i))
            text.setPos(point[0] - 25, point[1])

        self.contained_points = []
        # this checks which points are currently in the scanner and puts their indices in self.contained_points
        self.check_contained_points()

        # set up the Qt repaint to happen every 10 milliseconds by calling self.do_frame
        self.repaint_timer = QtCore.QTimer(self)
        self.repaint_timer.timeout.connect(self.do_frame)
        self.repaint_timer.start(10)
        self.repaint()

        # These scamp objects are defined when the window is shown
        self.session = self.piano = self.harpsichord = None
Beispiel #14
0
    def check(self, image):
        screenSize = image.width(), image.height()
        if screenSize != (1024, 768):
            return False

        expectedPixelColors = [
            ((926, 88), "popup", qt.QColor("#061f5e")),
            ((798, 372), "button", qt.QColor("#0077c6")),
            ((726, 165), "text", qt.QColor("#ffffff")),
        ]
        return self.checkColors(image, expectedPixelColors)
Beispiel #15
0
    def pointAdd(self, scene: Qt.QGraphicsScene, xc: int, yc: int,
                 col: int) -> Qt.QGraphicsScene:
        colour = Qt.QBrush()
        colour.setStyle(QtCore.Qt.SolidPattern)
        if col == 0:
            colour.setColor(Qt.QColor(255, 0, 0, 255))
        elif col == 1:
            colour.setColor(Qt.QColor(0, 255, 0, 255))
        else:
            colour.setColor(Qt.QColor(0, 0, 255, 255))

        return scene.addEllipse(xc, yc, 23, 23, Qt.QPen(), colour)
Beispiel #16
0
 def index(self, pr_item):
     marked_entry = pr_item.row()
     if marked_entry in self.selected_rows:
         self.selected_rows.remove(marked_entry)
         for i in range(self.cor_set_table.columnCount()):
             self.cor_set_table.item(marked_entry,
                                     0).setBackground(Qt.QColor('white'))
     else:
         self.selected_rows.append(pr_item.row())
         for i in range(self.cor_set_table.columnCount()):
             self.cor_set_table.item(marked_entry,
                                     0).setBackground(Qt.QColor('green'))
Beispiel #17
0
 def verify_new_password(self, current=u""):
     palette = self.__verify_password_input.palette()
     password_ok = self.__new_password_input.text(
     ) == self.__verify_password_input.text()
     if password_ok:
         palette.setColor(self.__verify_password_input.backgroundRole(),
                          Qt.QColor(220, 255, 220))
     else:
         palette.setColor(self.__verify_password_input.backgroundRole(),
                          Qt.QColor(255, 220, 220))
     self.__verify_password_input.setPalette(palette)
     return password_ok
Beispiel #18
0
 def drawFromArray(self, char):
     array = self.charDict[char]
     print(array)
     print("h")
     self.pixelGridArray = np.copy(array)
     self.pixelGrid.clearSelection()
     for x in range(array.shape[0]):
         for y in range(array.shape[1]):
             if array[x, y] == 1:
                 self.pixelGrid.item(x, y).setBackground(Qt.QColor(0, 0, 0))
             else:
                 self.pixelGrid.item(x, y).setBackground(
                     Qt.QColor(255, 255, 255))
Beispiel #19
0
 def __init__(self, parent):
     Qt.QWidget.__init__(self, parent)
     self.bitmap = Bitmap()
     # we draw each pixel as 6x6 with a 2px wide grid inbetween
     self.setMinimumHeight(PREV_PIXEL * HEIGHT + PREV_GRID)
     self.setMaximumHeight(PREV_PIXEL * HEIGHT + PREV_GRID)
     self._grid = []
     self._background = Qt.QColor('black')
     self._gridcolor = Qt.QColor('#666666')
     self._ledcolor = Qt.QColor('#ff9900')
     self._endcolor = Qt.QColor('#00aa00')
     self._stopcolor = Qt.QColor('#ff0000')
     # horizontal view offset (in 8-pixel units), controlled by scrollbar
     self.offset = 0
Beispiel #20
0
    def verify_current_password(self, current=u""):
        entered_current_password_hash = hashlib.sha256(
            utils.get_bytes(self.__current_password_input.text())).digest()

        palette = self.__current_password_input.palette()
        password_ok = entered_current_password_hash == self.__current_password_hash
        if password_ok:
            palette.setColor(self.__current_password_input.backgroundRole(),
                             Qt.QColor(220, 255, 220))
        else:
            palette.setColor(self.__current_password_input.backgroundRole(),
                             Qt.QColor(255, 220, 220))
        self.__current_password_input.setPalette(palette)
        return password_ok
Beispiel #21
0
    def __init__(self, dialog):
        #super(MyFirstGuiProgram, self).__init__(None)
        QMainWindow.__init__(self)
        PyQt_Gui.Ui_MainWindow.__init__(self)
        self.setupUi(dialog)
        self.app = None

        qApp.installEventFilter(self)

        self.open_games = []
        self.timer_queue_exec_interval = 200

        self.init_events()
        self.init_view()

        self.client = Network.GameClient(self)
        self.client.signal_status_message.connect(self.set_status_message)
        self.client.signalCommand.connect(self.eval_command_from_server)
        self.client.color = Qt.QColor("#ff0000")
        self.update_color()
        self.client.connect_client()

        #self.widget_open_game.hide()
        self.widget_join_game.hide()

        self.widget_game_options = None
Beispiel #22
0
    def __init__(self, stage, astergui, parent=None, **kwargs):
        """
        Create editor.

        Arguments:
            stage (Stage): Stage to edit.
            astergui (AsterGui): AsterGui instance.
            parent (Optional[QWidget]): Parent widget. Defaults to
                *None*.
            **kwargs: Keyword arguments.
        """
        super(StageTextEditor,
              self).__init__(parent=parent,
                             name=translate("StageTextEditor", "Edit stage"),
                             astergui=astergui,
                             **kwargs)

        self.stage = stage
        self.prev_state = stage.get_text()

        title = translate("StageTextEditor", "Edit stage '{}'")
        self.setWindowTitle(title.format(stage.name))
        self.setPixmap(load_pixmap("as_pic_edit_stage.png"))

        self.editor = TextEditor(self)
        v_layout = Q.QVBoxLayout(self)
        v_layout.addWidget(self.editor)
        commands = [j for i in [CATA.get_category(i) \
                                    for i in CATA.get_categories()] for j in i]
        self.editor.setKeywords(commands, 0, Q.QColor("#ff0000"))
        self.editor.setText(self.prev_state)
        self.editor.textChanged.connect(self.updateButtonStatus)
        self.setFocusProxy(self.editor)
        astergui.preferencesChanged.connect(self.editor.updateSettings)
        self.editor.updateSettings(self.astergui().preferencesMgr())
Beispiel #23
0
    def mooseObjOntoscene(self):
        #  All the compartments are put first on to the scene \
        #  Need to do: Check With upi if empty compartments exist
        for cmpt in sorted(self.meshEntry.keys()):
            self.createCompt(cmpt)
            self.qGraCompt[cmpt]

        for cmpt, memb in list(self.meshEntry.items()):
            for enzObj in memb.get('enzyme', []):
                enzinfo = enzObj.path + '/info'
                if enzObj.className == 'ZEnz':
                    enzItem = EnzItem(enzObj, self.qGraCompt[cmpt])
                else:
                    enzItem = MMEnzItem(enzObj, self.qGraCompt[cmpt])
                self.setupDisplay(enzinfo, enzItem, "enzyme")
                self.setupSlot(enzObj, enzItem)

        for cmpt, memb in list(self.meshEntry.items()):
            for poolObj in kkitOrdinateUtil.find_index(memb, 'pool'):
                poolinfo = poolObj.path + '/info'
                poolItem = PoolItem(poolObj, self.qGraCompt[cmpt])
                self.setupDisplay(poolinfo, poolItem, "pool")
                self.setupSlot(poolObj, poolItem)

            for cplxObj in kkitOrdinateUtil.find_index(memb, 'cplx'):
                cplxinfo = (cplxObj[0].parent).path + '/info'
                cplxItem = CplxItem(
                    cplxObj,
                    self.mooseId_GObj[element(cplxObj[0]).parent.getId()])
                self.setupDisplay(cplxinfo, cplxItem, "cplx")
                self.setupSlot(cplxObj, cplxItem)

            for reaObj in kkitOrdinateUtil.find_index(memb, 'reaction'):
                reainfo = reaObj.path + '/info'
                reaItem = ReacItem(reaObj, self.qGraCompt[cmpt])
                self.setupDisplay(reainfo, reaItem, "reaction")
                self.setupSlot(reaObj, reaItem)

            for tabObj in kkitOrdinateUtil.find_index(memb, 'table'):
                tabinfo = tabObj.path + '/info'
                tabItem = PoolItem(tabObj, self.qGraCompt[cmpt])
                self.setupDisplay(tabinfo, tabItem, "tab")
                self.setupSlot(tabObj, tabItem)
        # compartment's rectangle size is calculated depending on children
        for k, v in list(self.qGraCompt.items()):
            rectcompt = v.childrenBoundingRect()
            v.setRect(rectcompt.x() - 10,
                      rectcompt.y() - 10, (rectcompt.width() + 20),
                      (rectcompt.height() + 20))
            v.setPen(
                QtGui.QPen(Qt.QColor(66, 66, 66, 100), 5, Qt.Qt.SolidLine,
                           Qt.Qt.RoundCap, Qt.Qt.RoundJoin))
            v.cmptEmitter.connect(
                v.cmptEmitter,
                QtCore.SIGNAL("qgtextPositionChange(PyQt_PyObject)"),
                self.positionChange)
            v.cmptEmitter.connect(
                v.cmptEmitter,
                QtCore.SIGNAL("qgtextItemSelectedChange(PyQt_PyObject)"),
                self.objectEditSlot)
Beispiel #24
0
 def __init__(self, ris_widget, default=[], color=(255, 0, 0)):
     self.ris_widget = ris_widget
     pen = Qt.QPen(Qt.QColor(*color))
     self.spline_set = spline_set.SplineSet(ris_widget, pen)
     self.spline_set.geometry_change_callbacks.append(
         self.on_geometry_change)
     super().__init__(name='MultisplineAnnotation', default=default)
def plot_polygon(rw, tck, width_tck, rgba):
    '''Plot the full polygon on RisWidget
    
    Parameters:
    ------------
    rw: RisWidget Object
        Reference to the RisWidget object you want to display
        the spline on
    tck: parametric spline tuple
        Spline tuple of the centerline to plot
    width_tck: nonparametric spline tuple
        Spline tuple of the widths along the centerline to plot
    rgba: 3-d tuple of ints
        RGBA values to color the spline

    Returns:
    -----------
    display_path: QGraphicsPathItem
        Reference to the display item displaying the spline
    '''
    left, right, outline = spline_geometry.outline(tck, width_tck)
    #print(left)
    path = Qt.QPainterPath()
    path.moveTo(*outline[0])
    for x, y in outline:
        path.lineTo(x, y)
    path.closeSubpath()
    display_path = Qt.QGraphicsPathItem(path,
                                        parent=rw.image_scene.layer_stack_item)
    pen = Qt.QBrush(Qt.QColor(*rgba, 90))
    #pen.setColor(Qt.QColor(*rgba))
    #pen.setWidth(1)
    #pen.setCosmetic(True)
    display_path.setBrush(pen)
    return display_path
def plot_spline(rw, tck, rgba):
    '''Plot the spline on RisWidget

    Parameters:
    ------------
    rw: RisWidget Object
        Reference to the RisWidget object you want to display
        the spline on
    tck: parametric spline tuple
        Spline tuple to plot
    rgba: 3-d tuple of ints
        RGBA values to color the spline

    Returns:
    -----------
    display_path: QGraphicsPathItem
        Reference to the display item displaying the spline
    '''
    bezier_elements = interpolate.spline_to_bezier(tck)
    path = Qt.QPainterPath()
    path.moveTo(*bezier_elements[0][0])
    for (sx, sy), (c1x, c1y), (c2x, c2y), (ex, ey) in bezier_elements:
        path.cubicTo(c1x, c1y, c2x, c2y, ex, ey)
    display_path = Qt.QGraphicsPathItem(path,
                                        parent=rw.image_scene.layer_stack_item)
    pen = Qt.QPen(Qt.QColor(*rgba, 100))
    pen.setWidth(2)
    pen.setCosmetic(True)
    display_path.setPen(pen)
    return display_path
 def __init__(self, general_view, parent_item, points=None):
     super().__init__(parent_item)
     self.view = general_view
     self.view.viewport_rect_item.size_changed.connect(
         self.on_viewport_size_changed)
     self.point_items = []
     self.pen = Qt.QPen(Qt.Qt.red)
     self.pen.setWidth(2)
     color = Qt.QColor(Qt.Qt.yellow)
     color.setAlphaF(0.5)
     self.brush = Qt.QBrush(color)
     self.brush_selected = Qt.QBrush(Qt.QColor(255, 0, 255, 127))
     parent_item.installSceneEventFilter(self)
     if points:
         for point in points:
             self.make_and_store_point_item(Qt.QPointF(point[0], point[1]))
Beispiel #28
0
 def paint(self, qpainter, option, widget):
     pen = Qt.QPen(Qt.QColor(255, 0, 0, 128))
     pen.setWidth(0)
     qpainter.setPen(pen)
     br = self.boundingRect()
     x = (br.left() + br.right()) / 2
     qpainter.drawLine(x, br.top(), x, br.bottom())
Beispiel #29
0
    def __init__(self, parent_item):
        super().__init__(parent_item)
        self.contextual_info = None
        font = Qt.QFont('Courier', pointSize=16, weight=Qt.QFont.Bold)
        font.setKerning(False)
        font.setStyleHint(Qt.QFont.Monospace,
                          Qt.QFont.OpenGLCompatible | Qt.QFont.PreferQuality)
        self.setFont(font)
        self.setBrush(Qt.QColor(45, 220, 255))
        # below is useful if you want a pen behind the brush (also uncomment paint())
        # self.brush = Qt.QBrush(Qt.QColor(45,220,255))
        # self.pen = Qt.QPen(Qt.QColor(Qt.Qt.black))
        # self.pen.setWidth(2)
        # self.pen.setCosmetic(True)
        # # self.no_pen = Qt.QPen(Qt.Qt.NoPen)
        # # self.no_brush = Qt.QBrush(Qt.Qt.NoBrush)
        # # Disabling brush/pen via setting to transparent color causes less problems on OS X for some reason
        # transparent_color = Qt.QColor(Qt.QColor(255, 255, 255, 0))
        # self.no_pen = Qt.QPen(transparent_color)
        # self.no_brush = Qt.QBrush(transparent_color)

        # Necessary to prevent context information from disappearing when mouse pointer passes over
        # context info text
        self.setAcceptHoverEvents(False)
        self.setAcceptedMouseButtons(Qt.Qt.NoButton)
        self.hide()
Beispiel #30
0
 def _getd_tint(self, midx, role):
     if role == Qt.Qt.DecorationRole:
         return Qt.QVariant(
             Qt.QColor(*(int(c * 255)
                         for c in self.signaling_list[midx.row()].tint)))
     elif role == Qt.Qt.DisplayRole:
         return Qt.QVariant(self.signaling_list[midx.row()].tint)