def __initData__(self): """ @summary: Set data to dialog. """ config = Configuration().getConfiguration() if ((config == None) or (not isinstance(config, ConfigParser.SafeConfigParser))): __log__.error("There isn't configuration in OptionsDialog") return None self.__chkHiddenFiles__.set_active( config.getboolean("NAVIGATOR", "show_hiddens")) self.__chkShowImageList__.set_active( config.getboolean("TABPROJECT", "show_image_list")) self.__spMaxHeight__.set_value( float(config.getint("TABPROJECT", "max_height_list"))) self.__spPercentResize__.set_value( config.getfloat("TABPROJECT", "resize_percent_list")) self.__spNumberColumns__.set_value( float(config.getint("TABPROJECT", "number_of_columns_iconview"))) self.__spHeightImageView__.set_value( float(config.getint("TABPROJECT", "max_height_imagelist"))) self.__chkAddRecursive__.set_active( config.getboolean("UI_CORE", "add_recursive")) self.__spRecursiveLevel__.set_value( config.getint("UI_CORE", "recursive_level")) self.__chkEnablePhotoAlbum__.set_active( config.getboolean("UI_CORE", "enable_db")) if (config.getboolean("UI_CORE", "enable_db") and (ConfigurationDB().getPhotoFolder() != None)): self.__txtPathPhotoAlbum__.set_text( ConfigurationDB().getPhotoFolder()) else: self.__txtPathPhotoAlbum__.set_text("") self.__spMaxHeight__.set_sensitive(self.__chkShowImageList__.get_active()) self.__spPercentResize__.set_sensitive(self.__chkShowImageList__.get_active()) self.__spRecursiveLevel__.set_sensitive(self.__chkAddRecursive__.get_active()) self.__fillLanguages__(False)
def __closeEvent__(self, w, res): """ @summary: Handle response about options dialog. @param w: GtkDialog associated. @param res: Response associated with the event. """ config = Configuration().getConfiguration() if (config == None): __log__.error("It could not recover configuration") res == gtk.RESPONSE_CANCEL if ((res == gtk.RESPONSE_OK) or (res == gtk.RESPONSE_APPLY)): hasChanged = False iter = self.__cbLanguages__.get_active_iter() key = self.__lsLanguages__.get_value(iter, __COLUMN_VALUE__) if (config.get("LANGUAGE", "default") != key): hasChanged = True config.set("LANGUAGE", "default", key) if (config.getboolean("NAVIGATOR", "show_hiddens") != self.__chkHiddenFiles__.get_active()): hasChanged = True config.set("NAVIGATOR", "show_hiddens", ("%d" % self.__chkHiddenFiles__.get_active())) if (config.getboolean("TABPROJECT", "show_image_list") != self.__chkShowImageList__.get_active()): hasChanged = True config.set("TABPROJECT", "show_image_list", ("%d" % self.__chkShowImageList__.get_active())) if (config.getint("TABPROJECT", "max_height_list") != self.__spMaxHeight__.get_value_as_int()): hasChanged = True config.set("TABPROJECT", "max_height_list", ("%d" % self.__spMaxHeight__.get_value_as_int())) if (config.getfloat("TABPROJECT", "resize_percent_list") != self.__spPercentResize__.get_value()): hasChanged = True config.set("TABPROJECT", "resize_percent_list", ("%f" % self.__spPercentResize__.get_value())) if (config.getint("TABPROJECT", "number_of_columns_iconview") != self.__spNumberColumns__.get_value_as_int()): hasChanged = True config.set("TABPROJECT", "number_of_columns_iconview", ("%d" % self.__spNumberColumns__.get_value_as_int())) if (config.getint("TABPROJECT", "max_height_imagelist") != self.__spHeightImageView__.get_value_as_int()): hasChanged = True config.set("TABPROJECT", "max_height_imagelist", ("%d" % self.__spHeightImageView__.get_value_as_int())) if (config.getboolean("UI_CORE", "add_recursive") != self.__chkAddRecursive__.get_active()): hasChanged = True config.set("UI_CORE", "add_recursive", ("%d" % self.__chkAddRecursive__.get_active())) if (config.getint("UI_CORE", "recursive_level") != self.__spRecursiveLevel__.get_value_as_int()): hasChanged = True config.set("UI_CORE", "recursive_level", ("%d" % self.__spRecursiveLevel__.get_value_as_int())) if (config.getint("UI_CORE", "enable_db") != self.__chkEnablePhotoAlbum__.get_active()): hasChanged = True config.set("UI_CORE", "enable_db", ("%d" % self.__chkEnablePhotoAlbum__.get_active())) if (ConfigurationDB().getPhotoFolder() != self.__txtPathPhotoAlbum__.get_text()): hasChanged = True ConfigurationDB().setPhotoFolder(self.__txtPathPhotoAlbum__.get_text()) if (hasChanged): Configuration().saveConfiguration() ConfigurationDB().save() if (self.__callback__ != None): self.__callback__(self if res == gtk.RESPONSE_APPLY else None) if (res != gtk.RESPONSE_APPLY): w.hide()