Python qtpy.QtCore.Slot() Examples
The following are 5
code examples of qtpy.QtCore.Slot().
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.QtCore
, or try the search function
.
Example #1
Source File: actions.py From Pyslvs-UI with GNU Affero General Public License v3.0 | 6 votes |
def __enable_point_context(self) -> None: """Adjust the status of QActions. What ever we have least one point or not, need to enable / disable QAction. """ selection = self.entities_point.selected_rows() # Set grounded state if selection: self.action_p_lock.setChecked(all( VLink.FRAME in self.vpoint_list[row].links for row in selection )) self.context.point_enable(len(selection)) def mj_func(order: int) -> Callable[[], None]: """Generate a merge function.""" @Slot() def func() -> None: self.__to_multiple_joint(order, selection) return func for i, p in enumerate(selection): action = QAction(f"Base on Point{p}", self) action.triggered.connect(mj_func(i)) self.pop_point_m.addAction(action)
Example #2
Source File: actions.py From Pyslvs-UI with GNU Affero General Public License v3.0 | 6 votes |
def __enable_link_context(self) -> None: """Enable / disable link's QAction, same as point table.""" selection = self.entities_link.selected_rows() row = self.entities_link.currentRow() self.context.link_enable(len(selection), row) def ml_func(order: int) -> Callable[[], None]: """Generate a merge function.""" @Slot(int) def func() -> None: self.__merge_link(order, selection) return func for i, row in enumerate(selection): action = QAction(f"Base on \"{self.vlink_list[row].name}\"", self) action.triggered.connect(ml_func(i)) self.pop_link_m.addAction(action)
Example #3
Source File: main_base.py From Pyslvs-UI with GNU Affero General Public License v3.0 | 6 votes |
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 #4
Source File: tables.py From Pyslvs-UI with GNU Affero General Public License v3.0 | 6 votes |
def __init__(self, row: int, parent: QWidget): super(BaseTableWidget, self).__init__(parent) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.setStatusTip("This table will show about the entities items in " "current view mode.") self.setEditTriggers(QAbstractItemView.NoEditTriggers) self.setSelectionBehavior(QAbstractItemView.SelectRows) self.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel) self.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel) self.setRowCount(row) self.setColumnCount(len(self.headers)) for i, e in enumerate(self.headers): self.setHorizontalHeaderItem(i, QTableWidgetItem(e)) # Table widget column width. header = self.horizontalHeader() header.setSectionResizeMode(QHeaderView.ResizeToContents) @Slot() def emit_selection_changed() -> None: self.row_selection_changed.emit(self.selected_rows()) self.itemSelectionChanged.connect(emit_selection_changed)
Example #5
Source File: main_base.py From Pyslvs-UI with GNU Affero General Public License v3.0 | 5 votes |
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)