Python qtpy.QtGui.QIcon() Examples

The following are 30 code examples of qtpy.QtGui.QIcon(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module qtpy.QtGui , or try the search function .
Example #1
Source File: __init__.py    From Pyslvs-UI with GNU Affero General Public License v3.0 6 votes vote down vote up
def __add_result(self, result: Mapping[str, Any]) -> None:
        """Add result items, except add to the list."""
        item = QListWidgetItem(result['algorithm'])
        interrupt = result['interrupted']
        if interrupt == 'False':
            interrupt_icon = "task_completed.png"
        elif interrupt == 'N/A':
            interrupt_icon = "question.png"
        else:
            interrupt_icon = "interrupted.png"
        item.setIcon(QIcon(QPixmap(f":/icons/{interrupt_icon}")))
        if interrupt == 'False':
            interrupt_text = "No interrupt."
        else:
            interrupt_text = f"Interrupt at: {interrupt}"
        text = f"{result['algorithm']} ({interrupt_text})"
        if interrupt == 'N/A':
            text += "\n※Completeness is unknown."
        item.setToolTip(text)
        self.result_list.addItem(item) 
Example #2
Source File: SubmitChangeWindow.py    From P4VFX with MIT License 6 votes vote down vote up
def create(self, p4, files=[]):
        self.p4 = p4

        path = interop.getIconPath() + "p4.png"
        icon = QtGui.QIcon(path)

        self.setWindowTitle("Submit Change")
        self.setWindowIcon(icon)
        self.setWindowFlags(QtCore.Qt.Window)

        self.fileList = files

        self.create_controls()
        self.create_layout()
        self.create_connections()

        self.validateText() 
Example #3
Source File: output_option.py    From Pyslvs-UI with GNU Affero General Public License v3.0 6 votes vote down vote up
def __init__(
        self,
        env: str,
        file_name: str,
        vpoints: Sequence[VPoint],
        v_to_slvs: Callable[[], Iterable[Tuple[int, int]]],
        parent: QWidget
    ):
        """Comes in environment variable and project name."""
        super(OutputDialog, self).__init__(parent)
        self.setupUi(self)
        self.setWindowFlags(self.windowFlags()
                            & ~Qt.WindowContextHelpButtonHint)
        self.setWindowTitle(f"Export {self.format_name} module project")
        self.setWindowIcon(QIcon(QPixmap(f":/icons/{self.format_icon}")))
        self.assembly_label.setText(self.assembly_description)
        self.frame_label.setText(self.frame_description)
        self.path_edit.setPlaceholderText(env)
        self.filename_edit.setPlaceholderText(file_name)
        self.vpoints = vpoints
        self.v_to_slvs = v_to_slvs 
Example #4
Source File: SubmitChangeWindow.py    From P4VFX with MIT License 6 votes vote down vote up
def create(self, p4, files=[]):
        self.p4 = p4

        path = interop.getIconPath() + "p4.png"
        icon = QtGui.QIcon(path)

        self.setWindowTitle("Submit Change")
        self.setWindowIcon(icon)
        self.setWindowFlags(QtCore.Qt.Window)

        self.fileList = files

        self.create_controls()
        self.create_layout()
        self.create_connections()

        self.validateText() 
Example #5
Source File: main_base.py    From Pyslvs-UI with GNU Affero General Public License v3.0 6 votes vote down vote up
def __alignment(self) -> None:
        """Menu of alignment function."""

        def switch_icon(m: int, icon_name: str) -> Callable[[], None]:
            @Slot()
            def func() -> None:
                self.alignment_mode = m
                self.alignment_button.setIcon(QIcon(QPixmap(icon_name)))

            return func

        menu = QMenu(self)
        for i, (text, icon) in enumerate([
            ("Vertical alignment", "vertical_align"),
            ("Horizontal alignment", "horizontal_align"),
        ]):
            icon = f":/icons/{icon}.png"
            action = QAction(QIcon(QPixmap(icon)), text, self)
            action.triggered.connect(switch_icon(i, icon))
            menu.addAction(action)
        self.alignment_button.setMenu(menu)
        self.alignment_button.clicked.connect(self.point_alignment) 
Example #6
Source File: main_base.py    From Pyslvs-UI with GNU Affero General Public License v3.0 6 votes vote down vote up
def __undo_redo(self) -> None:
        """Undo list settings.

        + Undo stack.
        + Undo view widget.
        + Hot keys.
        """
        self.command_stack = QUndoStack(self)
        self.command_stack.setUndoLimit(self.prefer.undo_limit_option)
        self.command_stack.indexChanged.connect(self.command_reload)
        action_redo = self.command_stack.createRedoAction(self, "Redo")
        action_undo = self.command_stack.createUndoAction(self, "Undo")
        action_redo.setShortcuts(["Ctrl+Shift+Z", "Ctrl+Y"])
        action_redo.setStatusTip("Backtracking undo action.")
        action_redo.setIcon(QIcon(QPixmap(":/icons/redo.png")))
        action_undo.setShortcut("Ctrl+Z")
        action_undo.setStatusTip("Recover last action.")
        action_undo.setIcon(QIcon(QPixmap(":/icons/undo.png")))
        self.menu_edit.addActions([action_undo, action_redo]) 
Example #7
Source File: main_base.py    From Pyslvs-UI with GNU Affero General Public License v3.0 5 votes vote down vote up
def __free_move(self) -> None:
        """Menu of free move mode."""

        def free_move_mode_func(j: int, icon_qt: QIcon) -> Callable[[], None]:
            @Slot()
            def func() -> None:
                self.free_move_button.setIcon(icon_qt)
                self.main_canvas.set_free_move(j)
                self.entities_tab.setCurrentIndex(0)
                self.inputs_widget.variable_stop.click()

            return func

        menu = QMenu(self)
        for i, (text, icon, tip) in enumerate([
            ("View mode", "free_move_off", "Disable free move mode."),
            ("Translate mode", "translate", "Edit by 2 DOF moving."),
            ("Rotate mode", "rotate", "Edit by 1 DOF moving."),
            ("Reflect mode", "reflect", "Edit by flip axis."),
        ]):
            action = QAction(QIcon(QPixmap(f":/icons/{icon}.png")), text, self)
            action.triggered.connect(free_move_mode_func(i, action.icon()))
            action.setShortcut(f"Ctrl+{i + 1}")
            action.setShortcutContext(Qt.WindowShortcut)
            action.setStatusTip(tip)
            menu.addAction(action)
            if i == 0:
                self.free_move_disable = action
        self.free_move_button.setMenu(menu) 
Example #8
Source File: wfile.py    From pyCGNS with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self):
        super(Q7FileIconProvider, self).__init__()
        self.dir = QIcon(QPixmap(":/images/icons/folder.png"))
        self.cgns = QIcon(QPixmap(":/images/icons/tree-load.png"))
        self.empty = QIcon() 
Example #9
Source File: __init__.py    From Pyslvs-UI with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: MainWindowBase):
        """Create two widget page and using main window to make their parent."""
        super(Collections, self).__init__(parent)
        layout = QVBoxLayout(self)
        self.tab_widget = QTabWidget(self)
        layout.addWidget(self.tab_widget)
        self.setWindowIcon(QIcon(QPixmap(":/icons/collections.png")))
        self.structure_widget = StructureWidget(parent)
        self.configure_widget = ConfigureWidget(
            self.structure_widget.add_collection,
            parent
        )
        self.tab_widget.addTab(
            self.structure_widget,
            self.structure_widget.windowIcon(),
            "Structures"
        )
        self.tab_widget.addTab(
            self.configure_widget,
            self.configure_widget.windowIcon(),
            "Configuration"
        )
        self.structure_widget.configure_button.clicked.connect(
            lambda: self.tab_widget.setCurrentIndex(1)
        )
        self.structure_widget.layout_sender.connect(
            self.configure_widget.set_graph
        ) 
Example #10
Source File: color.py    From Pyslvs-UI with GNU Affero General Public License v3.0 5 votes vote down vote up
def color_icon(name: str, size: int = 20) -> QIcon:
    """Get color block as QIcon by name."""
    color_block = QPixmap(QSize(size, size))
    color_block.fill(color_qt(name))
    return QIcon(color_block)


# Target path color: (line, dot) 
Example #11
Source File: edit_link.py    From Pyslvs-UI with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(
        self,
        vpoints: List[VPoint],
        vlinks: List[VLink],
        row: Union[int, bool],
        parent: QWidget
    ):
        """Input data reference from main window.

        + Needs VPoints and VLinks information.
        + If row is false: Create action.
        """
        super(EditLinkDialog, self).__init__(parent)
        self.setupUi(self)
        self.setWindowFlags(self.windowFlags()
                            & ~Qt.WindowContextHelpButtonHint)
        self.vpoints = vpoints
        self.vlinks = vlinks
        icon = self.windowIcon()
        self.icon = QIcon(QPixmap(":/icons/bearing.png"))
        for i, e in enumerate(color_names):
            self.color_box.insertItem(i, color_icon(e), e)
        for i in range(len(self.vpoints)):
            self.no_selected.addItem(QListWidgetItem(self.icon, f'Point{i}'))
        if row is False:
            names = {vlink.name for vlink in self.vlinks}
            n = 1
            name = f"link_{n}"
            while name in names:
                n += 1
                name = f"link_{n}"
            self.name_edit.setText(name)
            self.name_box.setEnabled(False)
            self.name_box.addItem(icon, "New link")
            self.color_box.setCurrentIndex(self.color_box.findText('blue'))
        else:
            for i, vlink in enumerate(self.vlinks):
                self.name_box.insertItem(i, icon, vlink.name)
            self.name_box.setCurrentIndex(row)
        self.name_edit.textChanged.connect(self.__is_ok)
        self.__is_ok() 
Example #12
Source File: edit_point.py    From Pyslvs-UI with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(
        self,
        vpoints: List[VPoint],
        vlinks: List[VLink],
        pos: Union[int, bool],
        parent: QWidget
    ):
        """Input data reference from main window.

        + Needs VPoints and VLinks information.
        + If row is false: Create action.
        """
        super(EditPointDialog, self).__init__(parent)
        self.setupUi(self)
        self.setWindowFlags(self.windowFlags()
                            & ~Qt.WindowContextHelpButtonHint)
        icon = self.windowIcon()
        self.icon = QIcon(QPixmap(":/icons/link.png"))
        self.vpoints = vpoints
        self.vlinks = vlinks
        vpoints_count = len(vpoints)
        for i, e in enumerate(color_names):
            self.color_box.insertItem(i, color_icon(e), e)
        for vlink in vlinks:
            self.no_selected.addItem(QListWidgetItem(self.icon, vlink.name))
        if pos is False:
            self.name_box.addItem(icon, f'Point{vpoints_count}')
            self.name_box.setEnabled(False)
            self.color_box.setCurrentIndex(self.color_box.findText('green'))
        else:
            for i in range(vpoints_count):
                self.name_box.insertItem(i, icon, f'Point{i}')
            self.name_box.setCurrentIndex(pos)
        self.type_box.currentIndexChanged.connect(self.__check_angle)
        self.__check_angle() 
Example #13
Source File: undo_redo.py    From Pyslvs-UI with GNU Affero General Public License v3.0 5 votes vote down vote up
def undo(self) -> None:
        """Create a new item and recover expression."""
        item = QListWidgetItem(self.name)
        item.expr = self.mechanism
        item.setIcon(QIcon(QPixmap(":/icons/mechanism.png")))
        self.widget.insertItem(self.row, item) 
Example #14
Source File: DepotClientViewModel.py    From P4VFX with MIT License 5 votes vote down vote up
def data(self, index, role):
        column = index.column()
        if not index.isValid():
            return None
        if role == QtCore.Qt.DisplayRole:
            item = index.internalPointer()
            return item.data[column]
        elif role == QtCore.Qt.SizeHintRole:
            return QtCore.QSize(20, 20)
        elif role == QtCore.Qt.DecorationRole:
            if column == 1:
                itemType = index.internalPointer().data[column]
                isDeleted = index.internalPointer().data[3] == 'delete'

                if isDeleted:
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0104.png'))

                # Try to figure out which icon is most applicable to the item
                if itemType == "Folder":
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0059.png'))
                elif "binary" in itemType:
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0315.png'))
                elif "text" in itemType:
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0027.png'))
                else:
                    return QtGui.QIcon(os.path.join(interop.getIconPath(), 'File0106.png'))
            else:
                return None

        return None 
Example #15
Source File: script_ui.py    From Pyslvs-UI with GNU Affero General Public License v3.0 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.setEnabled(True)
        Dialog.resize(533, 564)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/script.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        Dialog.setAutoFillBackground(True)
        Dialog.setSizeGripEnabled(True)
        Dialog.setModal(True)
        self.main_layout = QtWidgets.QVBoxLayout(Dialog)
        self.main_layout.setObjectName("main_layout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.show_qrcode = QtWidgets.QPushButton(Dialog)
        self.show_qrcode.setAutoDefault(False)
        self.show_qrcode.setObjectName("show_qrcode")
        self.horizontalLayout.addWidget(self.show_qrcode)
        self.copy_button = QtWidgets.QPushButton(Dialog)
        self.copy_button.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        self.copy_button.setAutoDefault(False)
        self.copy_button.setObjectName("copy_button")
        self.horizontalLayout.addWidget(self.copy_button)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.button_box = QtWidgets.QDialogButtonBox(Dialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.button_box.sizePolicy().hasHeightForWidth())
        self.button_box.setSizePolicy(sizePolicy)
        self.button_box.setOrientation(QtCore.Qt.Horizontal)
        self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save)
        self.button_box.setObjectName("button_box")
        self.horizontalLayout.addWidget(self.button_box)
        self.main_layout.addLayout(self.horizontalLayout)

        self.retranslateUi(Dialog)
        self.button_box.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example #16
Source File: qtconsoleapp.py    From qtconsole with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def init_qt_elements(self):
        # Create the widget.

        base_path = os.path.abspath(os.path.dirname(__file__))
        icon_path = os.path.join(base_path, 'resources', 'icon', 'JupyterConsole.svg')
        self.app.icon = QtGui.QIcon(icon_path)
        QtWidgets.QApplication.setWindowIcon(self.app.icon)

        ip = self.ip
        local_kernel = (not self.existing) or is_local_ip(ip)
        self.widget = self.widget_factory(config=self.config,
                                        local_kernel=local_kernel)
        self.init_colors(self.widget)
        self.widget._existing = self.existing
        self.widget._may_close = not self.existing
        self.widget._confirm_exit = self.confirm_exit
        self.widget._display_banner = self.display_banner

        self.widget.kernel_manager = self.kernel_manager
        self.widget.kernel_client = self.kernel_client
        self.window = MainWindow(self.app,
                                confirm_exit=self.confirm_exit,
                                new_frontend_factory=self.new_frontend_master,
                                slave_frontend_factory=self.new_frontend_slave,
                                connection_frontend_factory=self.new_frontend_connection,
                                )
        self.window.log = self.log
        self.window.add_tab_with_frontend(self.widget)
        self.window.init_menu_bar()

        # Ignore on OSX, where there is always a menu bar
        if sys.platform != 'darwin' and self.hide_menubar:
            self.window.menuBar().setVisible(False)

        self.window.setWindowTitle('Jupyter QtConsole') 
Example #17
Source File: condapackages.py    From conda-manager with MIT License 5 votes vote down vote up
def get_plugin_icon(self):
        """Return widget icon"""
        return QIcon(images.PATH_CONDA_LOGO) 
Example #18
Source File: __init__.py    From conda-manager with MIT License 5 votes vote down vote up
def get_icon(filename):
    """ """
    icon = get_image_path(filename)
    if icon:
        return QIcon(icon)
    else:
        return QIcon() 
Example #19
Source File: channels.py    From conda-manager with MIT License 5 votes vote down vote up
def _url_validated(self, worker, valid, error):
        item = worker.item
        channel = item.data(Qt.DisplayRole).strip().lower()
        channel = worker.url

        if valid:
            temp = list(self._temp_channels)
            temp.append(channel)
            self._temp_channels = tuple(temp)
            item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled |
                          Qt.ItemIsSelectable)
            item.setCheckState(Qt.Checked)
            item.setData(Qt.DisplayRole, channel)
            item.setData(Qt.DecorationRole, QIcon())
        else:
            item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled |
                          Qt.ItemIsSelectable | Qt.ItemIsEditable)
            item.setData(Qt.DisplayRole, channel)
            item.setCheckState(Qt.Unchecked)
            item.setIcon(qta.icon('fa.warning'))
            item.setToolTip("The channel seems to be invalid.")
            self.list.editItem(item)

        self.list.itemChanged.connect(self.edit_channel)
        self.button_add.setDisabled(False)
        self.button_delete.setDisabled(False) 
Example #20
Source File: search.py    From conda-manager with MIT License 5 votes vote down vote up
def __init__(self, parent=None, icon=True):
        super(SearchLineEdit, self).__init__(parent)
        self.setTextMargins(1, 0, 20, 0)

        if icon:
            self.setTextMargins(18, 0, 20, 0)
            self._label = QLabel(self)
            self._pixmap_icon = QPixmap(get_image_path('conda_search.png'))
            self._label.setPixmap(self._pixmap_icon)
            self._label.setStyleSheet('''border: 0px; padding-bottom: 0px;
                                      padding-left: 2px;''')

        self._pixmap = QPixmap(get_image_path('conda_del.png'))
        self.button_clear = QToolButton(self)
        self.button_clear.setIcon(QIcon(self._pixmap))
        self.button_clear.setIconSize(QSize(18, 18))
        self.button_clear.setCursor(Qt.ArrowCursor)
        self.button_clear.setStyleSheet("""QToolButton
            {background: transparent;
            padding-right: 2px; border: none; margin:0px; }""")
        self.button_clear.setVisible(False)

        # Layout
        self._layout = QHBoxLayout(self)
        self._layout.addWidget(self.button_clear, 0, Qt.AlignRight)
        self._layout.setSpacing(0)
        self._layout.setContentsMargins(0, 2, 2, 0)

        # Signals and slots
        self.button_clear.clicked.connect(self.clear_text)
        self.textChanged.connect(self._toggle_visibility)
        self.textEdited.connect(self._toggle_visibility) 
Example #21
Source File: tools.py    From glue-vispy-viewers with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def set_icon(self, icon):
        self.viewer.toolbar.actions[self.tool_id].setIcon(QtGui.QIcon(icon)) 
Example #22
Source File: OpenedFilesWindow.py    From P4VFX with MIT License 5 votes vote down vote up
def create_controls(self):
        '''
        Create the widgets for the dialog
        '''
        headers = ["File", "Type", "Action", "User", "Folder"]

        self.tableWidget = QtWidgets.QTableWidget(0, len(headers))
        self.tableWidget.setMaximumHeight(200)
        self.tableWidget.setMinimumWidth(500)
        self.tableWidget.setHorizontalHeaderLabels(headers)
        self.tableWidget.setSelectionBehavior(
            QtWidgets.QAbstractItemView.SelectRows)
        self.tableWidget.setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection)


        self.openSelectedBtn = QtWidgets.QPushButton("Open")
        self.openSelectedBtn.setEnabled(False)
        self.openSelectedBtn.setIcon(QtGui.QIcon(
            os.path.join(interop.getIconPath(), "File0228.png")))

        self.revertFileBtn = QtWidgets.QPushButton("Remove from changelist")
        self.revertFileBtn.setEnabled(False)
        self.revertFileBtn.setIcon(QtGui.QIcon(
            os.path.join(interop.getIconPath(), "File0308.png")))

        self.refreshBtn = QtWidgets.QPushButton("Refresh")
        self.refreshBtn.setIcon(QtGui.QIcon(
            os.path.join(interop.getIconPath(), "File0175.png")))

        self.updateTable() 
Example #23
Source File: uiQt.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def createQApp():
    """创建PyQt应用对象"""
    # 创建Qt应用对象
    qApp = QtWidgets.QApplication([])

    # 设置Qt的皮肤
    if globalSetting['darkStyle']:
        try:
            import qdarkstyle
            qApp.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
        except :
            print("Unexpected error when import darkStyle:", sys.exc_info()[0])

    # 设置Windows底部任务栏图标
    if 'Windows' in platform.uname():
        import ctypes
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('vn.trader')

    # 设置Qt字体
    qApp.setFont(BASIC_FONT)

    # 设置Qt图标
    qApp.setWindowIcon(QtGui.QIcon(loadIconPath('vnpy.ico')))

    # 返回创建好的QApp对象
    return qApp 
Example #24
Source File: __main__.py    From cutelog with MIT License 5 votes vote down vote up
def main():
    import signal
    from .config import ROOT_LOG
    from .main_window import MainWindow
    from .resources import qCleanupResources
    from qtpy.QtGui import QIcon
    from qtpy.QtWidgets import QApplication

    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon(':/cutelog.png'))
    mw = MainWindow(ROOT_LOG, app)
    signal.signal(signal.SIGINT, mw.signal_handler)

    sys.exit(app.exec_())
    qCleanupResources() 
Example #25
Source File: QComplexWidgets.py    From pylustrator with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, axis: str, signal_target_changed: QtCore.Signal):
        """ A widget to change the tick properties

        Args:
            axis: whether to use the "x" or "y" axis
            signal_target_changed: a signal to emit when the target changed
        """
        QtWidgets.QWidget.__init__(self)
        self.setWindowTitle("Figure - " + axis + "-Axis - Ticks - Pylustrator")
        self.setWindowIcon(QtGui.QIcon(os.path.join(os.path.dirname(__file__), "icons", "ticks.ico")))
        self.layout = QtWidgets.QVBoxLayout(self)
        self.axis = axis

        self.label = QtWidgets.QLabel(
            "Ticks can be specified, one tick pre line.\nOptionally a label can be provided, e.g. 1 \"First\",")
        self.layout.addWidget(self.label)

        self.layout2 = QtWidgets.QHBoxLayout()
        self.layout.addLayout(self.layout2)

        self.input_ticks = TextWidget(self.layout2, axis + "-Ticks:", multiline=True, horizontal=False)
        self.input_ticks.editingFinished.connect(self.ticksChanged)

        self.input_ticks2 = TextWidget(self.layout2, axis + "-Ticks (minor):", multiline=True, horizontal=False)
        self.input_ticks2.editingFinished.connect(self.ticksChanged2)

        self.input_scale = ComboWidget(self.layout, axis + "-Scale", ["linear", "log", "symlog", "logit"])
        self.input_scale.link(axis + "scale", signal_target_changed)

        self.input_font = TextPropertiesWidget(self.layout)

        self.input_labelpad = NumberWidget(self.layout, axis + "-Labelpad", min=-999)
        self.input_labelpad.link(axis + "axis.labelpad", signal_target_changed, direct=True)

        self.button_ok = QtWidgets.QPushButton("Ok")
        self.layout.addWidget(self.button_ok)
        self.button_ok.clicked.connect(self.hide) 
Example #26
Source File: QComplexWidgets.py    From pylustrator with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, layout: QtWidgets.QLayout, axis: str, signal_target_changed: QtCore.Signal):
        """ a widget to change the properties of an axes (label, limits)

        Args:
            layout: the layout to which to add this widget
            axis: whether to use "x" or the "y" axis
            signal_target_changed: the signal when a target changed
        """
        QtWidgets.QWidget.__init__(self)
        layout.addWidget(self)
        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.targetChanged = signal_target_changed
        self.targetChanged.connect(self.setTarget)

        self.input_label = TextWidget(self.layout, axis + "-Label:")

        def wrapTargetLabel(axis_object):
            try:
                target = getattr(getattr(axis_object, f"get_{axis}axis")(), "get_label")()
            except AttributeError:
                target = None
            self.targetChanged_wrapped.emit(target)

        self.targetChanged.connect(wrapTargetLabel)
        self.input_label.link("text", signal=self.targetChanged_wrapped)

        self.input_lim = DimensionsWidget(self.layout, axis + "-Lim:", "-", "", free=True)
        self.input_lim.link(axis + "lim", signal=self.targetChanged)

        self.button_ticks = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(os.path.dirname(__file__), "icons", "ticks.ico")), "")
        self.button_ticks.clicked.connect(self.showTickWidget)
        self.layout.addWidget(self.button_ticks)

        self.tick_edit = QTickEdit(axis, signal_target_changed) 
Example #27
Source File: QComplexWidgets.py    From pylustrator with GNU General Public License v3.0 5 votes vote down vote up
def icon(self, name: str):
        """ get an icon with the given filename """
        pm = QtGui.QPixmap(os.path.join(os.path.dirname(__file__), "icons", name))
        if hasattr(pm, 'setDevicePixelRatio'):
            pm.setDevicePixelRatio(self.canvas._dpi_ratio)
        return QtGui.QIcon(pm) 
Example #28
Source File: SubmitProgressWindow.py    From P4VFX with MIT License 5 votes vote down vote up
def create(self, title, files=[]):
        path = interop.getIconPath() + "p4.png"
        icon = QtGui.QIcon(path)

        self.setWindowTitle(title)
        self.setWindowIcon(icon)
        self.setWindowFlags(QtCore.Qt.Dialog)

        self.create_controls()
        self.create_layout()
        self.create_connections() 
Example #29
Source File: FileRevisionWindow.py    From P4VFX with MIT License 5 votes vote down vote up
def __init__(self, p4, parent=None):
        super(BaseRevisionTab, self).__init__(parent)

        self.p4 = p4

        path = os.path.join(interop.getIconPath(), "p4.png")
        icon = QtGui.QIcon(path)

        self.setWindowTitle("File Revisions")
        self.setWindowIcon(icon)
        self.setWindowFlags(QtCore.Qt.Window)

        self.fileRevisions = [] 
Example #30
Source File: FileRevisionWindow.py    From P4VFX with MIT License 5 votes vote down vote up
def __init__(self, p4, parent=None):
        super(FileRevisionUI, self).__init__(parent)

        self.p4 = p4

        path = os.path.join(interop.getIconPath(), "p4.png")
        icon = QtGui.QIcon(path)

        self.setWindowTitle("File Revisions")
        self.setWindowIcon(icon)
        self.setWindowFlags(QtCore.Qt.Window)

        self.fileRevisions = []