add time diff plugin
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from typing import Callable
|
||||
|
||||
from PySide6.QtGui import QAction, QIcon
|
||||
from PySide6.QtWidgets import QMenu
|
||||
from PySide6.QtWidgets import QMenu, QPushButton, QWidget
|
||||
|
||||
|
||||
class RAction():
|
||||
@@ -86,3 +86,20 @@ class RAction():
|
||||
self._update_check_state()
|
||||
|
||||
return action
|
||||
|
||||
def to_qpushbutton(self, parent: QWidget) -> QPushButton:
|
||||
button = QPushButton(parent)
|
||||
if self.label:
|
||||
button.setText(self.label)
|
||||
if self.icon_from_theme:
|
||||
button.setIcon(QIcon.fromTheme(self.icon_from_theme))
|
||||
if self.icon_file:
|
||||
button.setIcon(QIcon(self.icon_file))
|
||||
if self.shortcut:
|
||||
button.setShortcut(self.shortcut)
|
||||
if self.action:
|
||||
button.pressed.connect(self.action)
|
||||
if self.checkable:
|
||||
button.setChecked(self.checked)
|
||||
button.setCheckable(self.checkable)
|
||||
return button
|
||||
|
||||
Reference in New Issue
Block a user