本文整理汇总了Python中ninja_ide.resources.get_shortcut函数的典型用法代码示例。如果您正苦于以下问题:Python get_shortcut函数的具体用法?Python get_shortcut怎么用?Python get_shortcut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_shortcut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, explorer):
QWidget.__init__(self)
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
vbox.addWidget(explorer)
hbox = QHBoxLayout()
hbox.setContentsMargins(0, 0, 0, 0)
self.labelText = "Ln: %s, Col: %s"
self.labelCursorPosition = QLabel(self.trUtf8(self.labelText % (0, 0)))
hbox.addWidget(self.labelCursorPosition)
self.combo = QComboBox()
ui_tools.ComboBoxButton(self.combo, self.combo.clear, self.style().standardPixmap(self.style().SP_TrashIcon))
self.combo.setToolTip(
self.trUtf8(
"Select the item from the Paste "
"Historial list.\nYou can Copy items into this list with: "
"%s\nor Paste them using: %s"
% (
resources.get_shortcut("History-Copy").toString(QKeySequence.NativeText),
resources.get_shortcut("History-Paste").toString(QKeySequence.NativeText),
)
)
)
self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
hbox.addWidget(self.combo)
vbox.addLayout(hbox)
示例2: __init__
def __init__(self, parent=None):
super(SearchWidget, self).__init__(parent)
hSearch = QHBoxLayout(self)
hSearch.setContentsMargins(0, 0, 0, 0)
self._checkSensitive = QCheckBox(translations.TR_SEARCH_CASE_SENSITIVE)
self._checkWholeWord = QCheckBox(translations.TR_SEARCH_WHOLE_WORDS)
self._line = TextLine(self)
self._line.setMinimumWidth(250)
self._btnClose = QPushButton(
self.style().standardIcon(QStyle.SP_DialogCloseButton), '')
self._btnClose.setIconSize(QSize(16, 16))
self._btnFind = QPushButton(QIcon(":img/find"), '')
self._btnFind.setIconSize(QSize(16, 16))
self.btnPrevious = QPushButton(
self.style().standardIcon(QStyle.SP_ArrowLeft), '')
self.btnPrevious.setIconSize(QSize(16, 16))
self.btnPrevious.setToolTip(
self.trUtf8("Press %s") %
resources.get_shortcut("Find-previous").toString(
QKeySequence.NativeText))
self.btnNext = QPushButton(
self.style().standardIcon(QStyle.SP_ArrowRight), '')
self.btnNext.setIconSize(QSize(16, 16))
self.btnNext.setToolTip(
self.trUtf8("Press %s") %
resources.get_shortcut("Find-next").toString(
QKeySequence.NativeText))
hSearch.addWidget(self._btnClose)
hSearch.addWidget(self._line)
hSearch.addWidget(self._btnFind)
hSearch.addWidget(self.btnPrevious)
hSearch.addWidget(self.btnNext)
hSearch.addWidget(self._checkSensitive)
hSearch.addWidget(self._checkWholeWord)
self.totalMatches = 0
self.index = 0
self._line.counter.update_count(self.index, self.totalMatches)
self.connect(self._btnFind, SIGNAL("clicked()"),
self.find)
self.connect(self.btnNext, SIGNAL("clicked()"),
self.find_next)
self.connect(self.btnPrevious, SIGNAL("clicked()"),
self.find_previous)
self.connect(self._checkSensitive, SIGNAL("stateChanged(int)"),
self._states_changed)
self.connect(self._checkWholeWord, SIGNAL("stateChanged(int)"),
self._states_changed)
IDE.register_service('status_search', self)
示例3: __init__
def __init__(self, menuAbout):
QObject.__init__(self)
startPageAction = menuAbout.addAction(self.tr("Show Start Page"))
helpAction = menuAbout.addAction(self.tr("Python Help (%s)" %
resources.get_shortcut("Help").toString(QKeySequence.NativeText)))
menuAbout.addSeparator()
reportBugAction = menuAbout.addAction(self.tr("Report Bugs!"))
pluginsDocAction = menuAbout.addAction(
self.tr("Plugins Documentation"))
menuAbout.addSeparator()
aboutNinjaAction = menuAbout.addAction(self.tr("About NINJA-IDE"))
aboutQtAction = menuAbout.addAction(self.tr("About Qt"))
#Connect Action SIGNALs to proper functions
self.connect(startPageAction, SIGNAL("triggered()"),
main_container.MainContainer().show_start_page)
self.connect(reportBugAction, SIGNAL("triggered()"),
self.show_report_bugs)
self.connect(aboutQtAction, SIGNAL("triggered()"),
self._show_about_qt)
self.connect(helpAction, SIGNAL("triggered()"),
main_container.MainContainer().show_python_doc)
self.connect(aboutNinjaAction, SIGNAL("triggered()"),
self._show_about_ninja)
self.connect(pluginsDocAction, SIGNAL("triggered()"),
self.show_plugins_doc)
示例4: _load_shortcuts
def _load_shortcuts(self):
for action in resources.CUSTOM_SHORTCUTS:
shortcut_action = resources.get_shortcut(action)
#populate the tree widget
tree_data = [self.shortcuts_text[action],
shortcut_action.toString(QKeySequence.NativeText), action]
item = QTreeWidgetItem(self.result_widget, tree_data)
item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
示例5: __init__
def __init__(self, menuProject, toolbar):
QObject.__init__(self)
runAction = menuProject.addAction(QIcon(resources.IMAGES['play']),
self.tr("Run Project (%s)" %
resources.get_shortcut("Run-project").toString(
QKeySequence.NativeText)))
# debugAction = menuProject.addAction(
# QIcon(resources.IMAGES['debug']),
# self.tr("Debug Project (%s)" %
# resources.get_shortcut("Debug").toString(
# QKeySequence.NativeText)))
runFileAction = menuProject.addAction(
QIcon(resources.IMAGES['file-run']),
self.tr(u"Run File (%s)".format(
resources.get_shortcut("Run-file").toString(
QKeySequence.NativeText))))
stopAction = menuProject.addAction(QIcon(resources.IMAGES['stop']),
self.tr("Stop (%s)".format(
resources.get_shortcut("Stop-execution").toString(
QKeySequence.NativeText))))
menuProject.addSeparator()
projectPropertiesAction = menuProject.addAction(
self.tr("Open Project Properties"))
menuProject.addSeparator()
previewAction = menuProject.addAction(
QIcon(resources.IMAGES['preview-web']),
self.tr("Preview Web in Default Browser"))
# diagramView = menuProject.addAction(self.tr("Diagram View"))
self.toolbar_items = {
'run-project': runAction,
'run-file': runFileAction,
'stop': stopAction,
'preview-web': previewAction}
self.connect(runAction, SIGNAL("triggered()"),
actions.Actions().execute_project)
self.connect(runFileAction, SIGNAL("triggered()"),
actions.Actions().execute_file)
self.connect(stopAction, SIGNAL("triggered()"),
actions.Actions().kill_execution)
self.connect(previewAction, SIGNAL("triggered()"),
actions.Actions().preview_in_browser)
self.connect(projectPropertiesAction, SIGNAL("triggered()"),
actions.Actions().open_project_properties)
示例6: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
self._parent = parent
hSearch = QHBoxLayout(self)
hSearch.setContentsMargins(0, 0, 0, 0)
self._checkSensitive = QCheckBox(self.tr("Respect Case Sensitive"))
self._checkWholeWord = QCheckBox(self.tr("Find Whole Words"))
self._line = TextLine(self)
self._line.setMinimumWidth(250)
self._btnClose = QPushButton(
self.style().standardIcon(QStyle.SP_DialogCloseButton), '')
self._btnFind = QPushButton(QIcon(resources.IMAGES['find']), '')
self.btnPrevious = QPushButton(
self.style().standardIcon(QStyle.SP_ArrowLeft), '')
self.btnPrevious.setToolTip(self.tr(u"Press %s".format(
resources.get_shortcut("Find-previous").toString(
QKeySequence.NativeText))))
self.btnNext = QPushButton(
self.style().standardIcon(QStyle.SP_ArrowRight), '')
self.btnNext.setToolTip(self.tr(u"Press %s".format(
resources.get_shortcut("Find-next").toString(
QKeySequence.NativeText))))
hSearch.addWidget(self._btnClose)
hSearch.addWidget(self._line)
hSearch.addWidget(self._btnFind)
hSearch.addWidget(self.btnPrevious)
hSearch.addWidget(self.btnNext)
hSearch.addWidget(self._checkSensitive)
hSearch.addWidget(self._checkWholeWord)
self.totalMatches = 0
self.index = 0
self._line.counter.update_count(self.index, self.totalMatches)
self.connect(self._btnClose, SIGNAL("clicked()"),
self._parent.hide_status)
self.connect(self._btnFind, SIGNAL("clicked()"),
self.find_next)
self.connect(self.btnNext, SIGNAL("clicked()"),
self.find_next)
self.connect(self.btnPrevious, SIGNAL("clicked()"),
self.find_previous)
self.connect(self._checkSensitive, SIGNAL("stateChanged(int)"),
self._checks_state_changed)
self.connect(self._checkWholeWord, SIGNAL("stateChanged(int)"),
self._checks_state_changed)
示例7: __init__
def __init__(self, parent=None):
super(LateralPanel, self).__init__(parent)
self.has_component = False
self.vbox = QVBoxLayout(self)
self.vbox.setContentsMargins(0, 0, 0, 0)
hbox = QHBoxLayout()
hbox.setContentsMargins(0, 0, 5, 5)
self.combo = QComboBox()
ui_tools.ComboBoxButton(self.combo, self.combo.clear,
self.style().standardPixmap(self.style().SP_TrashIcon))
self.combo.setToolTip(self.tr("Select the item from the Paste "
"History list.\nYou can Copy items into this list with: "
"%s\nor Paste them using: %s") %
(resources.get_shortcut("History-Copy").toString(
QKeySequence.NativeText),
resources.get_shortcut("History-Paste").toString(
QKeySequence.NativeText)))
self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
hbox.addWidget(self.combo)
self.vbox.addLayout(hbox)
示例8: __init__
def __init__(self, menuProject, toolbar):
super(MenuProject, self).__init__()
runAction = menuProject.addAction(QIcon(resources.IMAGES['play']),
(_translate("MenuProject", "Run Project (%s)") %
resources.get_shortcut("Run-project").toString(
QKeySequence.NativeText)))
# debugAction = menuProject.addAction(
# QIcon(resources.IMAGES['debug']),
# _translate("MenuProject", "Debug Project (%s)" %
# resources.get_shortcut("Debug").toString(
# QKeySequence.NativeText)))
runFileAction = menuProject.addAction(
QIcon(resources.IMAGES['file-run']),
(_translate("MenuProject", "Run File (%s)") %
resources.get_shortcut("Run-file").toString(
QKeySequence.NativeText)))
stopAction = menuProject.addAction(QIcon(resources.IMAGES['stop']),
(_translate("MenuProject", "Stop (%s)") %
resources.get_shortcut("Stop-execution").toString(
QKeySequence.NativeText)))
menuProject.addSeparator()
projectPropertiesAction = menuProject.addAction(
_translate("MenuProject", "Open Project Properties"))
menuProject.addSeparator()
previewAction = menuProject.addAction(
QIcon(resources.IMAGES['preview-web']),
_translate("MenuProject", "Preview Web in Default Browser"))
# diagramView = menuProject.addAction(_translate("MenuProject", "Diagram View"))
self.toolbar_items = {
'run-project': runAction,
'run-file': runFileAction,
'stop': stopAction,
'preview-web': previewAction}
runAction.triggered.connect(actions.Actions().execute_project)
runFileAction.triggered.connect(actions.Actions().execute_file)
stopAction.triggered.connect(actions.Actions().kill_execution)
previewAction.triggered.connect(actions.Actions().preview_in_browser)
projectPropertiesAction.triggered.connect(actions.Actions().open_project_properties)
示例9: __init__
def __init__(self, parent):
super(EditorCompletion, self).__init__()
self._preferences = parent
vbox = QVBoxLayout(self)
groupBoxClose = QGroupBox(translations.TR_PREF_EDITOR_COMPLETE)
formClose = QGridLayout(groupBoxClose)
formClose.setContentsMargins(5, 15, 5, 5)
self._checkParentheses = QCheckBox(
translations.TR_PREF_EDITOR_PARENTHESES + " ()")
self._checkParentheses.setChecked('(' in settings.BRACES)
self._checkKeys = QCheckBox(translations.TR_PREF_EDITOR_KEYS + " {}")
self._checkKeys.setChecked('{' in settings.BRACES)
self._checkBrackets = QCheckBox(
translations.TR_PREF_EDITOR_BRACKETS + " []")
self._checkBrackets.setChecked('[' in settings.BRACES)
self._checkSimpleQuotes = QCheckBox(
translations.TR_PREF_EDITOR_SIMPLE_QUOTES)
self._checkSimpleQuotes.setChecked("'" in settings.QUOTES)
self._checkDoubleQuotes = QCheckBox(
translations.TR_PREF_EDITOR_DOUBLE_QUOTES)
self._checkDoubleQuotes.setChecked('"' in settings.QUOTES)
self._checkCompleteDeclarations = QCheckBox(
translations.TR_PREF_EDITOR_COMPLETE_DECLARATIONS.format(
resources.get_shortcut("Complete-Declarations").toString(
QKeySequence.NativeText)))
self._checkCompleteDeclarations.setChecked(
settings.COMPLETE_DECLARATIONS)
formClose.addWidget(self._checkParentheses, 1, 1,
alignment=Qt.AlignTop)
formClose.addWidget(self._checkKeys, 1, 2, alignment=Qt.AlignTop)
formClose.addWidget(self._checkBrackets, 2, 1, alignment=Qt.AlignTop)
formClose.addWidget(self._checkSimpleQuotes, 2, 2,
alignment=Qt.AlignTop)
formClose.addWidget(self._checkDoubleQuotes, 3, 1,
alignment=Qt.AlignTop)
vbox.addWidget(groupBoxClose)
groupBoxCode = QGroupBox(translations.TR_PREF_EDITOR_CODE_COMPLETION)
formCode = QGridLayout(groupBoxCode)
formCode.setContentsMargins(5, 15, 5, 5)
self._checkCodeDot = QCheckBox(
translations.TR_PREF_EDITOR_ACTIVATE_COMPLETION)
self._checkCodeDot.setChecked(settings.CODE_COMPLETION)
formCode.addWidget(self._checkCompleteDeclarations, 5, 1,
alignment=Qt.AlignTop)
formCode.addWidget(self._checkCodeDot, 6, 1, alignment=Qt.AlignTop)
vbox.addWidget(groupBoxCode)
vbox.addItem(QSpacerItem(0, 10, QSizePolicy.Expanding,
QSizePolicy.Expanding))
self._preferences.savePreferences.connect(self.save)
示例10: __init__
def __init__(self, menuProject, toolbar):
QObject.__init__(self)
runAction = menuProject.addAction(QIcon(resources.IMAGES['play']),
self.tr("Run Project (%1)").arg(
resources.get_shortcut("Run-project").toString(
QKeySequence.NativeText)))
# debugAction = menuProject.addAction(
# QIcon(resources.IMAGES['debug']),
# self.tr("Debug Project (%1)").arg(
# resources.get_shortcut("Debug").toString(
# QKeySequence.NativeText)))
runFileAction = menuProject.addAction(
QIcon(resources.IMAGES['file-run']),
self.tr("Run File (%1)").arg(
resources.get_shortcut("Run-file").toString(
QKeySequence.NativeText)))
stopAction = menuProject.addAction(QIcon(resources.IMAGES['stop']),
self.tr("Stop (%1)").arg(
resources.get_shortcut("Stop-execution").toString(
QKeySequence.NativeText)))
menuProject.addSeparator()
previewAction = menuProject.addAction(
self.tr("Preview Web in Default Browser"))
# diagramView = menuProject.addAction(self.tr("Diagram View"))
toolbar.addAction(runAction)
# toolbar.addAction(debugAction)
toolbar.addAction(runFileAction)
toolbar.addAction(stopAction)
toolbar.addSeparator()
self.connect(runAction, SIGNAL("triggered()"),
actions.Actions().execute_project)
self.connect(runFileAction, SIGNAL("triggered()"),
actions.Actions().execute_file)
self.connect(stopAction, SIGNAL("triggered()"),
actions.Actions().kill_execution)
self.connect(previewAction, SIGNAL("triggered()"),
actions.Actions().preview_in_browser)
示例11: install_shortcuts
def install_shortcuts(obj, actions, ide):
short = resources.get_shortcut
for action in actions:
short_key = action.get("shortcut", None)
action_data = action.get("action", None)
connect = action.get("connect", None)
shortcut = None
item_ui = None
func = None
if connect:
func = getattr(obj, connect, None)
if short_key and not action_data:
shortcut = QShortcut(short(short_key), ide)
if isinstance(func, collections.Callable):
ide.connect(shortcut, SIGNAL("activated()"), func)
if action_data:
is_menu = action_data.get('is_menu', False)
if is_menu:
item_ui = QMenu(action_data['text'], ide)
else:
item_ui = QAction(action_data['text'], ide)
object_name = "%s.%s" % (obj.__class__.__name__, connect)
item_ui.setObjectName(object_name)
image_name = action_data.get('image', None)
section = action_data.get('section', None)
weight = action_data.get('weight', None)
keysequence = action_data.get('keysequence', None)
if image_name:
if isinstance(image_name, int):
icon = ide.style().standardIcon(image_name)
item_ui.setIcon(icon)
elif isinstance(image_name, str):
icon = QIcon(":img/" + image_name)
item_ui.setIcon(icon)
if short_key and not is_menu:
item_ui.setShortcut(short(short_key))
elif keysequence:
item_ui.setShortcut(resources.get_shortcut(keysequence))
if isinstance(func, collections.Callable) and not is_menu:
ide.connect(item_ui, SIGNAL("triggered()"), func)
if section and weight:
ide.register_menuitem(item_ui, section, weight)
if image_name and not is_menu:
ide.register_toolbar(item_ui, section, weight)
if short_key and shortcut:
ide.register_shortcut(short_key, shortcut, item_ui)
示例12: __init__
def __init__(self, menuAbout):
super(MenuAbout, self).__init__()
startPageAction = menuAbout.addAction(_translate("MenuAbout", "Show Start Page"))
helpAction = menuAbout.addAction(_translate("MenuAbout", "Python Help (%s)") %
resources.get_shortcut("Help").toString(QKeySequence.NativeText))
menuAbout.addSeparator()
reportBugAction = menuAbout.addAction(_translate("MenuAbout", "Report Bugs!"))
pluginsDocAction = menuAbout.addAction(
_translate("MenuAbout", "Plugins Documentation"))
menuAbout.addSeparator()
aboutNinjaAction = menuAbout.addAction(_translate("MenuAbout", "About NINJA-IDE"))
aboutQtAction = menuAbout.addAction(_translate("MenuAbout", "About Qt"))
#Connect Action SIGNALs to proper functions
startPageAction.triggered.connect(main_container.MainContainer().show_start_page)
startPageAction.triggered.connect(self.show_report_bugs)
aboutQtAction.triggered.connect(self._show_about_qt)
helpAction.triggered.connect(main_container.MainContainer().show_python_doc)
helpAction.triggered.connect(self._show_about_ninja)
pluginsDocAction.triggered.connect(self.show_plugins_doc)
示例13: __init__
def __init__(self, menuView, toolbar, ide):
QObject.__init__(self)
self.__ide = ide
self.hideConsoleAction = menuView.addAction(
self.tr("Show/Hide &Console (%s)" %
resources.get_shortcut("Hide-misc").toString(
QKeySequence.NativeText)))
self.hideConsoleAction.setCheckable(True)
self.hideEditorAction = menuView.addAction(
self.tr("Show/Hide &Editor (%s)" %
resources.get_shortcut("Hide-editor").toString(
QKeySequence.NativeText)))
self.hideEditorAction.setCheckable(True)
self.hideAllAction = menuView.addAction(
self.tr("Show/Hide &All (%s)" %
resources.get_shortcut("Hide-all").toString(
QKeySequence.NativeText)))
self.hideAllAction.setCheckable(True)
self.hideExplorerAction = menuView.addAction(
self.tr("Show/Hide &Explorer (%s)" %
resources.get_shortcut("Hide-explorer").toString(
QKeySequence.NativeText)))
self.hideExplorerAction.setCheckable(True)
self.hideToolbarAction = menuView.addAction(
self.tr("Show/Hide &Toolbar"))
self.hideToolbarAction.setCheckable(True)
self.fullscreenAction = menuView.addAction(
QIcon(resources.IMAGES['fullscreen']),
self.tr("Full Screen &Mode (%s)" %
resources.get_shortcut("Full-screen").toString(
QKeySequence.NativeText)))
menuView.addSeparator()
splitTabHAction = menuView.addAction(
QIcon(resources.IMAGES['splitH']),
self.tr("Split Tabs Horizontally (%s)" %
resources.get_shortcut("Split-horizontal").toString(
QKeySequence.NativeText)))
splitTabVAction = menuView.addAction(
QIcon(resources.IMAGES['splitV']),
self.tr("Split Tabs Vertically (%s)" %
resources.get_shortcut("Split-vertical").toString(
QKeySequence.NativeText)))
followModeAction = menuView.addAction(
QIcon(resources.IMAGES['follow']),
self.tr("Follow Mode (%s)" %
resources.get_shortcut("Follow-mode").toString(
QKeySequence.NativeText)))
groupTabsAction = menuView.addAction(self.tr("Group Tabs by Project"))
deactivateGroupTabsAction = menuView.addAction(
self.tr("Deactivate Group Tabs"))
menuView.addSeparator()
#Zoom
zoomInAction = menuView.addAction(QIcon(resources.IMAGES['zoom-in']),
self.tr("Zoom &In (Shift+Wheel-Up)"))
zoomOutAction = menuView.addAction(QIcon(resources.IMAGES['zoom-out']),
self.tr("Zoom &Out (Shift+Wheel-Down)"))
menuView.addSeparator()
fadeInAction = menuView.addAction(self.tr("Fade In (Alt+Wheel-Up)"))
fadeOutAction = menuView.addAction(
self.tr("Fade Out (Alt+Wheel-Down)"))
self.toolbar_items = {
'splith': splitTabHAction,
'splitv': splitTabVAction,
'follow-mode': followModeAction,
'zoom-in': zoomInAction,
'zoom-out': zoomOutAction}
self.connect(self.hideConsoleAction, SIGNAL("triggered()"),
self.__ide.actions.view_misc_visibility)
self.connect(self.hideEditorAction, SIGNAL("triggered()"),
self.__ide.actions.view_main_visibility)
self.connect(self.hideExplorerAction, SIGNAL("triggered()"),
self.__ide.actions.view_explorer_visibility)
self.connect(self.hideAllAction, SIGNAL("triggered()"),
self.__ide.actions.hide_all)
self.connect(self.fullscreenAction, SIGNAL("triggered()"),
self.__ide.actions.fullscreen_mode)
self.connect(splitTabHAction, SIGNAL("triggered()"),
lambda: self.__ide.mainContainer.split_tab(True))
self.connect(splitTabVAction, SIGNAL("triggered()"),
lambda: self.__ide.mainContainer.split_tab(False))
QObject.connect(followModeAction, SIGNAL("triggered()"),
self.__ide.mainContainer.show_follow_mode)
self.connect(zoomInAction, SIGNAL("triggered()"),
self.zoom_in_editor)
self.connect(zoomOutAction, SIGNAL("triggered()"),
self.zoom_out_editor)
self.connect(fadeInAction, SIGNAL("triggered()"), self._fade_in)
self.connect(fadeOutAction, SIGNAL("triggered()"), self._fade_out)
self.connect(self.hideToolbarAction, SIGNAL("triggered()"),
self._hide_show_toolbar)
self.connect(groupTabsAction, SIGNAL("triggered()"),
self.__ide.actions.group_tabs_together)
self.connect(deactivateGroupTabsAction, SIGNAL("triggered()"),
self.__ide.actions.deactivate_tabs_groups)
#Set proper MenuView checks values:
#.........这里部分代码省略.........
示例14: __init__
def __init__(self, menuFile, toolbar, ide):
QObject.__init__(self)
newAction = menuFile.addAction(
QIcon(resources.IMAGES["new"]),
self.tr("&New File (%s)" % resources.get_shortcut("New-file").toString(QKeySequence.NativeText)),
)
newProjectAction = menuFile.addAction(
QIcon(resources.IMAGES["newProj"]),
self.tr("New Pro&ject (%s)" % resources.get_shortcut("New-project").toString(QKeySequence.NativeText)),
)
menuFile.addSeparator()
saveAction = menuFile.addAction(
QIcon(resources.IMAGES["save"]),
self.tr("&Save (%s)" % resources.get_shortcut("Save-file").toString(QKeySequence.NativeText)),
)
saveAsAction = menuFile.addAction(QIcon(resources.IMAGES["saveAs"]), self.tr("Save &As"))
saveAllAction = menuFile.addAction(QIcon(resources.IMAGES["saveAll"]), self.tr("Save All"))
saveProjectAction = menuFile.addAction(
QIcon(resources.IMAGES["saveAll"]),
self.tr("Save Pro&ject (%s)" % resources.get_shortcut("Save-project").toString(QKeySequence.NativeText)),
)
menuFile.addSeparator()
reloadFileAction = menuFile.addAction(
QIcon(resources.IMAGES["reload-file"]),
self.tr("Reload File (%s)" % resources.get_shortcut("Reload-file").toString(QKeySequence.NativeText)),
)
menuFile.addSeparator()
openAction = menuFile.addAction(
QIcon(resources.IMAGES["open"]),
self.tr("&Open (%s)" % resources.get_shortcut("Open-file").toString(QKeySequence.NativeText)),
)
openProjectAction = menuFile.addAction(
QIcon(resources.IMAGES["openProj"]),
self.tr("Open &Project (%s)" % resources.get_shortcut("Open-project").toString(QKeySequence.NativeText)),
)
self.recent_files = menuFile.addMenu(self.tr("Open Recent Files"))
menuFile.addSeparator()
activateProfileAction = menuFile.addAction(
QIcon(resources.IMAGES["activate-profile"]), self.tr("Activate Profile")
)
deactivateProfileAction = menuFile.addAction(
QIcon(resources.IMAGES["deactivate-profile"]), self.tr("Deactivate Profile")
)
menuFile.addSeparator()
printFile = menuFile.addAction(
QIcon(resources.IMAGES["print"]),
self.tr("Pr&int File (%s)" % resources.get_shortcut("Print-file").toString(QKeySequence.NativeText)),
)
closeAction = menuFile.addAction(
ide.style().standardIcon(QStyle.SP_DialogCloseButton),
self.tr("&Close Tab (%s)" % resources.get_shortcut("Close-tab").toString(QKeySequence.NativeText)),
)
closeProjectsAction = menuFile.addAction(
ide.style().standardIcon(QStyle.SP_DialogCloseButton), self.tr("&Close All Projects")
)
menuFile.addSeparator()
exitAction = menuFile.addAction(ide.style().standardIcon(QStyle.SP_DialogCloseButton), self.tr("&Exit"))
self.toolbar_items = {
"new-file": newAction,
"new-project": newProjectAction,
"save-file": saveAction,
"save-as": saveAsAction,
"save-all": saveAllAction,
"save-project": saveProjectAction,
"reload-file": reloadFileAction,
"open-file": openAction,
"open-project": openProjectAction,
"activate-profile": activateProfileAction,
"deactivate-profile": deactivateProfileAction,
"print-file": printFile,
"close-file": closeAction,
"close-projects": closeProjectsAction,
}
self.connect(newAction, SIGNAL("triggered()"), ide.mainContainer.add_editor)
self.connect(newProjectAction, SIGNAL("triggered()"), ide.explorer.create_new_project)
self.connect(openAction, SIGNAL("triggered()"), ide.mainContainer.open_file)
self.connect(saveAction, SIGNAL("triggered()"), ide.mainContainer.save_file)
self.connect(saveAsAction, SIGNAL("triggered()"), ide.mainContainer.save_file_as)
self.connect(saveAllAction, SIGNAL("triggered()"), ide.actions.save_all)
self.connect(saveProjectAction, SIGNAL("triggered()"), ide.actions.save_project)
self.connect(openProjectAction, SIGNAL("triggered()"), ide.explorer.open_project_folder)
self.connect(closeAction, SIGNAL("triggered()"), ide.mainContainer.actualTab.close_tab)
self.connect(exitAction, SIGNAL("triggered()"), ide.close)
QObject.connect(reloadFileAction, SIGNAL("triggered()"), ide.mainContainer.reload_file)
self.connect(printFile, SIGNAL("triggered()"), ide.actions.print_file)
self.connect(closeProjectsAction, SIGNAL("triggered()"), ide.explorer.close_opened_projects)
self.connect(deactivateProfileAction, SIGNAL("triggered()"), ide.actions.deactivate_profile)
self.connect(activateProfileAction, SIGNAL("triggered()"), ide.actions.activate_profile)
self.connect(self.recent_files, SIGNAL("triggered(QAction*)"), self._open_file)
示例15: __init__
def __init__(self, menuEdit, toolbar):
QObject.__init__(self)
undoAction = menuEdit.addAction(QIcon(resources.IMAGES['undo']),
(self.trUtf8("Undo (%s+Z)") % settings.OS_KEY))
redoAction = menuEdit.addAction(QIcon(resources.IMAGES['redo']),
(self.trUtf8("Redo (%s)") % resources.get_shortcut("Redo").toString(
QKeySequence.NativeText)))
cutAction = menuEdit.addAction(QIcon(resources.IMAGES['cut']),
(self.trUtf8("&Cut (%s+X)") % settings.OS_KEY))
copyAction = menuEdit.addAction(QIcon(resources.IMAGES['copy']),
(self.trUtf8("&Copy (%s+C)") % settings.OS_KEY))
pasteAction = menuEdit.addAction(QIcon(resources.IMAGES['paste']),
(self.trUtf8("&Paste (%s+V)") % settings.OS_KEY))
menuEdit.addSeparator()
findAction = menuEdit.addAction(QIcon(resources.IMAGES['find']),
(self.trUtf8("Find (%s)") % resources.get_shortcut("Find").toString(
QKeySequence.NativeText)))
findReplaceAction = menuEdit.addAction(
QIcon(resources.IMAGES['findReplace']),
(self.trUtf8("Find/Replace (%s)") %
resources.get_shortcut("Find-replace").toString(
QKeySequence.NativeText)))
findWithWordAction = menuEdit.addAction(
(self.trUtf8("Find using word under cursor (%s)") %
resources.get_shortcut("Find-with-word").toString(
QKeySequence.NativeText)))
findInFilesAction = menuEdit.addAction(QIcon(resources.IMAGES['find']),
(self.trUtf8("Find in Files (%s)") %
resources.get_shortcut("Find-in-files").toString(
QKeySequence.NativeText)))
locatorAction = menuEdit.addAction(QIcon(resources.IMAGES['locator']),
(self.trUtf8("Code Locator (%s)") %
resources.get_shortcut("Code-locator").toString(
QKeySequence.NativeText)))
menuEdit.addSeparator()
upperAction = menuEdit.addAction(
self.trUtf8("Convert selected Text to: UPPER"))
lowerAction = menuEdit.addAction(
self.trUtf8("Convert selected Text to: lower"))
titleAction = menuEdit.addAction(
self.trUtf8("Convert selected Text to: Title Word"))
menuEdit.addSeparator()
prefAction = menuEdit.addAction(QIcon(resources.IMAGES['pref']),
self.trUtf8("Preference&s"))
self.toolbar_items = {
'undo': undoAction,
'redo': redoAction,
'cut': cutAction,
'copy': copyAction,
'paste': pasteAction,
'find': findAction,
'find-replace': findReplaceAction,
'find-files': findInFilesAction,
'code-locator': locatorAction}
self.connect(cutAction, SIGNAL("triggered()"), self._editor_cut)
self.connect(copyAction, SIGNAL("triggered()"), self._editor_copy)
self.connect(pasteAction, SIGNAL("triggered()"), self._editor_paste)
self.connect(redoAction, SIGNAL("triggered()"), self._editor_redo)
self.connect(undoAction, SIGNAL("triggered()"), self._editor_undo)
self.connect(upperAction, SIGNAL("triggered()"), self._editor_upper)
self.connect(lowerAction, SIGNAL("triggered()"), self._editor_lower)
self.connect(titleAction, SIGNAL("triggered()"), self._editor_title)
self.connect(findAction, SIGNAL("triggered()"),
status_bar.StatusBar().show)
self.connect(findWithWordAction, SIGNAL("triggered()"),
status_bar.StatusBar().show_with_word)
self.connect(findReplaceAction, SIGNAL("triggered()"),
status_bar.StatusBar().show_replace)
self.connect(findInFilesAction, SIGNAL("triggered()"),
self._show_find_in_files)
self.connect(locatorAction, SIGNAL("triggered()"),
status_bar.StatusBar().show_locator)
self.connect(prefAction, SIGNAL("triggered()"), self._show_preferences)