本文整理汇总了Python中actions.Actions.init方法的典型用法代码示例。如果您正苦于以下问题:Python Actions.init方法的具体用法?Python Actions.init怎么用?Python Actions.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类actions.Actions
的用法示例。
在下文中一共展示了Actions.init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Editor
# 需要导入模块: from actions import Actions [as 别名]
# 或者: from actions.Actions import init [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)
#.........这里部分代码省略.........
示例2:
# 需要导入模块: from actions import Actions [as 别名]
# 或者: from actions.Actions import init [as 别名]
parser.print_help()
else:
if collection:
act.create_result(collection, criteria)
elif args.action == 'dnstree':
if db:
act.dnstree(db)
elif args.action == 'crawl' and args.domains:
if db:
act.crawl(args.domains)
elif args.action == 'cleandb':
if db and filters:
act.clean_db(filters)
elif args.action == 'screenshots':
if db and args.threadpool:
act.screenshots(db, args.threadpool)
else:
parser.print_help()
elif args.action == 'init':
if db and attr and collection:
act.init(db, collection, attr)
else:
parser.print_help()
elif args.action == 'nmap':
if args.nmap_options or args.range:
act.scan_nmap(args.range, args.nmap_options)
else:
parser.print_help()
sys.exit(1)
示例3:
# 需要导入模块: from actions import Actions [as 别名]
# 或者: from actions.Actions import init [as 别名]
elif args.action=='metadata':
act.metadata_exctract()
elif args.action == 'create_result':
if not criteria and not db:
parser.print_help()
else:
if collection:
act.create_result(collection,criteria)
elif args.action =='dnstree':
if db:
act.dnstree()
elif args.action =='crawl':
if db:
act.crawl()
elif args.action =='cleandb':
if db and filters:
act.clean_db(filters)
elif args.action == 'screenshots':
if db and args.threadpool:
act.screenshots(args.threadpool)
else:
parser.print_help()
elif args.action == 'init':
if db and attr and collection:
act.init(collection, attr)
else:
parser.print_help()
else:
parser.print_help()
sys.exit(1)