Example #1
0
    def __init__(self, orientation, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)

        self.slider.valueChanged.connect(self.scrollBar.setValue)
        self.scrollBar.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)
    def createBottomRightGroupBox(self):
        self.bottomRightGroupBox = QGroupBox("Group 3")
        self.bottomRightGroupBox.setCheckable(True)
        self.bottomRightGroupBox.setChecked(True)

        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(50)

        dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
        dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout()
        layout.addWidget(lineEdit, 0, 0, 1, 2)
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(dateTimeEdit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        layout.setRowStretch(5, 1)
        self.bottomRightGroupBox.setLayout(layout)
Example #3
0
    def createBottomRightGroupBox(self):
        self.bottomRightGroupBox = QGroupBox("Group 3")
        self.bottomRightGroupBox.setCheckable(True)
        self.bottomRightGroupBox.setChecked(True)

        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(50)

        dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
        dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout()
        layout.addWidget(lineEdit, 0, 0, 1, 2)
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(dateTimeEdit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        layout.setRowStretch(5, 1)
        self.bottomRightGroupBox.setLayout(layout)
Example #4
0
    def __init__(self):
        super(Example, self).__init__()
        # vbox = QVBoxLayout(self)
        hbox = QHBoxLayout()
        # self.l1 = QLabel("Drag scrollbar sliders to change color")
        # self.l1.setFont(QFont("Arial", 16))

        # hbox.addWidget(self.l1)
        self.s1 = QScrollBar()
        self.s1.setMaximum(255)

        # self.s1.sliderMoved.connect(self.sliderval)
        # self.s2 = QScrollBar()
        # self.s2.setMaximum(255)
        # self.s2.sliderMoved.connect(self.sliderval)

        # self.s3 = QScrollBar()
        # self.s3.setMaximum(255)
        # self.s3.sliderMoved.connect(self.sliderval)

        hbox.addWidget(self.s1)
        # hbox.addWidget(self.s2)
        # hbox.addWidget(self.s3)

        self.setLayout(hbox)

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QSplitter demo')
Example #5
0
    def createBottomRightGroupBox(self):
        self.bottomRightGroupBox = QGroupBox("Audio Speed")

        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(50)

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout()
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        self.bottomRightGroupBox.setLayout(layout)
Example #6
0
    def __init__(self, tabbed=True, parent=None):
        EditorMapComponent.current = self

        self.workspace = Workspace()
        self.gc_state = GraphicContextState()

        if tabbed:
            self.tab_widget = QTabWidget(parent)
            self.widget = QWidget(self.tab_widget)
            self.tab_widget.addTab(self.widget, "A Label")
        else:
            self.tab_widget = None
            self.widget = QWidget(parent)

        self.layout = QGridLayout(self.widget)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setHorizontalSpacing(0)
        self.layout.setVerticalSpacing(0)

        self.scroll_horz = QScrollBar(Qt.Horizontal)
        self.scroll_vert = QScrollBar(Qt.Vertical)
        self.editormap_widget = EditorMapWidget(self, None)

        self.scroll_horz.valueChanged.connect(self.move_to_x)
        self.scroll_vert.valueChanged.connect(self.move_to_y)

        self.layout.addWidget(self.editormap_widget, 0, 0)
        self.layout.addWidget(self.scroll_horz, 1, 0)
        self.layout.addWidget(self.scroll_vert, 0, 1)

        self.sig_drop = Signal()
        self.editormap_widget.sig_drop.connect(self.on_drop)
Example #7
0
class SlidersGroup(QGroupBox):

    valueChanged = pyqtSignal(int)

    def __init__(self, orientation, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)

        self.slider.valueChanged.connect(self.scrollBar.setValue)
        self.scrollBar.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)    

    def setValue(self, value):    
        self.slider.setValue(value)    

    def setMinimum(self, value):    
        self.slider.setMinimum(value)
        self.scrollBar.setMinimum(value)
        self.dial.setMinimum(value)    

    def setMaximum(self, value):    
        self.slider.setMaximum(value)
        self.scrollBar.setMaximum(value)
        self.dial.setMaximum(value)    

    def invertAppearance(self, invert):
        self.slider.setInvertedAppearance(invert)
        self.scrollBar.setInvertedAppearance(invert)
        self.dial.setInvertedAppearance(invert)    

    def invertKeyBindings(self, invert):
        self.slider.setInvertedControls(invert)
        self.scrollBar.setInvertedControls(invert)
        self.dial.setInvertedControls(invert)
class SlidersGroup(QGroupBox):

    valueChanged = pyqtSignal(int)

    def __init__(self, orientation, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)

        self.slider.valueChanged.connect(self.scrollBar.setValue)
        self.scrollBar.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)

    def setValue(self, value):
        self.slider.setValue(value)

    def setMinimum(self, value):
        self.slider.setMinimum(value)
        self.scrollBar.setMinimum(value)
        self.dial.setMinimum(value)

    def setMaximum(self, value):
        self.slider.setMaximum(value)
        self.scrollBar.setMaximum(value)
        self.dial.setMaximum(value)

    def invertAppearance(self, invert):
        self.slider.setInvertedAppearance(invert)
        self.scrollBar.setInvertedAppearance(invert)
        self.dial.setInvertedAppearance(invert)

    def invertKeyBindings(self, invert):
        self.slider.setInvertedControls(invert)
        self.scrollBar.setInvertedControls(invert)
        self.dial.setInvertedControls(invert)
 def __init__(self, color=Qt.white, parent=None):
     QScrollBar.__init__(self, parent)
     self._color = color
     # self.setAttribute(Qt.WA_TranslucentBackground)
     self.timer = QTimer()
     self.timer.setInterval(500)
     self.timer.setSingleShot(True)
     self.timer.timeout.connect(lambda: self.parent().hideWidget(self))
     self.valueChanged.connect(lambda v: self.timer.start())
     self.valueChanged.connect(lambda: self.parent().showWidget(self))
Example #10
0
 def __init__(self, color=Qt.white, parent=None):
     QScrollBar.__init__(self, parent)
     self._color = color
     # self.setAttribute(Qt.WA_TranslucentBackground)
     self.timer = QTimer()
     self.timer.setInterval(500)
     self.timer.setSingleShot(True)
     self.timer.timeout.connect(lambda: self.parent().hideWidget(self))
     self.valueChanged.connect(lambda v: self.timer.start())
     self.valueChanged.connect(lambda: self.parent().showWidget(self))
Example #11
0
 def scroll_bar(self):
     """
     Creates a scroll bar set to the size of the projects list
     :return: QScrollBar Object
     """
     s_bar = QScrollBar(Qt.Horizontal)
     s_bar.setMaximum(len(self.project_list) - 4)
     s_bar.sliderMoved.connect(self.slider_val)
     s_bar.valueChanged.connect(self.slider_val)
     return s_bar
class ScrollDemo(QWidget):
    """主窗口"""
    def __init__(self, parent=None):
        super().__init__(parent=parent)
        self.setWindowTitle("QScrollBar 使用")

        self.label = QLabel("拖动滑块改变颜色")

        self.scroll_red = QScrollBar()
        self.scroll_green = QScrollBar()
        self.scroll_blue = QScrollBar()

        self.scroll_red.setRange(0, 255)
        self.scroll_green.setRange(0, 255)
        self.scroll_blue.setRange(0, 255)

        self.scroll_red.sliderMoved.connect(self.slider_value)
        self.scroll_green.sliderMoved.connect(self.slider_value)
        self.scroll_blue.sliderMoved.connect(self.slider_value)

        h_layout = QHBoxLayout()
        h_layout.addWidget(self.label)
        h_layout.addWidget(self.scroll_red)
        h_layout.addWidget(self.scroll_green)
        h_layout.addWidget(self.scroll_blue)

        self.setLayout(h_layout)

    def slider_value(self):
        # print("rgb(%s, %s, %d)" % (self.scroll_red.value(), self.scroll_green.value(), self.scroll_blue.value()))
        palette = QPalette()
        color = QColor(self.scroll_red.value(), self.scroll_green.value(), self.scroll_blue.value())
        palette.setColor(QPalette.Foreground, color)
        self.label.setPalette(palette)
Example #13
0
    def __init__(self, parent: QWidget = None, painter: QPainter = QPainter()):
        super().__init__(parent)
        self.painter = painter
        self.horizontalScrollbar = QScrollBar(Qt.Horizontal)
        self.verticalScrollbar = QScrollBar(Qt.Vertical)
        self.horizontalScrollbar.setVisible(False)
        self.verticalScrollbar.setVisible(False)

        self.horizontalScrollbar.valueChanged.connect(lambda: self.update())
        self.verticalScrollbar.valueChanged.connect(lambda: self.update())
        self.setMouseTracking(True)
Example #14
0
 def __init__(self, sendFunc, resizeConnFunc, isConnectFunc) -> None:
     super().__init__()
     self.terminal = Terminal_Frontend(sendFunc, resizeConnFunc, isConnectFunc)
     self.scrollBar = QScrollBar(Qt.Vertical, self.terminal)
     self.terminal.setScrollBar(self.scrollBar)
     self.scrollBar.setProperty("class", "scrollbar2")
     layout = QHBoxLayout()
     self.setLayout(layout)
     layout.addWidget(self.terminal)
     layout.addWidget(self.scrollBar)
     self.resize(self.terminal.size())
Example #15
0
    def scroll_bar(self):
        """
        Creates a QScrollBar set to the size of the figshare objects list.

        Returns:
            s_bar (QScrollBar): Scroll bar used to move through the list of Figsahre objects.
        """
        s_bar = QScrollBar(Qt.Horizontal)
        s_bar.setMaximum(len(self.object_list) - 4)
        s_bar.sliderMoved.connect(self.slider_val)
        s_bar.valueChanged.connect(self.slider_val)
        return s_bar
    def init_widget(self):
        self.setWindowTitle("Hello World")
        form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self)
        self.setLayout(form_lbx)

        pgsb = QProgressBar()
        vscrb = QScrollBar(orientation=Qt.Horizontal)
        vscrb.setRange(0, 100)
        vscrb.valueChanged.connect(pgsb.setValue)

        form_lbx.addWidget(pgsb)
        form_lbx.addWidget(vscrb)
Example #17
0
 def __init__(self, externalScrollBar=None, parent=None):
     super().__init__(parent)
     self.externalScrollBar = externalScrollBar
     # 实例化两个滚动条
     self.minScrollBar = QScrollBar(Qt.Vertical, self)
     self.maxScrollBar = QScrollBar(Qt.Vertical, self)
     # 实例化一个控制滚动条显示的计时器
     self.timer = QTimer(self)
     # 初始化
     self.initWidget()
     self.associateScrollBar()
     self.setQss()
Example #18
0
    def initUI(self):
        self.setGeometry(300, 300, 300, 300)
        self.label = QLabel("通过滚动条改变字体颜色")
        hlayout = QHBoxLayout()
        hlayout.addWidget(self.label)

        self.scrollbar1 = QScrollBar()
        self.scrollbar1.setMaximum(255)
        self.scrollbar1.sliderMoved.connect(self.sliderMoved)

        self.scrollbar2 = QScrollBar()
        self.scrollbar2.setMaximum(255)
        self.scrollbar2.sliderMoved.connect(self.sliderMoved)

        self.scrollbar3 = QScrollBar()
        self.scrollbar3.setMaximum(255)
        self.scrollbar3.sliderMoved.connect(self.sliderMoved)

        self.scrollbar4 = QScrollBar()
        self.scrollbar4.setMaximum(255)
        self.scrollbar4.sliderMoved.connect(self.sliderMoved1)

        hlayout.addWidget(self.scrollbar1)
        hlayout.addWidget(self.scrollbar2)
        hlayout.addWidget(self.scrollbar3)
        hlayout.addWidget(self.scrollbar4)

        self.setLayout(hlayout)

        self.y = self.label.pos().y()
Example #19
0
    def __init__(self, parent):
        super().__init__(parent)
        self._y = 0
        self._width = 1
        self._height = 1

        self.dot = Digraph(format='svg', strict=True)
        self._declared_count = 1
        self._declared = dict()
        self._renderer = QSvgRenderer(self.dot.pipe(), self)

        self.scrollbar = QScrollBar(self.parent())
        self.scrollbar.setRange(0, 0)
        self.parent().wheelEvent = self.wheelEvent
class ContentHolder(QScrollArea):
    def __init__(self, superEl):
        self.superEl = superEl
        super(ContentHolder, self).__init__()

        self.scrollBar = QScrollBar()

        self.scrollBar.setCursor(Qt.PointingHandCursor)
        self.setVerticalScrollBar(self.scrollBar)
        # self.setCursor()
        self.content = Content(self)
        self.setWidget(self.content)
        with open(f"{PATH}/src/style/scrollbar.qss", "r",
                  encoding="utf8") as f:
            qssContent = f.read()
        self.setStyleSheet(qssContent)

    #     self.scrollBar.valueChanged.connect(self.fff)
    # def fff(self):
    #     print(self.scrollBar.value())
    # def enterEvent(self, QEvent):
    #     self.superEl.entered = True
    #     self.active()
    # def leaveEvent(self, QEvent):
    #     self.superEl.entered = False
    #     self.disActive()

    def active(self):
        self.content.setStyleSheet(
            f"background-color: {config.colors.contentDisplayBg}")
        # self.contentHolder.scrollBar.setValue(0)

    def disActive(self):
        self.content.setStyleSheet(
            f"background-color: {config.colors.contentBg}")

    def setScrollBarValue(self, n):
        # print(1)
        # h=self.height()
        # l = self.content.bangumiChapters.__len__()
        # ratio = (n - 1)/l
        # mi = self.scrollBar.minimum()
        # m = self.scrollBar.maximum()
        # value = ratio * m + h/2 - (m / l)/2
        # self.scrollBar.setValue(int(value))
        # m = self.scrollBar.maximum()
        # l = self.content.bangumiChapters.__len__()
        # self.scrollBar.setValue(int((n/l) * m + self.height()/2))
        self.scrollBar.setValue(n * 106 + 6)
    def __init__(self, superEl):
        self.superEl = superEl
        super(ContentHolder, self).__init__()

        self.scrollBar = QScrollBar()

        self.scrollBar.setCursor(Qt.PointingHandCursor)
        self.setVerticalScrollBar(self.scrollBar)
        # self.setCursor()
        self.content = Content(self)
        self.setWidget(self.content)
        with open(f"{PATH}/src/style/scrollbar.qss", "r",
                  encoding="utf8") as f:
            qssContent = f.read()
        self.setStyleSheet(qssContent)
Example #22
0
    def __init__(self):
        super(QWidget, self).__init__()
        
        self.scrollBar = QScrollBar(Qt.Horizontal)
        self.scrollBar.valueChanged.connect(self.customSlot)

        self.messageBox = QMessageBox()
        self.messageBox.setIcon(QMessageBox.Information)
        self.messageBox.setWindowTitle('Информация')

        layout = QVBoxLayout()
        layout.addWidget(self.scrollBar)
        self.setLayout(layout)
        self.resize(300, 150)
        self.show()
Example #23
0
    def __init__(self, parent=None):
        super(_s_CentralWidget, self).__init__(parent)
        self.parent = parent
        #This variables are used to save the splitter sizes before hide
        self._splitterMainSizes = None
        self._splitterAreaSizes = None
        self.lateralPanel = None

        hbox = QHBoxLayout(self)
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.setSpacing(0)
        #Create Splitters to divide the UI in: MainPanel, Explorer, Misc
        self._splitterArea = QSplitter(Qt.Horizontal)
        self._splitterMain = QSplitter(Qt.Vertical)

        #Create scrollbar for follow mode
        self.scrollBar = QScrollBar(Qt.Vertical, self)
        self.scrollBar.setFixedWidth(20)
        self.scrollBar.setToolTip('Follow Mode: Scroll the Editors together')
        self.scrollBar.hide()
        self.scrollBar.valueChanged[int].connect(self.move_follow_scrolls)

        #Add to Main Layout
        hbox.addWidget(self.scrollBar)
        hbox.addWidget(self._splitterArea)
Example #24
0
    def __init__(self, orientation, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)

        self.slider.valueChanged.connect(self.scrollBar.setValue)
        self.scrollBar.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)    
Example #25
0
    def run(self, data, data_list, page):
        self.widget_edit_section = QListWidget(self.obj)
        scroll_bar = QScrollBar(self.obj)
        self.widget_edit_section.setVerticalScrollBar(scroll_bar)
        self.widget_edit_section.setGeometry(
            QtCore.QRect(data[0], data[1], data[2], data[3]))
        self.widget_edit_section.setObjectName("widget_edit_section")
        self.edit_section_grid = QtWidgets.QGridLayout(
            self.widget_edit_section)
        self.edit_section_grid.setContentsMargins(0, 0, 0, 0)
        self.edit_section_grid.setObjectName("edit_section_grid")
        row = 0
        for item in data_list:

            label = QtWidgets.QLabel()
            label.setObjectName('test')
            if hasattr(item, 'name'):
                label.setText(item.name)
            else:
                label.setText(item)
            self.edit_section_grid.addWidget(label, row, 0, 1, 1)

            button = QtWidgets.QPushButton(self.obj)
            button.setObjectName('obj_name')
            button.setText('Remowe')
            button.data = item

            self.edit_section_grid.addWidget(button, row, 2, 1, 1)

            self.Form.buttons_loop[0]['obejct'].addButton(button)
            self.Form.buttons_loop[0]['obejct'].buttonClicked[int].connect(
                self.Form.buttons_loop[0]['button'])

            row = row + 1
Example #26
0
     def initCreation(self):
         """
            Initialisation de la création du thème
         """
         if self.fichier is None:
             actions = ["Créer un thème", "Charger un thème"]
             message = "Que voulez-vous faire ?"
             item, ok = QInputDialog.getItem(self, "VPEdThemeCreator", message, actions, 0, False)
             if ok and item == actions[1]:
                 self.on_actionOuvrir_triggered(init = True)
             else:
                 self.on_actionNouveau_triggered()

         # Tabulation
         self.previsualisation.spaceWidth = self.previsualisation.fontMetrics().width(" ")
         self.previsualisation.setTabStopWidth(self.previsualisation.spaceWidth * 7)
         self.previsualisation.setStyleSheet("""
                font:14px comic sans ms, verdana;background:rgb(""" + self.theme.themeGeneral.backgrounds[4] + """);
                color:rgb(""" + self.theme.themeGeneral.foregrounds[0] + """);
         """)
         self.previsualisation.setHorizontalScrollBar(QScrollBar(Qt.Horizontal, self.previsualisation))

         # Evènements
         self.langages.itemClicked.connect(self.on_langages_itemChanged)
         self.mots.itemClicked.connect(self.on_mots_itemChanged)

         for lang in LANGUAGES.keys():
             self.langages.addItem(lang)

         #Changement de couleur (évènement)
         self.changerCouleur.clicked.connect(self.on_changerCouleur)
         self.italique.clicked.connect(self.on_checkBoxFont_clicked)
         self.gras.clicked.connect(self.on_checkBoxFont_clicked)
         self.general.currentTextChanged.connect(self.on_comboBoxGeneral_textChanged)
Example #27
0
    def __init__(self):
        super().__init__()

        uids = get_all_uids()
        
        layout = QHBoxLayout()
        main_splitter = QSplitter(self)
        image_splitter = QSplitter(QtCore.Qt.Vertical, self)
        picture_viewer = PictureViewer(image_splitter)
        meta_viewer = MetaViewer(image_splitter)
        atexit.register(lambda: meta_viewer.save_meta())

        picture_frame = QWidget(main_splitter)
        picture_frame.setLayout(layout)

        scrollbar = QScrollBar(QtCore.Qt.Vertical)
        image_pane = PictureGrid(picture_frame, uids, scrollbar, picture_viewer, meta_viewer)
        
        layout.addWidget(image_pane)
        layout.addWidget(scrollbar)

        image_splitter.addWidget(picture_viewer)
        image_splitter.addWidget(meta_viewer)
        image_splitter.setSizes([600, 200])

        main_splitter.addWidget(picture_frame)
        main_splitter.addWidget(image_splitter)
        main_splitter.setSizes([300, 200]) # TODO What do these numbers do?

        self.setCentralWidget(main_splitter)
        self.setWindowTitle("Cutespam")

        menu = self.menuBar()
        file = menu.addMenu("File")
        file.addAction("Import")

        search = TagLineEdit(self)
        search.setFixedWidth(400)
        completer = QCompleter([], search)
        search.setMultipleCompleter(completer)

        search_container = QWidget()
        layout = QVBoxLayout(search_container)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(search)

        menu.setCornerWidget(search_container)

        def on_typed():
            words = search.text().split(" ")

            if len(search.text()) == 0:
                image_pane.uids = get_all_uids()
            else:
                image_pane.uids = list(get_uids_from_keyword_list(words))
            
            image_pane.update()

        search.textChanged.connect(on_typed)
    def createBottomRightGroupBox(self):
        '''Create a checkable group widget useful in the case of form login etc'''
        self.bottomRightGroupBox = QGroupBox("Group 3")
        self.bottomRightGroupBox.setCheckable(
            True)  # sets the state aware mode
        self.bottomRightGroupBox.setChecked(
            True)  # sets the default state to active
        #
        # create the required widgets
        # a lineEdit Widget for password entry. Activate the security by setEchoMode()
        # a spinBox Widget which lets the field change using scroll
        # a Date Time Edit Widget
        # a Slider Widget responsive to scroll as well as press and move
        # a Scroll Widget responsive to scroll as well as press and move
        # a Dial Widget responsive to scroll as well as press and move
        #
        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(25)

        dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
        dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)
        #
        # create the internal layout of the group Widget
        #
        layout = QGridLayout()
        layout.addWidget(lineEdit, 0, 0, 1, 3)
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(dateTimeEdit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 2)
        layout.setRowStretch(50, 1)  # ?? whatdoes RowStretch do?
        self.bottomRightGroupBox.setLayout(layout)
Example #29
0
    def __init__(self, offset, bit_size, row_width, grid_width, grid_height,
                 bit_border_threshold) -> None:
        super().__init__()
        self._app = App()
        self._offset = offset
        self._bit_size = bit_size
        self._row_width = row_width
        self._grid_width = grid_width
        self._grid_h_offset = 0
        self._grid_height = grid_height
        self._grid_v_offset = 0
        self._one_color = Qt.blue
        self._zero_color = Qt.white
        self._color_table = [
            QColor(self._zero_color).rgb(),
            QColor(self._one_color).rgb(),
        ]
        self._bit_border_threshold = bit_border_threshold
        self._easter_egg = 0
        self._painting = False

        self._bits_area = QWidget()

        self._h_scrollbar = QScrollBar(orientation=Qt.Horizontal)
        self._h_scrollbar.setMinimum(0)
        self._h_scrollbar.valueChanged.connect(self._on_scrollbar_change)
        self._h_scrollbar.hide()
        self._v_scrollbar = QScrollBar(orientation=Qt.Vertical)
        self._v_scrollbar.setMinimum(0)
        self._v_scrollbar.valueChanged.connect(self._on_scrollbar_change)
        self._v_scrollbar.hide()

        inner_layout = QVBoxLayout()
        inner_layout.setContentsMargins(0, 0, 0, 0)
        inner_layout.setSpacing(0)
        inner_layout.addWidget(self._bits_area, stretch=1)
        inner_layout.addWidget(self._h_scrollbar)
        inner_widget = QWidget()
        inner_widget.setLayout(inner_layout)

        outer_layout = QHBoxLayout()
        outer_layout.setContentsMargins(0, 0, 0, 0)
        outer_layout.setSpacing(0)
        outer_layout.addWidget(inner_widget, stretch=1)
        outer_layout.addWidget(self._v_scrollbar)
        self.setLayout(outer_layout)
Example #30
0
 def __init__(self, data):
     super(HexView, self).__init__()
     self.layout = QHBoxLayout(self)
     self.scrollBar = QScrollBar(self)
     self.hex = Hex(data, self.scrollBar, self)
     self.text = Text(data, self.scrollBar, self)
     self.layout.addWidget(self.hex)
     self.layout.addWidget(self.scrollBar)
     self.layout.addWidget(self.text)
Example #31
0
 def connectAll(self):
     self.downloadBtn.clicked.connect(self.downloadGame)
     self.updateBtn.clicked.connect(self.setGames)
     self.gamesList.setVerticalScrollBar(QScrollBar())
     self.setEngines()
     self.setGames()
     self.playBtn.clicked.connect(self.play)
     self.delBtn.clicked.connect(self.delGame)
     self.successMessage('Добро пожаловать в лучший лаунчер флешек Ahsoka')
Example #32
0
 def __init__(self, master, text, geo, proc=None, lim=(0,100,1)):
     self.scl=QScrollBar(Qt.Horizontal, master)
     self.scl.resize(geo[2]-50,geo[3])
     self.scl.move(geo[0]+50,geo[1])
     self.scl.setMinimum(lim[0])
     self.scl.setMaximum(lim[1])
     self.scl.setSingleStep(lim[2])
     self.scl.valueChanged.connect(lambda: self.update_val(proc))
     
     q=QLabel(master)
     q.move(geo[0],geo[1]+10)
     q.resize(50,20)
     q.setText(text)
     
     self.v=QLabel(master)
     self.v.move(geo[2]+10,geo[1]+10)
     self.v.resize(50,20)
     self.v.setText(str(self.scl.value()))
Example #33
0
    def __init__(self, parent=None, previsualisation=False):
        super().__init__(parent=None)
        _translate = QCoreApplication.translate
        self.parent = parent
        self.saved = True
        self.title = ""
        self.path = ""
        self.theme = parent.theme
        self.fichier = UserFile(self.path)
        self.coloration()
        self.disposition = Disposition(self, self.fichier.extension())
        self.docScan = DocScan.languageClass(self.fichier.extension(),
                                             self.toPlainText())

        #Style
        self.setStyleSheet(self.theme.styleEditorText)
        self.setVerticalScrollBar(QScrollBar(Qt.Vertical, self))
        self.setHorizontalScrollBar(QScrollBar(Qt.Horizontal, self))

        #Numéros de lignes
        if not previsualisation:
            self.lineNumberArea = LineNumberArea(self)
            self.lineNumberArea.setStyleSheet(self.theme.styleLineNumberArea)
            self.setLineWrapMode(QPlainTextEdit.NoWrap)

        # Tabulation
        self.spaceWidth = self.fontMetrics().width(" ")
        self.setTabStopWidth(self.spaceWidth * 12)

        #Actions
        self.dupliquerLigne = QShortcut(QKeySequence("Ctrl+D"), self)
        self.dupliquerLigne.activated.connect(self.on_dupliquerLigne_activated)

        #Evènements
        if not previsualisation:
            self.blockCountChanged.connect(self.updateLineNumberAreaWidth)
            self.updateRequest.connect(self.updateLineNumberArea)
            self.cursorPositionChanged.connect(self.highlightCurrentLine)
            self.updateLineNumberAreaWidth(0)
        self.cursorPositionChanged.connect(self.on_cursorPositionChanged)

        #Completer
        self.completer = Completer(self.fichier.extension(), self)
Example #34
0
    def __init__(self, parent):
        super().__init__(parent)
        self.setContentsMargins(0, 0, 0, 0)
        # 滚动条的宽度
        # 对于水平方向的滚动条其实是高度
        self.scrollBarWidth = 15

        # 文本区
        self.textContainer = TextView(self)
        self.textContainer.setContentsMargins(5, 0, 0, 0)
        # 设置居顶部显示
        self.textContainer.setAlignment(Qt.AlignTop)
        # 设置文本区域根据文本进行自适应
        self.textContainer.adjustSize()
        self.textContainer.setCallback(self.sizeChange)

        # 垂直滚动条
        self.vBar = QScrollBar(Qt.Vertical, self)
        # self.vBar.sliderMoved.connect(self.dragV)
        self.vBar.valueChanged.connect(self.changeVertical)
        # 一开始隐藏
        self.vBar.setVisible(False)
        # 在水平方向上文字的总长度是否超过容器的宽度标志位
        # 只要出现一次超过,那么 self.overHorizontal就永远是True
        # 除非将超过容器宽度的文本都去除
        self.overHorizontal = False
        # 水平方向上滑块上一次的值
        self.hPreValue = 0

        # 水平滚动条
        self.hBar = QScrollBar(Qt.Horizontal, self)
        # self.hBar.sliderMoved.connect(self.dragH)
        self.hBar.valueChanged.connect(self.changeHorizontal)
        # 初始化的时候隐藏自身
        self.hBar.setVisible(False)

        # 在垂直方向上文字的总高度是否超过容器的高度标志位
        # 只要出现一次超过,那么 self.overVertical就永远是True
        # 除非将超过容器高度的文本都去除
        self.overVertical = False
        # 垂直方向上滑块上一次的值
        self.vPreValue = 0
Example #35
0
 def initUI(self):
     #palette = QPalette()
     #palette.setColor(QPalette.Background, QColor('#383C4A'))        
     #palette.setColor(QPalette.WindowText, QColor('#C1C1C1'))        
     #self.setPalette(palette)
     
     self.setMaximumSize(492, 653)
     self.setMinimumSize(492, 653)
     
     le = QLineEdit(self)
     le.textChanged[str].connect(self.onChanged)
     le.returnPressed.connect(self.onActivation)
     le.setClearButtonEnabled(True)
     le.setPlaceholderText('Start typing to search...')
     self.lw = QListWidget()
     self.visibleLw = QListWidget()
     #palette.setColor(QPalette.Base, QColor('#383C4A'))                        
     #self.visibleLw.setPalette(palette)        
     self.visibleLw.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.visibleLw.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)        
     self.visibleLw.itemActivated.connect(self.onActivation)
     self.scrollBar = QScrollBar()
     self.visibleLw.verticalScrollBar().valueChanged.connect(self.scrollBar.setValue)
     self.scrollBar.valueChanged.connect(self.visibleLw.verticalScrollBar().setValue)
     vbox = QVBoxLayout()
     vbox.setSpacing(3)
     #vbox.setContentsMargins(3, 3, 3, 3)
     vbox.setContentsMargins(0, 4, 0, 0)        
     vbox.addWidget(le)       
     hbox = QHBoxLayout()
     hbox.setSpacing(0)
     #hbox.setContentsMargins(0, 0, 0, 0)                
     hbox.addWidget(self.visibleLw)
     hbox.addWidget(self.scrollBar)
     vbox.addLayout(hbox)
     self.setLayout(vbox)
     
     self.setWindowTitle('Music Library')
     
     icon = QIcon.fromTheme('musique')
     self.setWindowIcon(icon)
    def __init__(self,parent=None):
        QWidget.__init__(self,parent)

        self.__editorSettings = EditorSettings()
        self.__textDocument = PythonTextDocument()
        
        self.__splitter = QSplitter(self)


        # 横纵滚动条
        self.__verticalScrollBar = QScrollBar(self)
        self.__verticalScrollBar.adjustSize()
        self.__verticalScrollBar.setMinimumWidth(self.__verticalScrollBar.width())
        self.__verticalScrollBar.setMaximumWidth(self.__verticalScrollBar.width())  
        self.__verticalScrollBar.valueChanged.connect(self.__onVScrollValueChanged)
        self.__editorSettings.startDisLineNumberChangedSignal.connect(self.__verticalScrollBar.setValue)
    
        self.__horizontalScrollBar = QScrollBar(QtCore.Qt.Horizontal,self)
        self.__horizontalScrollBar.adjustSize()
        self.__horizontalScrollBar.setMinimumHeight(self.__horizontalScrollBar.height())
        self.__horizontalScrollBar.setMaximumHeight(self.__horizontalScrollBar.height())
        self.__horizontalScrollBar.valueChanged.connect(self.__onHScrollValueChanged)
        self.__editorSettings.startDisLetterXOffChangedSignal.connect(self.__horizontalScrollBar.setValue)
        
        self.__lineNumberWidget = LineNumberWidget(self.__editorSettings,self.__splitter)
        setattr(self.__lineNumberWidget,'resizeEvent',self.__onLineNumberWidgetSizeChanged)
        
        self.__codeTextWidget = CodeTextWidget(self.__textDocument,self.__editorSettings,self.__splitter)
        self.__codeTextWidget.document().totalLevelTextChangedSignal.connect(self.__onCodeTextChanged)
        self.__codeTextWidget.settings().lineTextMaxPixelChangedSignal.connect(self.__onLineStrLengthChanged)
        self.__codeTextWidget.visibleLineYOffInfoChangedSignal.connect( self.__lineNumberWidget.setVisibleLineYOffInfoArray )
        
        
        self.__splitter.addWidget( self.__lineNumberWidget )
        self.__splitter.addWidget( self.__codeTextWidget )
        self.__splitter.setCollapsible( 0,False )
        self.__splitter.setCollapsible( 1,False )

        self.setText = self.__codeTextWidget.setText
        self.getText = self.__codeTextWidget.getText
class MyCodeEditor(QWidget):

    def __init__(self,parent=None):
        QWidget.__init__(self,parent)

        self.__editorSettings = EditorSettings()
        self.__textDocument = PythonTextDocument()
        
        self.__splitter = QSplitter(self)


        # 横纵滚动条
        self.__verticalScrollBar = QScrollBar(self)
        self.__verticalScrollBar.adjustSize()
        self.__verticalScrollBar.setMinimumWidth(self.__verticalScrollBar.width())
        self.__verticalScrollBar.setMaximumWidth(self.__verticalScrollBar.width())  
        self.__verticalScrollBar.valueChanged.connect(self.__onVScrollValueChanged)
        self.__editorSettings.startDisLineNumberChangedSignal.connect(self.__verticalScrollBar.setValue)
    
        self.__horizontalScrollBar = QScrollBar(QtCore.Qt.Horizontal,self)
        self.__horizontalScrollBar.adjustSize()
        self.__horizontalScrollBar.setMinimumHeight(self.__horizontalScrollBar.height())
        self.__horizontalScrollBar.setMaximumHeight(self.__horizontalScrollBar.height())
        self.__horizontalScrollBar.valueChanged.connect(self.__onHScrollValueChanged)
        self.__editorSettings.startDisLetterXOffChangedSignal.connect(self.__horizontalScrollBar.setValue)
        
        self.__lineNumberWidget = LineNumberWidget(self.__editorSettings,self.__splitter)
        setattr(self.__lineNumberWidget,'resizeEvent',self.__onLineNumberWidgetSizeChanged)
        
        self.__codeTextWidget = CodeTextWidget(self.__textDocument,self.__editorSettings,self.__splitter)
        self.__codeTextWidget.document().totalLevelTextChangedSignal.connect(self.__onCodeTextChanged)
        self.__codeTextWidget.settings().lineTextMaxPixelChangedSignal.connect(self.__onLineStrLengthChanged)
        self.__codeTextWidget.visibleLineYOffInfoChangedSignal.connect( self.__lineNumberWidget.setVisibleLineYOffInfoArray )
        
        
        self.__splitter.addWidget( self.__lineNumberWidget )
        self.__splitter.addWidget( self.__codeTextWidget )
        self.__splitter.setCollapsible( 0,False )
        self.__splitter.setCollapsible( 1,False )

        self.setText = self.__codeTextWidget.setText
        self.getText = self.__codeTextWidget.getText



    def __onLineStrLengthChanged(self,newMaxLength):
        hMax = newMaxLength-1
        self.__horizontalScrollBar.setRange(0,hMax)
        if self.__horizontalScrollBar.value() > hMax:
            self.__horizontalScrollBar.setValue(hMax)
        
    
    def __onCodeTextChanged(self,*arg1,**arg2):        
        vMax = self.__codeTextWidget.document().getLineCount()-1
        self.__verticalScrollBar.setRange(0,vMax)
        if self.__verticalScrollBar.value() > vMax:
            self.__verticalScrollBar.setValue(vMax)


    def __onVScrollValueChanged(self):
        self.__codeTextWidget.showLineNumberAsTop(self.__verticalScrollBar.value())
        
    def __onHScrollValueChanged(self):
        self.__codeTextWidget.showLeftXOffAsLeft(self.__horizontalScrollBar.value())
    
    
    
    
    def __onLineNumberWidgetSizeChanged(self,*arg1,**arg2):
        lineNumberWidgetWidth = self.__lineNumberWidget.width()
        vScrollBarWidth = self.__verticalScrollBar.width()        
        hScrollBarHeight = self.__horizontalScrollBar.height()
        self.__horizontalScrollBar.setGeometry(lineNumberWidgetWidth,self.height()-hScrollBarHeight, \
                                               self.width()-vScrollBarWidth-lineNumberWidgetWidth,hScrollBarHeight)    
    
    def resizeEvent(self, event):
        vScrollBarWidth = self.__verticalScrollBar.width()        
        hScrollBarHeight = self.__horizontalScrollBar.height()
        self.__splitter.setGeometry( 0,0,self.width()-vScrollBarWidth,self.height()-hScrollBarHeight )
        self.__verticalScrollBar.setGeometry(self.width()-vScrollBarWidth,0,vScrollBarWidth,self.height()-hScrollBarHeight)
        self.__onLineNumberWidgetSizeChanged()
        
    def wheelEvent(self, event):
        changedV = 3 if event.angleDelta().y() < 0 else -3
        self.__verticalScrollBar.setValue( self.__verticalScrollBar.value() + changedV )
Example #38
0
class CarlaRackW(QFrame, HostWidgetMeta):
#class CarlaRackW(QFrame, HostWidgetMeta, metaclass=PyQtMetaClass):
    def __init__(self, parent, host, doSetup = True):
        QFrame.__init__(self, parent)
        self.host = host

        if False:
            # kdevelop likes this :)
            host = CarlaHostMeta()
            self.host = host

        # -------------------------------------------------------------

        self.fLayout = QHBoxLayout(self)
        self.fLayout.setContentsMargins(0, 0, 0, 0)
        self.fLayout.setSpacing(0)
        self.setLayout(self.fLayout)

        self.fPadLeft  = QLabel(self)
        self.fPadLeft.setFixedWidth(25)
        self.fPadLeft.setObjectName("PadLeft")
        self.fPadLeft.setText("")

        self.fPadRight = QLabel(self)
        self.fPadRight.setFixedWidth(25)
        self.fPadRight.setObjectName("PadRight")
        self.fPadRight.setText("")

        self.fRack = CarlaRackList(self, host)
        self.fRack.setObjectName("CarlaRackList")
        self.fRack.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.fRack.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.fRack.currentRowChanged.connect(self.slot_currentRowChanged)

        sb = self.fRack.verticalScrollBar()
        self.fScrollBar = QScrollBar(Qt.Vertical, self)
        self.fScrollBar.setMinimum(sb.minimum())
        self.fScrollBar.setMaximum(sb.maximum())
        self.fScrollBar.setValue(sb.value())

        #sb.actionTriggered.connect(self.fScrollBar.triggerAction)
        #sb.sliderMoved.connect(self.fScrollBar.)
        #sb.sliderPressed.connect(self.fScrollBar.)
        #sb.sliderReleased.connect(self.fScrollBar.)
        sb.rangeChanged.connect(self.fScrollBar.setRange)
        sb.valueChanged.connect(self.fScrollBar.setValue)
        self.fScrollBar.rangeChanged.connect(sb.setRange)
        self.fScrollBar.valueChanged.connect(sb.setValue)

        self.fLayout.addWidget(self.fPadLeft)
        self.fLayout.addWidget(self.fRack)
        self.fLayout.addWidget(self.fPadRight)
        self.fLayout.addWidget(self.fScrollBar)

        # -------------------------------------------------------------
        # Internal stuff

        self.fParent      = parent
        self.fPluginCount = 0
        self.fPluginList  = []

        self.fCurrentRow = -1
        self.fLastSelectedItem = None

        # -------------------------------------------------------------
        # Set-up GUI stuff

        #app  = QApplication.instance()
        #pal1 = app.palette().base().color()
        #pal2 = app.palette().button().color()
        #col1 = "stop:0 rgb(%i, %i, %i)" % (pal1.red(), pal1.green(), pal1.blue())
        #col2 = "stop:1 rgb(%i, %i, %i)" % (pal2.red(), pal2.green(), pal2.blue())

        self.setStyleSheet("""
          QLabel#PadLeft {
            background-image: url(:/bitmaps/rack_padding_left.png);
            background-repeat: repeat-y;
          }
          QLabel#PadRight {
            background-image: url(:/bitmaps/rack_padding_right.png);
            background-repeat: repeat-y;
          }
          CarlaRackList#CarlaRackList {
            background-color: black;
          }
        """)

        # -------------------------------------------------------------
        # Connect actions to functions

        host.PluginAddedCallback.connect(self.slot_handlePluginAddedCallback)
        host.PluginRemovedCallback.connect(self.slot_handlePluginRemovedCallback)
        host.ReloadAllCallback.connect(self.slot_handleReloadAllCallback)

        if not doSetup: return

        parent.ui.menu_Canvas.hide()

        parent.ui.act_plugins_enable.triggered.connect(self.slot_pluginsEnable)
        parent.ui.act_plugins_disable.triggered.connect(self.slot_pluginsDisable)
        parent.ui.act_plugins_volume100.triggered.connect(self.slot_pluginsVolume100)
        parent.ui.act_plugins_mute.triggered.connect(self.slot_pluginsMute)
        parent.ui.act_plugins_wet100.triggered.connect(self.slot_pluginsWet100)
        parent.ui.act_plugins_bypass.triggered.connect(self.slot_pluginsBypass)
        parent.ui.act_plugins_center.triggered.connect(self.slot_pluginsCenter)
        parent.ui.act_plugins_panic.triggered.connect(self.slot_pluginsDisable)

        parent.ui.act_settings_configure.triggered.connect(self.slot_configureCarla)

    # -----------------------------------------------------------------

    @pyqtSlot(int, str)
    def slot_handlePluginAddedCallback(self, pluginId, pluginName):
        pitem = CarlaRackItem(self.fRack, pluginId, self.fParent.getSavedSettings()[CARLA_KEY_MAIN_USE_CUSTOM_SKINS])

        self.fPluginList.append(pitem)
        self.fPluginCount += 1

        if not self.fParent.isProjectLoading():
            pitem.getWidget().setActive(True, True, True)

    @pyqtSlot(int)
    def slot_handlePluginRemovedCallback(self, pluginId):
        pitem = self.getPluginItem(pluginId)

        self.fPluginCount -= 1
        self.fPluginList.pop(pluginId)
        self.fRack.takeItem(pluginId)

        if pitem is not None:
            pitem.closeEditDialog()
            del pitem

        # push all plugins 1 slot back
        for i in range(pluginId, self.fPluginCount):
            pitem = self.fPluginList[i]
            pitem.setPluginId(i)

    # -----------------------------------------------------------------
    # HostWidgetMeta methods

    def removeAllPlugins(self):
        while self.fRack.takeItem(0):
            pass

        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.closeEditDialog()
            del pitem

        self.fPluginCount = 0
        self.fPluginList  = []

    def engineStarted(self):
        pass

    def engineStopped(self):
        pass

    def idleFast(self):
        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.getWidget().idleFast()

    def idleSlow(self):
        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.getWidget().idleSlow()

    def projectLoadingStarted(self):
        self.fRack.setEnabled(False)

    def projectLoadingFinished(self):
        self.fRack.setEnabled(True)

    def saveSettings(self, settings):
        pass

    def showEditDialog(self, pluginId):
        dialog = self.getPluginEditDialog(pluginId)

        if dialog is None:
            return

        dialog.show()

    # -----------------------------------------------------------------

    @pyqtSlot()
    def slot_pluginsEnable(self):
        if not self.host.is_engine_running():
            return

        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.getWidget().setActive(True, True, True)

    @pyqtSlot()
    def slot_pluginsDisable(self):
        if not self.host.is_engine_running():
            return

        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.getWidget().setActive(False, True, True)

    @pyqtSlot()
    def slot_pluginsVolume100(self):
        if not self.host.is_engine_running():
            return

        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.getWidget().setInternalParameter(PLUGIN_CAN_VOLUME, 1.0)

    @pyqtSlot()
    def slot_pluginsMute(self):
        if not self.host.is_engine_running():
            return

        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.getWidget().setInternalParameter(PLUGIN_CAN_VOLUME, 0.0)

    @pyqtSlot()
    def slot_pluginsWet100(self):
        if not self.host.is_engine_running():
            return

        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.getWidget().setInternalParameter(PLUGIN_CAN_DRYWET, 1.0)

    @pyqtSlot()
    def slot_pluginsBypass(self):
        if not self.host.is_engine_running():
            return

        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.getWidget().setInternalParameter(PLUGIN_CAN_DRYWET, 0.0)

    @pyqtSlot()
    def slot_pluginsCenter(self):
        if not self.host.is_engine_running():
            return

        for pitem in self.fPluginList:
            if pitem is None:
                break

            pitem.getWidget().setInternalParameter(PARAMETER_BALANCE_LEFT, -1.0)
            pitem.getWidget().setInternalParameter(PARAMETER_BALANCE_RIGHT, 1.0)
            pitem.getWidget().setInternalParameter(PARAMETER_PANNING, 0.0)

    # -----------------------------------------------------------------

    @pyqtSlot()
    def slot_configureCarla(self):
        dialog = CarlaSettingsW(self, self.host, False, False)
        if not dialog.exec_():
            return

        self.fParent.loadSettings(False)

    # -----------------------------------------------------------------

    @pyqtSlot(int)
    def slot_handleReloadAllCallback(self, pluginId):
        if pluginId >= self.fPluginCount:
            return

        pitem = self.fPluginList[pluginId]
        if pitem is None:
            return

        self.fRack.setCurrentRow(-1)
        self.fCurrentRow = -1
        self.fLastSelectedItem = None

        pitem.recreateWidget()

    # -----------------------------------------------------------------

    @pyqtSlot(int)
    def slot_currentRowChanged(self, row):
        self.fCurrentRow = row

        if self.fLastSelectedItem is not None:
            self.fLastSelectedItem.setSelected(False)

        if row < 0 or row >= self.fPluginCount or self.fPluginList[row] is None:
            self.fLastSelectedItem = None
            return

        pitem = self.fPluginList[row]
        pitem.getWidget().setSelected(True)
        self.fLastSelectedItem = pitem.getWidget()

    # -----------------------------------------------------------------

    def getPluginItem(self, pluginId):
        if pluginId >= self.fPluginCount:
            return None

        pitem = self.fPluginList[pluginId]
        if pitem is None:
            return None
        if False:
            pitem = CarlaRackItem(self, 0, False)

        return pitem

    def getPluginEditDialog(self, pluginId):
        if pluginId >= self.fPluginCount:
            return None

        pitem = self.fPluginList[pluginId]
        if pitem is None:
            return None
        if False:
            pitem = CarlaRackItem(self, 0, False)

        return pitem.getEditDialog()

    def getPluginSlotWidget(self, pluginId):
        if pluginId >= self.fPluginCount:
            return None

        pitem = self.fPluginList[pluginId]
        if pitem is None:
            return None
        if False:
            pitem = CarlaRackItem(self, 0, False)

        return pitem.getWidget()
Example #39
0
    def __init__(self, parent, host, doSetup = True):
        QFrame.__init__(self, parent)
        self.host = host

        if False:
            # kdevelop likes this :)
            host = CarlaHostMeta()
            self.host = host

        # -------------------------------------------------------------

        self.fLayout = QHBoxLayout(self)
        self.fLayout.setContentsMargins(0, 0, 0, 0)
        self.fLayout.setSpacing(0)
        self.setLayout(self.fLayout)

        self.fPadLeft  = QLabel(self)
        self.fPadLeft.setFixedWidth(25)
        self.fPadLeft.setObjectName("PadLeft")
        self.fPadLeft.setText("")

        self.fPadRight = QLabel(self)
        self.fPadRight.setFixedWidth(25)
        self.fPadRight.setObjectName("PadRight")
        self.fPadRight.setText("")

        self.fRack = CarlaRackList(self, host)
        self.fRack.setObjectName("CarlaRackList")
        self.fRack.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.fRack.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.fRack.currentRowChanged.connect(self.slot_currentRowChanged)

        sb = self.fRack.verticalScrollBar()
        self.fScrollBar = QScrollBar(Qt.Vertical, self)
        self.fScrollBar.setMinimum(sb.minimum())
        self.fScrollBar.setMaximum(sb.maximum())
        self.fScrollBar.setValue(sb.value())

        #sb.actionTriggered.connect(self.fScrollBar.triggerAction)
        #sb.sliderMoved.connect(self.fScrollBar.)
        #sb.sliderPressed.connect(self.fScrollBar.)
        #sb.sliderReleased.connect(self.fScrollBar.)
        sb.rangeChanged.connect(self.fScrollBar.setRange)
        sb.valueChanged.connect(self.fScrollBar.setValue)
        self.fScrollBar.rangeChanged.connect(sb.setRange)
        self.fScrollBar.valueChanged.connect(sb.setValue)

        self.fLayout.addWidget(self.fPadLeft)
        self.fLayout.addWidget(self.fRack)
        self.fLayout.addWidget(self.fPadRight)
        self.fLayout.addWidget(self.fScrollBar)

        # -------------------------------------------------------------
        # Internal stuff

        self.fParent      = parent
        self.fPluginCount = 0
        self.fPluginList  = []

        self.fCurrentRow = -1
        self.fLastSelectedItem = None

        # -------------------------------------------------------------
        # Set-up GUI stuff

        #app  = QApplication.instance()
        #pal1 = app.palette().base().color()
        #pal2 = app.palette().button().color()
        #col1 = "stop:0 rgb(%i, %i, %i)" % (pal1.red(), pal1.green(), pal1.blue())
        #col2 = "stop:1 rgb(%i, %i, %i)" % (pal2.red(), pal2.green(), pal2.blue())

        self.setStyleSheet("""
          QLabel#PadLeft {
            background-image: url(:/bitmaps/rack_padding_left.png);
            background-repeat: repeat-y;
          }
          QLabel#PadRight {
            background-image: url(:/bitmaps/rack_padding_right.png);
            background-repeat: repeat-y;
          }
          CarlaRackList#CarlaRackList {
            background-color: black;
          }
        """)

        # -------------------------------------------------------------
        # Connect actions to functions

        host.PluginAddedCallback.connect(self.slot_handlePluginAddedCallback)
        host.PluginRemovedCallback.connect(self.slot_handlePluginRemovedCallback)
        host.ReloadAllCallback.connect(self.slot_handleReloadAllCallback)

        if not doSetup: return

        parent.ui.menu_Canvas.hide()

        parent.ui.act_plugins_enable.triggered.connect(self.slot_pluginsEnable)
        parent.ui.act_plugins_disable.triggered.connect(self.slot_pluginsDisable)
        parent.ui.act_plugins_volume100.triggered.connect(self.slot_pluginsVolume100)
        parent.ui.act_plugins_mute.triggered.connect(self.slot_pluginsMute)
        parent.ui.act_plugins_wet100.triggered.connect(self.slot_pluginsWet100)
        parent.ui.act_plugins_bypass.triggered.connect(self.slot_pluginsBypass)
        parent.ui.act_plugins_center.triggered.connect(self.slot_pluginsCenter)
        parent.ui.act_plugins_panic.triggered.connect(self.slot_pluginsDisable)

        parent.ui.act_settings_configure.triggered.connect(self.slot_configureCarla)
Example #40
0
 def resizeEvent(self, event):
     if self._overlay is None:
         return
     QScrollBar.resizeEvent(self, event)
     self._overlay.resize(self.size())
Example #41
0
class _s_CentralWidget(QWidget):

###############################################################################
# CentralWidget SIGNALS
###############################################################################

    """
    splitterCentralRotated()
    """
    splitterCentralRotated = pyqtSignal()

###############################################################################

    def __init__(self, parent=None):
        super(_s_CentralWidget, self).__init__(parent)
        self.parent = parent
        #This variables are used to save the splitter sizes before hide
        self._splitterMainSizes = None
        self._splitterAreaSizes = None
        self.lateralPanel = None

        hbox = QHBoxLayout(self)
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.setSpacing(0)
        #Create Splitters to divide the UI in: MainPanel, Explorer, Misc
        self._splitterArea = QSplitter(Qt.Horizontal)
        self._splitterMain = QSplitter(Qt.Vertical)

        #Create scrollbar for follow mode
        self.scrollBar = QScrollBar(Qt.Vertical, self)
        self.scrollBar.setFixedWidth(20)
        self.scrollBar.setToolTip('Follow Mode: Scroll the Editors together')
        self.scrollBar.hide()
        self.scrollBar.valueChanged[int].connect(self.move_follow_scrolls)

        #Add to Main Layout
        hbox.addWidget(self.scrollBar)
        hbox.addWidget(self._splitterArea)

    def insert_central_container(self, container):
        self.mainContainer = container
        self._splitterMain.insertWidget(0, container)

    def insert_lateral_container(self, container):
        self.lateralPanel = LateralPanel(container)
        self._splitterArea.insertWidget(0, self.lateralPanel)

    def insert_bottom_container(self, container):
        self.misc = container
        self._splitterMain.insertWidget(1, container)

    def showEvent(self, event):
        #Show Event
        QWidget.showEvent(self, event)
        #Avoid recalculate the panel sizes if they are already loaded
        if self._splitterArea.count() == 2:
            return
        #Rearrange widgets on Window
        self._splitterArea.insertWidget(0, self._splitterMain)
        if not event.spontaneous():
            self.change_misc_visibility()
        if bin(settings.UI_LAYOUT)[-1] == '1':
            self.splitter_central_rotate()
        if bin(settings.UI_LAYOUT >> 1)[-1] == '1':
            self.splitter_misc_rotate()
        if bin(settings.UI_LAYOUT >> 2)[-1] == '1':
            self.splitter_central_orientation()
        qsettings = QSettings(resources.SETTINGS_PATH, QSettings.IniFormat)
        #Lists of sizes as list of QVariant- heightList = [QVariant, QVariant]
        heightList = list(qsettings.value("window/central/mainSize",
            [(self.height() / 3) * 2, self.height() / 3]))
        widthList = list(qsettings.value("window/central/areaSize",
            [(self.width() / 6) * 5, self.width() / 6]))
        self._splitterMainSizes = [int(heightList[0]), int(heightList[1])]
        self._splitterAreaSizes = [int(widthList[0]), int(widthList[1])]
        #Set the sizes to splitters
        #self._splitterMain.setSizes(self._splitterMainSizes)
        self._splitterMain.setSizes(self._splitterMainSizes)
        self._splitterArea.setSizes(self._splitterAreaSizes)
        self.misc.setVisible(
            qsettings.value("window/show_misc", False, type=bool))

    def change_misc_visibility(self, on_start=False):
        if self.misc.isVisible():
            self._splitterMainSizes = self._splitterMain.sizes()
            self.misc.hide()
            widget = self.mainContainer.get_actual_widget()
            if widget:
                widget.setFocus()
        else:
            self.misc.show()
            self.misc.gain_focus()

    def change_main_visibility(self):
        if self.mainContainer.isVisible():
            self.mainContainer.hide()
        else:
            self.mainContainer.show()

    def change_explorer_visibility(self, force_hide=False):
        if self.lateralPanel.isVisible() or force_hide:
            self._splitterAreaSizes = self._splitterArea.sizes()
            self.lateralPanel.hide()
        else:
            self.lateralPanel.show()

    def splitter_central_rotate(self):
        w1, w2 = self._splitterArea.widget(0), self._splitterArea.widget(1)
        self._splitterArea.insertWidget(0, w2)
        self._splitterArea.insertWidget(1, w1)
        self.splitterCentralRotated.emit()

    def splitter_central_orientation(self):
        if self._splitterArea.orientation() == Qt.Horizontal:
            self._splitterArea.setOrientation(Qt.Vertical)
        else:
            self._splitterArea.setOrientation(Qt.Horizontal)

    def splitter_misc_rotate(self):
        w1, w2 = self._splitterMain.widget(0), self._splitterMain.widget(1)
        self._splitterMain.insertWidget(0, w2)
        self._splitterMain.insertWidget(1, w1)

    def splitter_misc_orientation(self):
        if self._splitterMain.orientation() == Qt.Horizontal:
            self._splitterMain.setOrientation(Qt.Vertical)
        else:
            self._splitterMain.setOrientation(Qt.Horizontal)

    def get_area_sizes(self):
        if self.lateralPanel.isVisible():
            self._splitterAreaSizes = self._splitterArea.sizes()
        return self._splitterAreaSizes

    def get_main_sizes(self):
        if self.misc.isVisible():
            self._splitterMainSizes = self._splitterMain.sizes()
        return self._splitterMainSizes

    def enable_follow_mode_scrollbar(self, val):
        if val:
            editorWidget = self.mainContainer.get_actual_editor()
            maxScroll = editorWidget.verticalScrollBar().maximum()
            position = editorWidget.verticalScrollBar().value()
            self.scrollBar.setMaximum(maxScroll)
            self.scrollBar.setValue(position)
        self.scrollBar.setVisible(val)

    def move_follow_scrolls(self, val):
        widget = self.mainContainer._tabMain.currentWidget()
        diff = widget._sidebarWidget.highest_line - val
        s1 = self.mainContainer._tabMain.currentWidget().verticalScrollBar()
        s2 = self.mainContainer._tabSecondary.\
            currentWidget().verticalScrollBar()
        s1.setValue(val)
        s2.setValue(val + diff)
Example #42
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setTitle(self.tr("Preview"))
        self.setMaximumHeight(220)
        self.setObjectName("groupBox")

        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setObjectName("verticalLayout")

        self.tabWidget = QTabWidget(self)
        self.tabWidget.setObjectName("tabWidgetPreview")

        self.tab = QWidget()
        self.tab.setObjectName("tab")

        self.horizontalLayout = QHBoxLayout(self.tab)
        self.horizontalLayout.setObjectName("horizontalLayout")

        self.groupBox = QGroupBox(self.tab)
        self.groupBox.setTitle(self.tr("Group Box"))
        self.groupBox.setObjectName("groupBox")


        self.verticalLayout_2 = QVBoxLayout(self.groupBox)
        self.verticalLayout_2.setObjectName("verticalLayout_2")

        self.radioButton = QRadioButton(self.groupBox)
        self.radioButton.setText(self.tr("Radio Button"))
        self.radioButton.setChecked(True)
        self.radioButton.setObjectName("radioButton")
        self.verticalLayout_2.addWidget(self.radioButton)

        self.radioButton_2 = QRadioButton(self.groupBox)
        self.radioButton_2.setText(self.tr("Radio Button"))
        self.radioButton_2.setObjectName("radioButton_2")
        self.verticalLayout_2.addWidget(self.radioButton_2)

        self.line = QFrame(self.groupBox)
        self.line.setFrameShape(QFrame.HLine)
        self.line.setFrameShadow(QFrame.Sunken)
        self.line.setObjectName("line")
        self.verticalLayout_2.addWidget(self.line)

        self.checkBox = QCheckBox(self.groupBox)
        self.checkBox.setText(self.tr("Check Box"))
        self.checkBox.setChecked(True)
        self.checkBox.setObjectName("checkBox")
        self.verticalLayout_2.addWidget(self.checkBox)

        self.horizontalLayout.addWidget(self.groupBox)


        self.verticalLayout_3 = QVBoxLayout()
        self.verticalLayout_3.setObjectName("verticalLayout_3")

        self.progressBar = QProgressBar(self.tab)
        self.progressBar.setProperty("value", 75)
        self.progressBar.setObjectName("progressBar")
        self.verticalLayout_3.addWidget(self.progressBar)

        self.horizontalSlider = QSlider(self.tab)
        self.horizontalSlider.setProperty("value", 45)
        self.horizontalSlider.setSliderPosition(45)
        self.horizontalSlider.setOrientation(Qt.Horizontal)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.verticalLayout_3.addWidget(self.horizontalSlider)

        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")

        self.spinBox = QSpinBox(self.tab)
        self.spinBox.setObjectName("spinBox")
        self.horizontalLayout_2.addWidget(self.spinBox)

        self.pushButton = QPushButton(self.tab)
        self.pushButton.setText(self.tr("Button"))
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout_2.addWidget(self.pushButton)

        self.verticalLayout_3.addLayout(self.horizontalLayout_2)

        self.comboBox = QComboBox(self.tab)
        self.comboBox.setObjectName("comboBox")
        self.comboBox.addItem(self.tr("Combo Box"))
        self.verticalLayout_3.addWidget(self.comboBox)

        self.horizontalLayout.addLayout(self.verticalLayout_3)

        self.verticalScrollBar = QScrollBar(self.tab)
        self.verticalScrollBar.setPageStep(50)
        self.verticalScrollBar.setOrientation(Qt.Vertical)
        self.verticalScrollBar.setObjectName("verticalScrollBar")
        self.horizontalLayout.addWidget(self.verticalScrollBar)
        self.tabWidget.addTab(self.tab, self.tr("Tab 1"))


        self.tab_2 = QWidget()
        self.tab_2.setObjectName("tab_2")
        self.tabWidget.addTab(self.tab_2, self.tr("Tab 2"))

        self.verticalLayout.addWidget(self.tabWidget)

        self.pushButton.installEventFilter(self)
        self.pushButton.setFocusPolicy(Qt.NoFocus)
        self.radioButton.installEventFilter(self)
        self.radioButton.setFocusPolicy(Qt.NoFocus)
        self.radioButton_2.installEventFilter(self)
        self.radioButton_2.setFocusPolicy(Qt.NoFocus)
        self.checkBox.installEventFilter(self)
        self.checkBox.setFocusPolicy(Qt.NoFocus)
        self.comboBox.installEventFilter(self)
        self.comboBox.setFocusPolicy(Qt.NoFocus)
        self.spinBox.installEventFilter(self)
        self.spinBox.setFocusPolicy(Qt.NoFocus)
        self.horizontalSlider.installEventFilter(self)
        self.horizontalSlider.setFocusPolicy(Qt.NoFocus)
        self.verticalScrollBar.installEventFilter(self)
        self.verticalScrollBar.setFocusPolicy(Qt.NoFocus)
        self.tab.installEventFilter(self)
        self.tab.setFocusPolicy(Qt.NoFocus)
        self.tab_2.installEventFilter(self)
        self.tab_2.setFocusPolicy(Qt.NoFocus)
        self.tabWidget.installEventFilter(self)
        self.tabWidget.setFocusPolicy(Qt.NoFocus)

        self.tabWidget.currentChanged.connect(self.noClick)