def save_stylesheet(self): try: file_name = "%s.qss" % self.line_name.text() if not self._is_valid_scheme_name(file_name): QMessageBox.information(self, translations.TR_PREFERENCES_THEME, translations.TR_SCHEME_INVALID_NAME) file_name = ('{0}.qss'.format( file_manager.create_path(resources.NINJA_THEME_DOWNLOAD, file_name))) content = self.edit_qss.toPlainText() answer = True if file_manager.file_exists(file_name): answer = QMessageBox.question( self, translations.TR_PREFERENCES_THEME, translations.TR_WANT_OVERWRITE_FILE + ": {0}?".format(file_name), QMessageBox.Yes, QMessageBox.No) if answer in (QMessageBox.Yes, True): self.apply_stylesheet() file_manager.store_file_content(file_name, content, newFile=True) self.close() except file_manager.NinjaFileExistsException as ex: QMessageBox.information( self, self.tr("File Already Exists"), (self.tr("Invalid File Name: the file '%s' already exists.") % ex.filename))
def __init__(self): QMessageBox.information(core.mainWindow(), "Hello, world", "Plugin loaded") self._addAction() self._createDock() self._readSettings() core.workspace().currentDocumentChanged.connect(self._onDocumentChanged) core.uiSettingsManager().dialogAccepted.connect(self._applySettings) core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
def __init__(self): QMessageBox.information(core.mainWindow(), "Hello, world", "Plugin loaded") self._addAction() self._createDock() self._readSettings() core.workspace().currentDocumentChanged.connect( self._onDocumentChanged) core.uiSettingsManager().dialogAccepted.connect(self._applySettings) core.uiSettingsManager().aboutToExecute.connect( self._onSettingsDialogAboutToExecute)
def _install_external(self): """Install external plugins""" if self._link.text().isEmpty(): QMessageBox.information(self, translations.TR_EXTERNAL_PLUGIN, translations.TR_URL_IS_MISSING + "...") return plug = [ file_manager.get_module_name(str(self._link.text())), 'External Plugin', '1.0', str(self._link.text()) ] self.parent().download_plugins(plug) self._link.setText('')
def save_scheme(self): """Save current scheme.""" name = self.line_name.text().strip() if not self._is_valid_scheme_name(name): QMessageBox.information( self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER, translations.TR_SCHEME_INVALID_NAME) return fileName = ('{0}.color'.format( file_manager.create_path(resources.EDITOR_SKINS, name))) answer = True if file_manager.file_exists(fileName): answer = QMessageBox.question( self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER, translations.TR_WANT_OVERWRITE_FILE + ": {0}?".format(fileName), QMessageBox.Yes, QMessageBox.No) if answer in (QMessageBox.Yes, True): scheme = self._preview_style() self.original_style = copy.copy(scheme) json_manager.save_editor_skins(fileName, scheme) self._modified = False self.saved = True qsettings = IDE.ninja_settings() qsettings.setValue('preferences/editor/scheme', name) QMessageBox.information( self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER, translations.TR_SCHEME_SAVED + ": {0}.".format(fileName)) self.close() elif answer == QMessageBox.Yes: QMessageBox.information( self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER, translations.TR_INVALID_FILENAME)
def _sayHello(self): """Handler for main menu action """ QMessageBox.information(core.mainWindow(), "Hello, world", "Menu action has been triggered!")
def terminate(self): """This method is called by core for each plugin during termination """ QMessageBox.information(core.mainWindow(), "Hello, world", "Plugin terminated")
"""WebInspector widget class""" def __init__(self, parent): QWidget.__init__(self, parent) vbox = QVBoxLayout(self) self._webInspector = QWebInspector(self) vbox.addWidget(self._webInspector) self.btnDock = QPushButton(translations.TR_UNDOCK) vbox.addWidget(self.btnDock) ExplorerContainer.register_tab(translations.TR_TAB_WEB_INSPECTOR, self) IDE.register_service('web_inspector', self) def refresh_inspector(self): """Refresh WebInspector widget by hiding and showing""" self._webInspector.hide() self._webInspector.show() def set_inspection_page(self, page): """Method to load an argument page object on the WebInspector""" self._webInspector.setPage(page) self._webInspector.setVisible(True) if settings.SHOW_WEB_INSPECTOR and settings.WEBINSPECTOR_SUPPORTED: webInspector = WebInspector() else: if not settings.WEBINSPECTOR_SUPPORTED: QMessageBox.information(None, translations.TR_TAB_WEB_INSPECTOR, translations.TR_WEB_INSPECTOR_NOT_SUPPORTED) webInspector = None
def __evt_changeLanguage(self, locale): Prefs.new().setLanguage(locale) QMessageBox.information( self, "Success", QApplication.translate( "default", "Success , this Will take effect at the next time"))
def __evt_changeLanguage(self,locale): Prefs.new().setLanguage(locale) QMessageBox.information(self,"Success",QApplication.translate("default","Success , this Will take effect at the next time"))