本文整理汇总了Python中actions.Actions.load方法的典型用法代码示例。如果您正苦于以下问题:Python Actions.load方法的具体用法?Python Actions.load怎么用?Python Actions.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类actions.Actions
的用法示例。
在下文中一共展示了Actions.load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Editor
# 需要导入模块: from actions import Actions [as 别名]
# 或者: from actions.Actions import load [as 别名]
class Editor(QMainWindow):
def __init__(self, fileName=None, parent=None):
super(Editor, self).__init__(parent)
self.setWindowIcon(QIcon(':/images/logo.png'))
self.setToolButtonStyle(Qt.ToolButtonFollowStyle)
self.textEdit = QTextEdit(self)
self.commands = Actions(parent=self)
# Setup Menu and Toolbar
self.setupFileActions()
self.setupEditActions()
self.setupFormatActions()
self.setupI18nActions()
self.setupHelpActions()
self.setupNavDock()
self.commands.init()
self.setCentralWidget(self.textEdit)
self.setWindowModified(self.textEdit.document().isModified())
QApplication.clipboard().dataChanged.connect(
self.commands.clipboardDataChanged)
i18n = QSettings()
if i18n.value("lang").toString() == "zh_CN":
self.actionChinese.setChecked(True)
else:
self.actionEnglish.setChecked(True)
if fileName is None:
fileName = ':/example.html'
if not self.commands.load(fileName):
self.commands.fileNew()
def setupFileActions(self):
tb = QToolBar(self)
tb.setWindowTitle(self.tr("File Actions"))
self.addToolBar(tb)
tb.setIconSize(QSize(48, 48))
menu = QMenu(self.tr("&File"), self)
self.menuBar().addMenu(menu)
self.actionNew = QAction(
QIcon.fromTheme('document-new',
QIcon(':/images/document-new.png')),
self.tr("&New"), self, priority=QAction.LowPriority,
shortcut=QKeySequence.New, triggered=self.commands.fileNew)
tb.addAction(self.actionNew)
menu.addAction(self.actionNew)
self.actionOpen = QAction(
QIcon.fromTheme('document-open',
QIcon(':/images/document-open.png')),
self.tr("&Open..."), self, shortcut=QKeySequence.Open,
triggered=self.commands.fileOpen)
tb.addAction(self.actionOpen)
menu.addAction(self.actionOpen)
menu.addSeparator()
self.actionSave = QAction(
QIcon.fromTheme('document-save',
QIcon(':/images/document-save.png')),
self.tr("&Save"), self, shortcut=QKeySequence.Save,
triggered=self.commands.fileSave, enabled=self.textEdit.document().isModified())
tb.addAction(self.actionSave)
menu.addAction(self.actionSave)
self.actionSaveAs = QAction(
QIcon.fromTheme('document-save-as',
QIcon(':/images/document-save-as.png')),
self.tr("Save &As..."), self,
priority=QAction.LowPriority,
shortcut=Qt.CTRL + Qt.SHIFT + Qt.Key_S,
triggered=self.commands.fileSaveAs)
tb.addAction(self.actionSaveAs)
menu.addAction(self.actionSaveAs)
menu.addSeparator()
self.actionPrintPdf = QAction(
QIcon(':/images/gnome-mime-application-pdf.png'),
self.tr("&Export PDF..."), self, priority=QAction.LowPriority,
shortcut=Qt.CTRL + Qt.Key_D,
triggered=self.commands.filePrintPdf)
tb.addAction(self.actionPrintPdf)
menu.addAction(self.actionPrintPdf)
menu.addSeparator()
self.actionQuit = QAction(self.tr("&Quit"), self,
shortcut=QKeySequence.Quit, triggered=self.close)
menu.addAction(self.actionQuit)
def setupEditActions(self):
tb = QToolBar(self)
tb.setWindowTitle(self.tr("Edit Actions"))
self.addToolBar(tb)
#.........这里部分代码省略.........