Python PySide.QtGui 模块,QBrush() 实例源码

我们从Python开源项目中,提取了以下36个代码示例,用于说明如何使用PySide.QtGui.QBrush()

项目:rfcat-firsttry    作者:atlas0fd00m    | 项目源码 | 文件源码
def paintEvent(self, event):
        self._draw_graph()
        self._draw_reticle()

        painter = QtGui.QPainter(self)
        try:
            painter.setRenderHint(QtGui.QPainter.Antialiasing)
            painter.setPen(QtGui.QPen())
            painter.setBrush(QtGui.QBrush())

            if self._graph:
                painter.drawPixmap(0, 0, self._graph)

            if self._path_max:
                painter.setPen(Qt.green)
                painter.drawPath(self._path_max)

            painter.setOpacity(0.5)
            if self._reticle:
                painter.drawPixmap(0, 0, self._reticle)
        finally:
            painter.end()
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def __init__(self, item, timeline_range, *args, **kwargs):
        super(_BaseItem, self).__init__(*args, **kwargs)
        self.item = item
        self.timeline_range = timeline_range

        self.setFlags(QtGui.QGraphicsItem.ItemIsSelectable)
        self.setBrush(
            QtGui.QBrush(QtGui.QColor(180, 180, 180, 255))
        )

        self.source_in_label = QtGui.QGraphicsSimpleTextItem(self)
        self.source_out_label = QtGui.QGraphicsSimpleTextItem(self)
        self.source_name_label = QtGui.QGraphicsSimpleTextItem(self)

        self._add_markers()
        self._set_labels()
项目:smhr    作者:andycasey    | 项目源码 | 文件源码
def paint(self, painter, option, index):
        painter.save()

        painter.setPen(QtGui.QPen(QtCore.Qt.NoPen))
        if option.state & QtGui.QStyle.State_Selected:
            painter.setBrush(QtGui.QBrush(
                self.parent().palette().highlight().color()))
        else:
            painter.setBrush(QtGui.QBrush(QtCore.Qt.white))

        painter.drawRect(option.rect)

        painter.setPen(QtGui.QPen(QtCore.Qt.black))
        painter.drawText(option.rect, QtCore.Qt.AlignLeft|QtCore.Qt.AlignCenter,
            index.data())
        painter.restore()
项目:HearthPacks    作者:Arzaroth    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QPainter()
        painter.begin(self)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.fillRect(event.rect(), QBrush(QColor(127, 127, 127, 127)))
        painter.setPen(QPen(Qt.NoPen))

        for i in range(6):
            if int(self.counter / 10) % 6 == i:
                factor = self.counter % 10
                if factor >= 5:
                    factor = 5 - (self.counter % 5)
                painter.setBrush(QBrush(QColor(95 + factor * 32, 127, 127)))
            else:
                painter.setBrush(QBrush(QColor(127, 127, 127)))
            painter.drawEllipse(
                self.width() / 2 + 30 * math.cos(2 * math.pi * i / 6.0) - 10,
                self.height() / 2 + 30 * math.sin(2 * math.pi * i / 6.0) - 10,
                20, 20)

        painter.end()
项目:rfcat    作者:EnhancedRadioDevices    | 项目源码 | 文件源码
def paintEvent(self, event):
        self._draw_graph()
        self._draw_reticle()

        painter = QtGui.QPainter(self)
        try:
            painter.setRenderHint(QtGui.QPainter.Antialiasing)
            painter.setPen(QtGui.QPen())
            painter.setBrush(QtGui.QBrush())

            if self._graph:
                painter.drawPixmap(0, 0, self._graph)

            if self._path_max:
                painter.setPen(Qt.green)
                painter.drawPath(self._path_max)

            painter.setOpacity(0.5)
            if self._reticle:
                painter.drawPixmap(0, 0, self._reticle)
        finally:
            painter.end()
项目:rfcat    作者:atlas0fd00m    | 项目源码 | 文件源码
def paintEvent(self, event):
        self._draw_graph()
        self._draw_reticle()

        painter = QtGui.QPainter(self)
        try:
            painter.setRenderHint(QtGui.QPainter.Antialiasing)
            painter.setPen(QtGui.QPen())
            painter.setBrush(QtGui.QBrush())

            if self._graph:
                painter.drawPixmap(0, 0, self._graph)

            if self._path_max:
                painter.setPen(Qt.green)
                painter.drawPath(self._path_max)

            painter.setOpacity(0.5)
            if self._reticle:
                painter.drawPixmap(0, 0, self._reticle)
        finally:
            painter.end()
项目:PandwaRF    作者:ComThings    | 项目源码 | 文件源码
def paintEvent(self, event):
        self._draw_graph()
        self._draw_reticle()

        painter = QtGui.QPainter(self)
        try:
            painter.setRenderHint(QtGui.QPainter.Antialiasing)
            painter.setPen(QtGui.QPen())
            painter.setBrush(QtGui.QBrush())

            if self._graph:
                painter.drawPixmap(0, 0, self._graph)

            if self._path_max:
                painter.setPen(Qt.green)
                painter.drawPath(self._path_max)

            painter.setOpacity(0.5)
            if self._reticle:
                painter.drawPixmap(0, 0, self._reticle)
        finally:
            painter.end()
项目:CyclopsVFX-Unity    作者:geoffroygivry    | 项目源码 | 文件源码
def paintEvent(self, event):
        '''Paint the button grey if not highlighted, else yellow'''

        painter = QtGui.QPainter(self)
        colour = QtGui.QColor(247, 147, 30, 150)
        gradient = QtGui.QLinearGradient(QtCore.QPoint(0,0), QtCore.QPoint(self.width()/2, 0))
        gradient.setColorAt(0, QtCore.Qt.transparent)
        gradient.setColorAt(1, colour)
        gradient.setSpread(QtGui.QGradient.ReflectSpread)
        painter.setBrush(QtGui.QBrush(gradient))
        painter.setPen(QtCore.Qt.transparent)
        rect = QtCore.QRect(0,0,self.width(),self.height())
        painter.drawRect(rect)
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(GapItem, self).__init__(*args, **kwargs)
        self.setBrush(
            QtGui.QBrush(QtGui.QColor(100, 100, 100, 255))
        )
        self.source_name_label.setText('GAP')
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def __init__(self, item, timeline_range, rect, *args, **kwargs):
        rect.setHeight(TRANSITION_HEIGHT)
        super(TransitionItem, self).__init__(
            item,
            timeline_range,
            rect,
            *args,
            **kwargs
        )
        self.setBrush(
            QtGui.QBrush(QtGui.QColor(237, 228, 148, 255))
        )
        self.setY(TRACK_HEIGHT - TRANSITION_HEIGHT)
        self.setZValue(2)

        # add extra bit of shading
        shading_poly_f = QtGui.QPolygonF()
        shading_poly_f.append(QtCore.QPointF(0, 0))
        shading_poly_f.append(QtCore.QPointF(rect.width(), 0))
        shading_poly_f.append(QtCore.QPointF(0, rect.height()))

        shading_poly = QtGui.QGraphicsPolygonItem(shading_poly_f, parent=self)
        shading_poly.setBrush(QtGui.QBrush(QtGui.QColor(0, 0, 0, 30)))

        try:
            shading_poly.setPen(QtCore.Qt.NoPen)
        except TypeError:
            shading_poly.setPen(QtCore.Qt.transparent)
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(ClipItem, self).__init__(*args, **kwargs)
        self.setBrush(QtGui.QBrush(QtGui.QColor(168, 197, 255, 255)))
        self.source_name_label.setText(self.item.name)
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(NestedItem, self).__init__(*args, **kwargs)
        self.setBrush(
            QtGui.QBrush(QtGui.QColor(255, 113, 91, 255))
        )

        self.source_name_label.setText(self.item.name)
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def __init__(self, marker, *args, **kwargs):
        self.item = marker

        poly = QtGui.QPolygonF()
        poly.append(QtCore.QPointF(0.5 * MARKER_SIZE, -0.5 * MARKER_SIZE))
        poly.append(QtCore.QPointF(0.5 * MARKER_SIZE, 0.5 * MARKER_SIZE))
        poly.append(QtCore.QPointF(0, MARKER_SIZE))
        poly.append(QtCore.QPointF(-0.5 * MARKER_SIZE, 0.5 * MARKER_SIZE))
        poly.append(QtCore.QPointF(-0.5 * MARKER_SIZE, -0.5 * MARKER_SIZE))
        super(Marker, self).__init__(poly, *args, **kwargs)

        self.setFlags(QtGui.QGraphicsItem.ItemIsSelectable)
        self.setBrush(QtGui.QBrush(QtGui.QColor(121, 212, 177, 255)))
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(TimeSlider, self).__init__(*args, **kwargs)
        self.setBrush(QtGui.QBrush(QtGui.QColor(64, 78, 87, 255)))
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def __init__(self, composition, *args, **kwargs):
        super(CompositionWidget, self).__init__(*args, **kwargs)
        self.composition = composition

        self.setBackgroundBrush(QtGui.QBrush(QtGui.QColor(64, 78, 87, 255)))

        self._adjust_scene_size()
        self._add_time_slider()
        self._add_tracks()
        self._add_markers()
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def modelsListsetRowColor(self, item, color):
        item.setBackground(0, QtGui.QBrush(QtGui.QColor(color[0], color[1], color[2])))
        item.setBackground(1, QtGui.QBrush(QtGui.QColor(color[0], color[1], color[2])))
        item.setBackground(2, QtGui.QBrush(QtGui.QColor(color[0], color[1], color[2])))
        item.setBackground(3, QtGui.QBrush(QtGui.QColor(color[0], color[1], color[2])))
        #item.setBackground(4, QtGui.QBrush(QtGui.QColor(color[0], color[1], color[2])))
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def checkPath(self, item):
        [boolValue, path] = partExistPath(item.text())

        if boolValue:
            item.setForeground(QtGui.QBrush(QtGui.QColor(72, 144, 0)))
            item.setData(QtCore.Qt.UserRole, path)
            if item.checkState() != QtCore.Qt.Checked:
                item.setCheckState(QtCore.Qt.Unchecked)
        else:
            item.setForeground(QtGui.QBrush(QtGui.QColor(255, 0, 0)))
            item.setCheckState(QtCore.Qt.Checked)
            item.setData(QtCore.Qt.UserRole, '')
项目:smhr    作者:andycasey    | 项目源码 | 文件源码
def paint(self, painter, option, index):
        if index.column() > 2:
            super(SpectralModelsTableDelegate, self).paint(painter, option, index)
            return None

        painter.save()

        # set background color
        painter.setPen(QtGui.QPen(QtCore.Qt.NoPen))
        if option.state & QtGui.QStyle.State_Selected:
            painter.setBrush(QtGui.QBrush(
                self.parent().palette().highlight().color()))
        else:

            # Does this row have a conflict?
            conflicts = self.session._spectral_model_conflicts
            conflict_indices = np.hstack([sum([], conflicts)])

            row = index.row()
            if row in conflict_indices:
                for i, conflict in enumerate(conflicts):
                    if row in conflict:
                        color = _COLORS[i % len(_COLORS)]
                        break

                painter.setBrush(QtGui.QBrush(QtGui.QColor(color)))
            else:
                painter.setBrush(QtGui.QBrush(QtCore.Qt.white))

        painter.drawRect(option.rect)

        # set text color
        painter.setPen(QtGui.QPen(QtCore.Qt.black))
        painter.drawText(option.rect, QtCore.Qt.AlignLeft|QtCore.Qt.AlignCenter, index.data())
        painter.restore()
项目:Electrify    作者:jyapayne    | 项目源码 | 文件源码
def paintEvent(self, event=None):
        painter = QtGui.QPainter(self)
        if self.color is not None:
            painter.setBrush(QtGui.QBrush(self.color))
            rect = self.rect()
            margins = self.contentsMargins()
            new_rect = QtCore.QRect(rect.left()+margins.left(),
                                    rect.top()+margins.top(),
                                    rect.width()-margins.right()*2,
                                    rect.height()-margins.bottom()*2)
            painter.drawRect(new_rect)
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def paint(self,painter,option, widget):
        pen = QtGui.QPen()
        pen.setWidth(1)
        brush = QtGui.QBrush()
        brush.setStyle(QtCore.Qt.SolidPattern)
        brush.setColor(QtGui.QColor("white"))

        painter.setBrush(brush)
        painter.drawRect(self.rect)
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def __init__(self):
        super(NodeView,self).__init__()
        self._scene = OPScene()

        # Obsolete
        self.nodeList = list()

        # Variables
        self.clickedItem = None
        self.itemMode = None        # Define which item is selected

        self.mousePositionX = 0
        self.mousePositionY = 0

        self.mode = None

        # Configure QGraphics View
        self.setSceneRect(0, 0, -1, -1)
        self.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.setMouseTracking(True)
        self.setRenderHints(QtGui.QPainter.Antialiasing)
        self.setViewportUpdateMode(QtGui.QGraphicsView.FullViewportUpdate)

        # Init QGraphic Scene
        self.sc = QtGui.QGraphicsScene()
        self.setScene(self.sc)
        self.sceneScale = 0.7

        # Paint the background
        brush = QtGui.QBrush()
        brush.setTransform(QtGui.QTransform().scale(0.75, 0.75))
        brush.setTextureImage(QtGui.QImage("/Users/draknova/Documents/workspace/sPipe/bin/images/gridTexture.jpg"))
        self.sc.setBackgroundBrush(brush)


    ######################
    ####### EVENTS #######
    ######################

    ### KEYBOARD EVENTS ##
项目:SDV-Summary    作者:Sketchy502    | 项目源码 | 文件源码
def _add_table_row(self,items):
        new_row = self._table.rowCount()+1
        self._table.setRowCount(new_row)
        for i, item in enumerate(items):
            if type(item) != bool:
                if i == 4:
                    self.new_item = QtGui.QPushButton('Backup!')
                    self.new_item.clicked.connect(self.handle_manual_backup)
                    self._table.setCellWidget(new_row-1,i,self.new_item)
                    continue
                elif i == 5 and item != None:
                    if item != '...':
                        new_item = QtGui.QTableWidgetItem('{}'.format(item))
                        link_font = QtGui.QFont(new_item.font())
                        link_font.setUnderline(True)
                        new_item.setFont(link_font)
                        new_item.setTextAlignment(QtCore.Qt.AlignCenter)
                        new_item.setForeground(QtGui.QBrush(QtGui.QColor("teal")))
                    else:
                        new_item = QtGui.QTableWidgetItem('{}'.format(item))
                        new_item.setTextAlignment(QtCore.Qt.AlignCenter)
                elif i == 1 and item == None:
                    new_item = QtGui.QTableWidgetItem('no backups')
                    new_item.setForeground(QtGui.QBrush(QtGui.QColor("grey")))
                else:
                    new_item = QtGui.QTableWidgetItem(item)
                new_item.setFlags(QtCore.Qt.ItemIsEnabled)
            elif type(item) == bool:
                new_item = QtGui.QTableWidgetItem()
                if i == 3 and items[2] == False:
                    new_item.setFlags(QtCore.Qt.ItemFlags() != QtCore.Qt.ItemIsEnabled)
                    new_item.setCheckState(QtCore.Qt.Unchecked)
                else:
                    new_item.setFlags(QtCore.Qt.ItemIsUserCheckable|QtCore.Qt.ItemIsEnabled)
                    new_item.setCheckState(QtCore.Qt.Unchecked if item == False else QtCore.Qt.Checked)
            self._table.setItem(new_row-1,i,new_item)
项目:AutoDiff    作者:icewall    | 项目源码 | 文件源码
def data(self,index,role = QtCore.Qt.DisplayRole):
        try:
            if role == QtCore.Qt.BackgroundColorRole and index.isValid():
                for item in self.__colorRow.values():
                    if index.row() in item["indexes"]:
                        #return item["color"]
                        return QtGui.QBrush(QtCore.Qt.yellow)
        except:
            pass

        return super(QtGui.QSortFilterProxyModel,self).data(index,role)
项目:nuke    作者:Kagarrache    | 项目源码 | 文件源码
def paintEvent(self, event):
        '''Paint the button grey if not highlighted, else yellow'''

        painter = QtGui.QPainter(self)
        colour = QtGui.QColor(247, 147, 30, 150)
        gradient = QtGui.QLinearGradient(QtCore.QPoint(0,0), QtCore.QPoint(self.width()/2, 0))
        gradient.setColorAt(0, QtCore.Qt.transparent)
        gradient.setColorAt(1, colour)
        gradient.setSpread(QtGui.QGradient.ReflectSpread)
        painter.setBrush(QtGui.QBrush(gradient))
        painter.setPen(QtCore.Qt.transparent)
        rect = QtCore.QRect(0,0,self.width(),self.height())
        painter.drawRect(rect)
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def fill_project_table(self, table):
        #copy = db.studio() # self.db_studio
        self.db_group.get_list_projects()

        if not self.db_group.list_projects:
            return

        projects = []
        for key in self.db_group.list_projects.keys():
            projects.append({'name' : key,'status' : self.db_group.list_projects[key]['status'], 'path': self.db_group.list_projects[key]['path']})

        # get table data
        columns = ('name', 'status', 'path')
        num_row = len(projects)
        num_column = len(columns)
        headers = columns

        # make table
        table.setColumnCount(num_column)
        table.setRowCount(num_row)
        table.setHorizontalHeaderLabels(headers)


        # fill table
        for i, project in enumerate(projects):
            for j,key in enumerate(headers):
                newItem = QtGui.QTableWidgetItem()
                newItem.setText(project[key])
                if key == 'name':
                    color = self.project_color
                    brush = QtGui.QBrush(color)
                    newItem.setBackground(brush)

                table.setItem(i, j, newItem)

        table.resizeRowsToContents()
        table.resizeColumnsToContents()

        print('fill project table')
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def tm_edit_readers_ui_reload_table(self):
        table = self.editReadersDialog.select_from_list_data_list_table

        # load table
        headers = ['nik_name']
        num_column = len(headers)
        num_row = 0

        if self.cleaned_readers_list:
            num_row = len(self.cleaned_readers_list)


        table.setColumnCount(num_column)
        table.setRowCount(num_row)
        table.setHorizontalHeaderLabels(headers)

        if self.cleaned_readers_list:
            for i,reader_name in enumerate(self.cleaned_readers_list):
                if reader_name == 'first_reader':
                    continue
                for j,key in enumerate(headers):
                    newItem = QtGui.QTableWidgetItem()
                    if key == 'nik_name':
                        newItem.setText(reader_name)
                        if 'first_reader' in self.current_readers_list:
                            if self.current_readers_list['first_reader'] == reader_name:
                                newItem.setText((reader_name + ' (***)'))
                        color = self.artist_color
                        brush = QtGui.QBrush(color)
                        newItem.setBackground(brush)

                        newItem.reader_name = reader_name

                    table.setItem(i, j, newItem)
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def tm_add_readers_ui_load_artist_list(self, workrom_name):
        table = self.selectReadersDialog.select_from_list_data_list_table
        workroom_dict = self.selectReadersDialog.workroom_dict

        self.clear_table(table)
        result = self.db_workroom.read_artist_of_workroom(workroom_dict[workrom_name]['id'])
        if not result[0]:
            self.message(result[1], 2)

        artirs_dict = result[1]

        # load table
        headers = ['nik_name', 'level']
        num_column = len(headers)
        num_row = 0
        if artirs_dict:
            num_row = len(artirs_dict)

        table.setColumnCount(num_column)
        table.setRowCount(num_row)
        table.setHorizontalHeaderLabels(headers)

        if artirs_dict:
            for i,reader_name in enumerate(artirs_dict):
                for j,key in enumerate(headers):
                    newItem = QtGui.QTableWidgetItem()
                    newItem.setText(artirs_dict[reader_name][key])
                    newItem.reader_name = reader_name

                    if key == 'nik_name':
                        color = self.artist_color
                        brush = QtGui.QBrush(color)
                        newItem.setBackground(brush)
                    if self.current_readers_list:
                        if reader_name in self.current_readers_list.keys():
                            color = self.grey_color
                            brush = QtGui.QBrush(color)
                            newItem.setBackground(brush)

                    table.setItem(i, j, newItem)
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def tm_change_task_artist_action(self, window, item_):
        # get new artist
        new_artist = window.combo_dialog_combo_box.currentText()
        if new_artist in ['None', '-None-']:
            new_artist = ''

        # change artist
        task_data = dict(item_.task)
        result = self.db_chat.change_artist(self.current_project, task_data, new_artist)
        if not result[0]:
            self.message(result[1], 2)
            return
        new_status = result[1][0]
        outsource = result[1][1]
        #print(new_status)

        # edit labels
        self.myWidget.tm_data_label_1.setText(new_artist)
        task_data['artist'] = new_artist
        if new_status:
            task_data['status'] = new_status
        task_data['outsource'] = outsource
        item_.task = task_data

        # change table color
        rgb = self.db_chat.color_status[task_data['status']]
        r = (rgb[0]*255)
        g = (rgb[1]*255)
        b = (rgb[2]*255)
        color = QtGui.QColor(r, g, b)
        brush = QtGui.QBrush(color)
        item_.setBackground(brush)

        self.close_window(window)

    # ------ change input --------------
项目:ebbbe    作者:EarToEarOak    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QPainter()
        painter.begin(self)

        colour = self._colour
        if not self._lit:
            colour = self._colour.darker(300)
        painter.setPen(QPen(Qt.black, 1))
        painter.setBrush(QBrush(colour))

        rect = event.rect()
        radius = min(rect.width(), rect.height()) / 3
        painter.drawEllipse(rect.center(), radius, radius)

        painter.end()
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def paint(self,painter,option, widget):   
        blackPen = QtGui.QPen()
        whitePen = QtGui.QPen()
        blackPen.setWidth(1)
        whitePen.setWidth(1)
        blackPen.setColor(QtGui.QColor("black"))
        whitePen.setColor(QtGui.QColor("white"))

        if self.isSelected():
            gradient = QtGui.QLinearGradient(QtCore.QPointF(0, 0), QtCore.QPointF(0, 20))
            gradient.setColorAt(0, QtGui.QColor(220,170,50))
            gradient.setColorAt(0.3, QtGui.QColor(220,170,50))
            gradient.setColorAt(1, QtGui.QColor(170,150,40))
            #brush = QtGui.QBrush(gradient)
            #brush.setStyle(QtCore.Qt.LinearGradientPattern)
            brush = QtGui.QBrush(QtGui.QColor(220,160,50))


        else:
            gradient = QtGui.QLinearGradient(QtCore.QPointF(0, 0), QtCore.QPointF(0, 20))
            gradient.setColorAt(0, QtGui.QColor(55,55,55))
            gradient.setColorAt(0.3, QtGui.QColor(60,60,60))
            gradient.setColorAt(1, QtGui.QColor(50,50,50))
            #brush = QtGui.QBrush(gradient)
            #brush.setStyle(QtCore.Qt.LinearGradientPattern)
            #brush = QtGui.QBrush(QtGui.QColor(50,50,50))
            brush = QtGui.QBrush(QtGui.QColor(32,61,74))



        font = QtGui.QFont()
        font.setFamily("Helvetica")
        font.setStyleStrategy(QtGui.QFont.PreferAntialias)
        font.setPointSize(14)


        painter.setBrush(brush)
        painter.setPen(blackPen)
        painter.setFont(font)

        painter.drawRoundedRect(self.rect,5,5)

        #pen.setColor(QtGui.QColor("white"))
        if self.scale > 0.75:
            painter.setPen(whitePen)
            painter.drawText(self.rect, QtCore.Qt.AlignCenter,self.name())
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def fill_artist_table(self):
        #copy = self.db_artist
        artists = self.db_workroom.read_artist('all')

        if not artists[0]:
            return

        # get workroom data
        wr_id_dict = {}
        wr_name_dict = {}

        result = self.db_workroom.get_list_workrooms(DICTONARY = 'by_id_by_name')
        if not result[0]:
            self.message(result[1], 3)
            #return
        else:
            wr_id_dict = result[1]
            wr_name_dict = result[2]

        # get table data
        num_row = len(artists[1])
        num_column = len(self.db_workroom.artists_keys)
        headers = []

        for item in self.db_workroom.artists_keys:
            headers.append(item[0])

        # make table
        self.myWidget.studio_editor_table.setColumnCount(num_column)
        self.myWidget.studio_editor_table.setRowCount(num_row)
        self.myWidget.studio_editor_table.setHorizontalHeaderLabels(headers)

        # fill table
        for i, artist in enumerate(artists[1]):
            for j,key in enumerate(headers):
                if key == 'date_time':
                    continue
                newItem = QtGui.QTableWidgetItem()
                newItem.setText(artist[key])
                if key == 'nik_name':
                    color = self.artist_color
                    brush = QtGui.QBrush(color)
                    newItem.setBackground(brush)

                if key == 'workroom':
                    if artist[key]:
                        wr_list = json.loads(artist[key])
                        wr_string = ''
                        for wr_id in wr_list:
                            if wr_id in wr_id_dict:
                                wr_string = wr_string +  wr_id_dict[wr_id]['name'] + ', '
                        newItem.setText(wr_string)

                newItem.artist = artist
                self.myWidget.studio_editor_table.setItem(i, j, newItem)

        self.myWidget.studio_editor_table.wr_id_dict = wr_id_dict
        self.myWidget.studio_editor_table.wr_name_dict = wr_name_dict

        print('fill artist table')
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def fill_workroom_table(self, table):
        copy = self.db_workroom
        workrooms = copy.get_list_workrooms()

        if not workrooms[0]:
            return

        self.set_self_workrooms(workrooms = workrooms)

        # look_keys
        look_keys = ['name']

        # get table data
        num_row = len(workrooms[1])
        num_column = len(look_keys)
        headers = []

        for item in look_keys:
            headers.append(item)

        # make table
        table.setColumnCount(num_column)
        table.setRowCount(num_row)
        table.setHorizontalHeaderLabels(headers)


        # fill table
        for i, workroom in enumerate(workrooms[1]):
            for j,key in enumerate(headers):
                if key == 'date_time':
                    continue
                newItem = QtGui.QTableWidgetItem()
                newItem.setText(workroom[key])
                newItem.workroom = workroom
                if key == 'name':
                    color = self.workroom_color
                    brush = QtGui.QBrush(color)
                    newItem.setBackground(brush)

                table.setItem(i, j, newItem)

        table.resizeRowsToContents()
        table.resizeColumnsToContents()

        print('fill workroom table')
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def fill_active_artist_table_at_workroom(self, wr_name):
        copy = self.db_workroom
        artists = copy.read_artist('all')

        if not artists[0]:
            print(artists[1])
            return

        # get worktoom_id
        result = copy.get_id_by_name(wr_name)
        if not result[0]:
            self.message(result[1], 2)
            return
        wr_id = result[1]

        # get artist list       
        active_artists = []
        for artist in artists[1]:
            # get workroom
            wr_list = []
            if artist['workroom']:
                wr_list = json.loads(artist['workroom'])
            if wr_id in wr_list and artist['status'] == 'active':
                active_artists.append(artist)

        # get table data
        num_row = len(active_artists)
        num_column = len(self.look_keys)
        headers = self.look_keys

        # make table
        self.myWidget.studio_editor_table.setColumnCount(num_column)
        self.myWidget.studio_editor_table.setRowCount(num_row)
        self.myWidget.studio_editor_table.setHorizontalHeaderLabels(headers)

        # fill table
        for i, artist in enumerate(active_artists):
            for j,key in enumerate(headers):
                if not (key in self.look_keys):
                    continue
                newItem = QtGui.QTableWidgetItem()
                newItem.setText(artist[key])
                if key == 'nik_name':
                    color = self.artist_color
                    brush = QtGui.QBrush(color)
                    newItem.setBackground(brush)                
                self.myWidget.studio_editor_table.setItem(i, j, newItem)

        print('fill active artist table')
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def fill_active_artist_table_for_workroom(self, wr_name, window):
        copy = self.db_workroom
        artists = copy.read_artist('all')

        if not artists[0]:
            return

        # get active list       
        active_artists = []
        for artist in artists[1]:
            if artist['status'] == 'active':
                active_artists.append(artist)

        # get worktoom_id
        result = copy.get_id_by_name(wr_name)
        if not result[0]:
            self.message(result[1], 2)
            return
        wr_id = result[1]

        # get table data
        num_row = len(active_artists)
        num_column = len(self.look_keys)
        headers = self.look_keys

        # make table
        window.select_from_list_data_list_table.setColumnCount(num_column)
        window.select_from_list_data_list_table.setRowCount(num_row)
        window.select_from_list_data_list_table.setHorizontalHeaderLabels(headers)

        # fill table
        for i, artist in enumerate(active_artists):
            wr_list = []
            if artist['workroom']:
                wr_list = json.loads(artist['workroom'])
            for j,key in enumerate(headers):
                if not (key in self.look_keys):
                    continue
                newItem = QtGui.QTableWidgetItem()
                newItem.setText(artist[key])
                if key == 'nik_name' and not wr_id in wr_list:
                    color = self.artist_color
                    brush = QtGui.QBrush(color)
                    newItem.setBackground(brush)
                elif wr_id in wr_list:
                    color = self.grey_color
                    brush = QtGui.QBrush(color)
                    newItem.setBackground(brush)

                window.select_from_list_data_list_table.setItem(i, j, newItem)

        print('fill active artist table')
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def look_set_of_task_from_library(self, table, data):
        name = table.currentItem().name

        right_data = data[name]['sets']

        # widget
        loader = QtUiTools.QUiLoader()
        file = QtCore.QFile(self.select_from_list_dialog_path)
        file.open(QtCore.QFile.ReadOnly)
        window = self.selectWorkroomDialog = loader.load(file, self)
        file.close()

        # -- get table data
        num_row = len(right_data)
        num_column = len(self.db_set_of_tasks.set_of_tasks_keys)
        headers = self.db_set_of_tasks.set_of_tasks_keys

        # -- make table
        window.select_from_list_data_list_table.setColumnCount(num_column)
        window.select_from_list_data_list_table.setRowCount(num_row)
        window.select_from_list_data_list_table.setHorizontalHeaderLabels(headers)

        # fill table
        for i, set_of_tasks in enumerate(right_data):
            for j,key in enumerate(headers):
                if not (key in self.db_set_of_tasks.set_of_tasks_keys):
                    continue
                newItem = QtGui.QTableWidgetItem()
                try:
                    newItem.setText(set_of_tasks[key])
                except:
                    pass
                if key == 'task_name':
                    color = self.tasks_color
                    brush = QtGui.QBrush(color)
                    newItem.setBackground(brush)
                elif key == 'workroom':
                    try:
                        newItem.setText('')
                    except:
                        pass

                window.select_from_list_data_list_table.setItem(i, j, newItem)

        # edit widjet
        window.setWindowTitle(('Set Of Tasks: ' + name))
        window.select_from_list_cansel_button.clicked.connect(partial(self.close_window, window))
        window.select_from_list_apply_button.setVisible(False)

        # set modal window
        window.setWindowModality(QtCore.Qt.WindowModal)
        window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)

        window.show()
项目:lineyka    作者:volodya-renderberg    | 项目源码 | 文件源码
def fill_series_table(self, *args):
        table = args[0]
        project = args[1]

        if project == '-- select project --':
            self.current_project = False
            self.default_state_series_table(table)
            return

        else:
            self.current_project = project

        # get table data
        series = []
        #copy = db.series()
        #result = copy.get_list(project)
        result = self.db_series.get_list(project)
        if result[0]:
            series = result[1]

        columns = self.series_columns
        num_row = len(series)
        num_column = len(columns)
        headers = columns

        # make table
        table.setColumnCount(num_column)
        table.setRowCount(num_row)
        table.setHorizontalHeaderLabels(headers)

        # fill table
        for i, data in enumerate(series):
            for j,key in enumerate(headers):
                newItem = QtGui.QTableWidgetItem()
                newItem.setText(data[key])
                if key == 'name':
                    color = self.series_color
                    brush = QtGui.QBrush(color)
                    newItem.setBackground(brush)

                table.setItem(i, j, newItem)

        #  edit label
        self.myWidget.studio_editor_label.setText(('Series Editor / \"' + project + '\"'))

        table.resizeRowsToContents()
        table.resizeColumnsToContents()

        print('fill series table', result)