本文整理汇总了Python中Settings.Settings.getSettings方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.getSettings方法的具体用法?Python Settings.getSettings怎么用?Python Settings.getSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings.Settings
的用法示例。
在下文中一共展示了Settings.getSettings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Settings_GTK
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import getSettings [as 别名]
class Settings_GTK():
def __init__(self, caller=None):
self._settings_class = Settings()
self._settings_dict = self._settings_class.getSettings()
self.__parent = caller
gtk.glade.bindtextdomain(translationsDomainName, translationsDirName)
gtk.glade.textdomain(translationsDomainName)
gladefile = "settings.glade"
self.__wTree = gtk.glade.XML(gladefile)
self.__window = self.__wTree.get_widget("Settings")
self.__optipngBox = self.__wTree.get_widget("hboxOptipng")
self.__comboboxFileType = self.__wTree.get_widget("comboboxFileType")
self.__hscaleCompression = self.__wTree.get_widget("hscaleCompression")
self.__labelScaleMax = self.__wTree.get_widget("labelScaleMax")
self.__window.connect("destroy", self._destroy)
dic = {
"on_buttonOK_clicked": self.__buttonOKClicked,
"on_buttonReset_clicked": self.__buttonResetClicked,
"on_hscaleCompression_value_changed": self.__scaleCompressionValueChanged,
"on_comboboxFileType_changed": self.__comboboxFileTypeChanged,
"on_buttonInstallOptipng_clicked": self.__buttonInstallOptipng,
"on_buttonGetCurrentHeight_clicked": self.__buttonGetCurrentHeightClicked,
"on_spinbuttonNumberOfConnections_value_changed":self.__spinbuttonNumberOfConnections_value_changed,
"on_comboboxClipboard_changed":self.__comboboxClipboard_changed,
"on_checkbuttonOneInstance_toggled":self.__checkbuttonOneInstance_toggled,
"on_spinbuttonHeight_value_changed":self.__spinbuttonHeight_value_changed,
"on_spinbuttonThumb_value_changed":self.__spinbuttonThumb_value_changed,
"on_checkbuttonNotification_toggled":self.__checkbuttonNotification_toggled,
"on_checkbuttonIcon_toggled":self.__checkbuttonIcon_toggled,
"on_checkbuttonBlink_toggled":self.__checkbuttonBlink_toggled,
"on_checkbuttonUseProxy_toggled":self.__on_checkbuttonUseProxy_toggled,
"on_entryProxyAddress_changed":self.__on_entryProxyAddress_changed,
"on_entryProxyPort_changed":self.__on_entryProxyPort_changed,
# "on_entryProxyUserName_changed":self.__on_entryProxyUserName_changed,
# "on_entryProxyPassword_changed":self.__on_entryProxyPassword_changed,
"on_comboboxProxyAuthentication_changed":self.__on_comboboxProxyAuthentication_changed
}
self.__wTree.signal_autoconnect(dic)
self.__checkInstalledComponents()
self.__initUploaderTabs()
self.__loadSettings()
self.__window.show()
#hide not yet implemented elements
self.__wTree.get_widget("buttonInstallOptipng").hide()
# self.__wTree.get_widget("label17").hide()
def _destroy(self, widget=None):
"""save changes to db"""
set = self._settings_class
_save_uploader_credentials(self.__accounts.items(), set)
set.setProxyCrednetials(self.__wTree.get_widget("entryProxyUserName").get_text(), self.__wTree.get_widget("entryProxyPassword").get_text())
set.saveSettingsToDB()
def __checkInstalledComponents(self):
from os import system
self.__optipngInstalled = system("command -v optipng") == 0
def __initUploaderTabs(self):
self.__createUploadersTab()
self.__createAccountsTab()
def __loadSettings(self):
self.__comboboxFileType.set_active(0)
if not self.__optipngInstalled:
self.__optipngBox.show()
self.__setComponentsToValues(self._settings_dict)
def __setComponentsToValues(self, settings):
"""set widget to values from given settings"""
self.__wTree.get_widget("checkbuttonOneInstance").set_active(settings["allowOneInstanceOnly"])
self.__wTree.get_widget("spinbuttonHeight").set_value(settings["maximumHeight"])
self.__wTree.get_widget("spinbuttonThumb").set_value(settings["thumbnailSize"])
self.__wTree.get_widget("checkbuttonNotification").set_active(settings["showNotifications"])
self.__wTree.get_widget("checkbuttonIcon").set_active(settings["showIcon"])
self.__wTree.get_widget("checkbuttonBlink").set_active(settings["blinkIcon"])
self.__wTree.get_widget("spinbuttonNumberOfConnections").set_value(settings["maxConnections"])
self.__wTree.get_widget("checkbuttonUseProxy").set_active(False) # needed for Reset calls only, may be later overwritten by setCredentials call
self.__wTree.get_widget("entryProxyAddress").set_text(settings["proxyName"])
self.__wTree.get_widget("entryProxyPort").set_text(str(settings["proxyPort"]))
self.__setCredentialsForUploaders()
self.__setCredentialsForProxy()
self.__wTree.get_widget("comboboxProxyAuthentication").set_active(settings["proxyAuthenticationType"])
clipboardTypeIndeks = self.convertClipoardTypeToIndeks(settings["clipboardType"])
self.__wTree.get_widget("comboboxClipboard").set_active(clipboardTypeIndeks)
fileTypeIndeks = self.convertFileTypeToIndex(settings["fileType"])
#.........这里部分代码省略.........