def _get_editor_skins(self): qsettings = IDE.ninja_settings() qsettings.beginGroup('preferences') qsettings.beginGroup('editor') self._schemes = json_manager.load_editor_skins() self._selected_scheme = qsettings.value('scheme', defaultValue='', type='QString') qsettings.endGroup() qsettings.endGroup()
def __init__(self): QWidget.__init__(self) vbox = QVBoxLayout(self) groupBoxTypo = QGroupBox(self.tr("Typography:")) groupBoxScheme = QGroupBox(self.tr("Scheme Color:")) #Settings qsettings = QSettings() qsettings.beginGroup('preferences') qsettings.beginGroup('editor') #Typo gridTypo = QGridLayout(groupBoxTypo) self._btnEditorFont = QPushButton( ', '.join([settings.FONT_FAMILY, str(settings.FONT_SIZE)])) gridTypo.addWidget(QLabel( self.tr("Editor Font:")), 0, 0, Qt.AlignRight) gridTypo.addWidget(self._btnEditorFont, 0, 1) #Scheme hbox = QHBoxLayout(groupBoxScheme) self._listScheme = QListWidget() self._listScheme.addItem('default') self._schemes = json_manager.load_editor_skins() for item in self._schemes: self._listScheme.addItem(item) items = self._listScheme.findItems( qsettings.value('scheme', '').toString(), Qt.MatchExactly) if items: self._listScheme.setCurrentItem(items[0]) else: self._listScheme.setCurrentRow(0) hbox.addWidget(self._listScheme) qsettings.endGroup() qsettings.endGroup() vbox.addWidget(groupBoxTypo) vbox.addWidget(groupBoxScheme) #Signals self.connect(self._btnEditorFont, SIGNAL("clicked()"), self._load_editor_font)
def __init__(self, parent): super(EditorGeneral, self).__init__() self._preferences, vbox = parent, QVBoxLayout(self) self.original_style = copy.copy(resources.CUSTOM_SCHEME) self.current_scheme, self._modified_editors = 'default', [] self._font = settings.FONT groupBoxMini = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_MINIMAP) groupBoxTypo = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_TYPOGRAPHY) groupBoxScheme = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_SCHEME) #Minimap formMini = QGridLayout(groupBoxMini) formMini.setContentsMargins(5, 15, 5, 5) self._checkShowMinimap = QCheckBox( translations.TR_PREFERENCES_EDITOR_GENERAL_ENABLE_MINIMAP) self._spinMaxOpacity = QSpinBox() self._spinMaxOpacity.setRange(0, 100) self._spinMaxOpacity.setSuffix("% Max.") self._spinMinOpacity = QSpinBox() self._spinMinOpacity.setRange(0, 100) self._spinMinOpacity.setSuffix("% Min.") self._spinSize = QSpinBox() self._spinSize.setMaximum(100) self._spinSize.setMinimum(0) self._spinSize.setSuffix( translations.TR_PREFERENCES_EDITOR_GENERAL_AREA_MINIMAP) formMini.addWidget(self._checkShowMinimap, 0, 1) formMini.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_SIZE_MINIMAP), 1, 0, Qt.AlignRight) formMini.addWidget(self._spinSize, 1, 1) formMini.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_OPACITY), 2, 0, Qt.AlignRight) formMini.addWidget(self._spinMinOpacity, 2, 1) formMini.addWidget(self._spinMaxOpacity, 2, 2) #Typo gridTypo = QGridLayout(groupBoxTypo) gridTypo.setContentsMargins(5, 15, 5, 5) self._btnEditorFont = QPushButton('') gridTypo.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_EDITOR_FONT), 0, 0, Qt.AlignRight) gridTypo.addWidget(self._btnEditorFont, 0, 1) #Scheme vboxScheme = QVBoxLayout(groupBoxScheme) vboxScheme.setContentsMargins(5, 15, 5, 5) self._listScheme = QListWidget() vboxScheme.addWidget(self._listScheme) hbox = QHBoxLayout() btnDownload = QPushButton( translations.TR_PREFERENCES_EDITOR_DOWNLOAD_SCHEME) btnDownload.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.connect(btnDownload, SIGNAL("clicked()"), self._open_schemes_manager) hbox.addWidget(btnDownload) btnAdd = QPushButton(QIcon(":img/add"), translations.TR_EDITOR_CREATE_SCHEME) btnAdd.setIconSize(QSize(16, 16)) btnAdd.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.connect(btnAdd, SIGNAL("clicked()"), self._open_schemes_designer) btnRemove = QPushButton(QIcon(":img/delete"), translations.TR_EDITOR_REMOVE_SCHEME) btnRemove.setIconSize(QSize(16, 16)) btnRemove.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.connect(btnRemove, SIGNAL("clicked()"), self._remove_scheme) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(btnAdd) hbox.addWidget(btnRemove) vboxScheme.addLayout(hbox) vbox.addWidget(groupBoxMini) vbox.addWidget(groupBoxTypo) vbox.addWidget(groupBoxScheme) #Settings qsettings = IDE.ninja_settings() qsettings.beginGroup('preferences') qsettings.beginGroup('editor') self._checkShowMinimap.setChecked(settings.SHOW_MINIMAP) if settings.IS_MAC_OS: self._spinMinOpacity.setValue(100) self._spinMaxOpacity.setValue(100) self._spinMinOpacity.setDisabled(True) self._spinMaxOpacity.setDisabled(True) else: self._spinMinOpacity.setValue(settings.MINIMAP_MIN_OPACITY * 100) self._spinMaxOpacity.setValue(settings.MINIMAP_MAX_OPACITY * 100) self._spinSize.setValue(settings.SIZE_PROPORTION * 100) btnText = ', '.join(self._font.toString().split(',')[0:2]) self._btnEditorFont.setText(btnText) self._listScheme.clear() self._listScheme.addItem('default') self._schemes = json_manager.load_editor_skins() for item in self._schemes: self._listScheme.addItem(item) items = self._listScheme.findItems( qsettings.value('scheme', defaultValue='', type='QString'), Qt.MatchExactly) if items: self._listScheme.setCurrentItem(items[0]) else: self._listScheme.setCurrentRow(0) qsettings.endGroup() qsettings.endGroup() #Signals self.connect(self._btnEditorFont, SIGNAL("clicked()"), self._load_editor_font) self.connect(self._listScheme, SIGNAL("itemSelectionChanged()"), self._preview_style) self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
def __init__(self, parent): super(EditorGeneral, self).__init__() self._preferences = parent vbox = QVBoxLayout(self) self.original_style = copy.copy(resources.CUSTOM_SCHEME) self.current_scheme = 'default' groupBoxMini = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_MINIMAP) groupBoxTypo = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_TYPOGRAPHY) groupBoxScheme = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_SCHEME) #Minimap formMini = QGridLayout(groupBoxMini) self._checkShowMinimap = QCheckBox() self._spinMaxOpacity = QSpinBox() self._spinMaxOpacity.setMaximum(100) self._spinMaxOpacity.setMinimum(0) self._spinMinOpacity = QSpinBox() self._spinMinOpacity.setMaximum(100) self._spinMinOpacity.setMinimum(0) self._spinSize = QSpinBox() self._spinSize.setMaximum(100) self._spinSize.setMinimum(0) formMini.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_ENABLE_MINIMAP), 0, 0, Qt.AlignRight) formMini.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_MAX_OPACITY), 1, 0, Qt.AlignRight) formMini.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_MIN_OPACITY), 2, 0, Qt.AlignRight) formMini.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_AREA_MINIMAP), 3, 0, Qt.AlignRight) formMini.addWidget(self._checkShowMinimap, 0, 1) formMini.addWidget(self._spinMaxOpacity, 1, 1) formMini.addWidget(self._spinMinOpacity, 2, 1) formMini.addWidget(self._spinSize, 3, 1) #Typo gridTypo = QGridLayout(groupBoxTypo) self._btnEditorFont = QPushButton('') gridTypo.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_EDITOR_FONT), 0, 0, Qt.AlignRight) gridTypo.addWidget(self._btnEditorFont, 0, 1) #Scheme hbox = QHBoxLayout(groupBoxScheme) self._listScheme = QListWidget() hbox.addWidget(self._listScheme) vbox.addWidget(groupBoxMini) vbox.addWidget(groupBoxTypo) vbox.addWidget(groupBoxScheme) #Settings qsettings = IDE.ninja_settings() qsettings.beginGroup('preferences') qsettings.beginGroup('editor') self._checkShowMinimap.setChecked(settings.SHOW_MINIMAP) self._spinMaxOpacity.setValue(settings.MINIMAP_MAX_OPACITY * 100) self._spinMinOpacity.setValue(settings.MINIMAP_MIN_OPACITY * 100) self._spinSize.setValue(settings.SIZE_PROPORTION * 100) self._btnEditorFont.setText( ', '.join([settings.FONT_FAMILY, str(settings.FONT_SIZE)])) self._listScheme.clear() self._listScheme.addItem('default') self._schemes = json_manager.load_editor_skins() for item in self._schemes: self._listScheme.addItem(item) items = self._listScheme.findItems( qsettings.value('scheme', defaultValue='', type='QString'), Qt.MatchExactly) if items: self._listScheme.setCurrentItem(items[0]) else: self._listScheme.setCurrentRow(0) qsettings.endGroup() qsettings.endGroup() #Signals self.connect(self._btnEditorFont, SIGNAL("clicked()"), self._load_editor_font) self.connect(self._listScheme, SIGNAL("itemSelectionChanged()"), self._preview_style) self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
def __init__(self, parent): super(EditorGeneral, self).__init__() self._preferences = parent vbox = QVBoxLayout(self) self.original_style = copy.copy(resources.CUSTOM_SCHEME) self.current_scheme = 'default' groupBoxMini = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_MINIMAP) groupBoxTypo = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_TYPOGRAPHY) groupBoxScheme = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_SCHEME) #Minimap formMini = QGridLayout(groupBoxMini) self._checkShowMinimap = QCheckBox() self._spinMaxOpacity = QSpinBox() self._spinMaxOpacity.setMaximum(100) self._spinMaxOpacity.setMinimum(0) self._spinMinOpacity = QSpinBox() self._spinMinOpacity.setMaximum(100) self._spinMinOpacity.setMinimum(0) self._spinSize = QSpinBox() self._spinSize.setMaximum(100) self._spinSize.setMinimum(0) formMini.addWidget( QLabel(translations.TR_PREFERENCES_EDITOR_GENERAL_ENABLE_MINIMAP), 0, 0, Qt.AlignRight) formMini.addWidget( QLabel(translations.TR_PREFERENCES_EDITOR_GENERAL_MAX_OPACITY), 1, 0, Qt.AlignRight) formMini.addWidget( QLabel(translations.TR_PREFERENCES_EDITOR_GENERAL_MIN_OPACITY), 2, 0, Qt.AlignRight) formMini.addWidget( QLabel(translations.TR_PREFERENCES_EDITOR_GENERAL_AREA_MINIMAP), 3, 0, Qt.AlignRight) formMini.addWidget(self._checkShowMinimap, 0, 1) formMini.addWidget(self._spinMaxOpacity, 1, 1) formMini.addWidget(self._spinMinOpacity, 2, 1) formMini.addWidget(self._spinSize, 3, 1) #Typo gridTypo = QGridLayout(groupBoxTypo) self._btnEditorFont = QPushButton('') gridTypo.addWidget( QLabel(translations.TR_PREFERENCES_EDITOR_GENERAL_EDITOR_FONT), 0, 0, Qt.AlignRight) gridTypo.addWidget(self._btnEditorFont, 0, 1) #Scheme hbox = QHBoxLayout(groupBoxScheme) self._listScheme = QListWidget() hbox.addWidget(self._listScheme) vbox.addWidget(groupBoxMini) vbox.addWidget(groupBoxTypo) vbox.addWidget(groupBoxScheme) #Settings qsettings = IDE.ninja_settings() qsettings.beginGroup('preferences') qsettings.beginGroup('editor') self._checkShowMinimap.setChecked(settings.SHOW_MINIMAP) self._spinMaxOpacity.setValue(settings.MINIMAP_MAX_OPACITY * 100) self._spinMinOpacity.setValue(settings.MINIMAP_MIN_OPACITY * 100) self._spinSize.setValue(settings.SIZE_PROPORTION * 100) self._btnEditorFont.setText(', '.join( [settings.FONT_FAMILY, str(settings.FONT_SIZE)])) self._listScheme.clear() self._listScheme.addItem('default') self._schemes = json_manager.load_editor_skins() for item in self._schemes: self._listScheme.addItem(item) items = self._listScheme.findItems( qsettings.value('scheme', defaultValue='', type='QString'), Qt.MatchExactly) if items: self._listScheme.setCurrentItem(items[0]) else: self._listScheme.setCurrentRow(0) qsettings.endGroup() qsettings.endGroup() #Signals self.connect(self._btnEditorFont, SIGNAL("clicked()"), self._load_editor_font) self.connect(self._listScheme, SIGNAL("itemSelectionChanged()"), self._preview_style) self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)