| def py::Configuration::Configuration::__init__ | ( | self, | ||
append_root = '' | ||||
| ) |
| def py::Configuration::Configuration::__init_core_configuration | ( | self, | ||
append_root = '' | ||||
| ) | [private] |
00112 : 00113 self.APPLICATION ["name"] = "Qomics" 00114 self.APPLICATION ["version"] = "0.5" 00115 self.APPLICATION ["extra_version"] = "beta4" 00116 00117 ## version of catalog files 00118 self.APPLICATION[ "catalog_version" ] = "1.0" 00119 00120 ## sys configuration 00121 if not LOCALRUN : 00122 self.APPLICATION["locale"] = LOCALEDIR 00123 else : 00124 self.APPLICATION["locale"] = os.path.join( os.path.abspath(append_root + ".."), "locale" ) 00125 self.init_locale() 00126 00127 ## application configuration 00128 if not LOCALRUN : 00129 self.APPLICATION["share_dir"] = PKGDATADIR 00130 else : 00131 self.APPLICATION["share_dir"] = os.path.abspath( append_root + ".." ) 00132 00133 self.APPLICATION ["gfx_dir"] = os.path.join( self.APPLICATION ["share_dir"], "gfx" ) + os.sep 00134 self.APPLICATION ["dtd_dir"] = os.path.join( self.APPLICATION ["share_dir"], "dtd" ) 00135 self.APPLICATION[ "ui_xml" ] = os.path.join( self.APPLICATION[ "gfx_dir" ], "ui.xml" ) 00136 00137 self.APPLICATION ["splash_img"] = os.path.join( self.APPLICATION ["gfx_dir"], "splash.png" ) 00138 00139 self.APPLICATION[ "cover_ext" ] = ".jpg" 00140 self.APPLICATION ["xml_elements"] = { 00141 'editor': 'EDITOR', 00142 'collection': 'COLLECTION', 00143 'comics': 'COMIC', 00144 'author': 'AUTHOR', 00145 'series': 'ASERIES' 00146 } 00147 00148 ## official mirrors 00149 self.APPLICATION[ "mirrors_update" ] = [ 00150 "http://download.gna.org/qomics", 00151 ] 00152 self.APPLICATION[ "mirrors_covers" ] = [ 00153 "http://download.gna.org/qomics", 00154 ] 00155 self.APPLICATION[ "update_root" ] = "/catalog/" + self.APPLICATION[ "catalog_version" ] 00156 self.APPLICATION[ "update_index" ] = self.APPLICATION[ "update_root" ] + "/index.xml.gz" 00157 self.APPLICATION[ "mirror_covers_dir" ] = "/covers/" 00158 00159 self.APPLICATION[ "backend_domain" ] = "qomics.backzone.net" 00160 self.APPLICATION[ "backend_path" ] = "/backend/" 00161 #self.APPLICATION[ "backend_domain" ] = "localhost" 00162 #self.APPLICATION[ "backend_path" ] = "/~panard/qomics/backend/" 00163 00164 # django 00165 os.environ['DJANGO_SETTINGS_MODULE'] = 'qodb.settings' 00166 00167 def __init_user_configuration (self):
| def py::Configuration::Configuration::__init_user_configuration | ( | self | ) | [private] |
00168 : 00169 if sys.platform.startswith( "win" ) : 00170 self.USER["dir"] = os.path.join(os.getenv("APPDATA") or "C:\\Windows\\Application Data", "qomics") 00171 self.USER["home"] = os.getenv("USERPROFILE") or "C:\\Mes Documents" 00172 self.USER["name"] = os.getenv("USERNAME") or "user" 00173 else : 00174 self.USER[ "dir" ] = os.path.join( os.getenv( "HOME" ), ".qomics" ) 00175 self.USER["home"] = os.getenv("HOME") 00176 self.USER["name"] = os.getenv("USER") 00177 self.USER["dir"] = os.getenv("QOMICS_HOME") or self.USER["dir"] 00178 00179 self.USER["dist"] = None 00180 if sys.platform.startswith("win") : 00181 self.USER["dist"] = "windows" 00182 else : 00183 for dist in ["gentoo","debian"] : 00184 for pattern in ["/etc/%s-release", "/etc/%s_version"] : 00185 if os.path.exists(pattern%dist) : 00186 self.USER["dist"] = dist 00187 break 00188 if self.USER["dist"] : 00189 break 00190 00191 self.cfg = QomicsConfig(self) 00192 self.USER[ "conffile" ] = os.path.join( self.USER[ "dir" ], "config" ) 00193 self.USER[ "config" ] = self.cfg 00194 00195 self.USER[ "xml_dir" ] = os.path.join( self.USER[ "dir" ], "xml" ) + os.sep 00196 self.USER["comments_dir"] = os.path.join(self.USER["dir"],"comments") 00197 self.USER["covers_dir"] = os.path.join(self.USER["dir"], "covers") 00198 self.USER["backup_dir"] = os.path.join(self.USER["dir"], "backup") 00199 self.USER[ "overlay" ] = os.path.join( self.USER["dir"], "overlay" ) 00200 self.USER["covers_overlay_dir"] = os.path.join(self.USER["overlay"],"covers") 00201 self.USER[ "overlay_xml" ] = os.path.join( self.USER["overlay"], "xml" ) 00202 self.USER[ "overlay_data" ] = os.path.join( self.USER["overlay"], "data" ) 00203 self.USER["overlay_archive"] = os.path.join(self.USER["overlay"], "overlay.qopak") 00204 00205 self.USER[ "latestout_time" ] = datetime.timedelta( 60 ) 00206 00207 def __read_user_configuration( self ) :
| def py::Configuration::Configuration::__read_user_configuration | ( | self | ) | [private] |
| def py::Configuration::Configuration::upgrade | ( | self, | ||
| notifier | ||||
| ) |
00216 : 00217 config = self.USER[ "config" ] 00218 cur_version = self.APPLICATION[ "version" ] + "," + self.APPLICATION[ "extra_version" ] 00219 conf_version = config.get( "General", "version" ) + "," + config.get( "General", "extra_version" ) 00220 import qo.utils 00221 import qo.upgrade 00222 if qo.utils.is_version_newer(cur_version, conf_version) : 00223 qo.upgrade.all(conf_version, notifier) 00224 config.set( "General", "version", self.APPLICATION[ "version" ] ) 00225 config.set( "General", "extra_version", self.APPLICATION[ "extra_version" ] ) 00226 00227 self.check_scanner() 00228 self.check_profile() 00229 def init_locale( self ) :
| def py::Configuration::Configuration::init_locale | ( | self | ) |
00230 : 00231 if locale.getlocale() == (None,None) : 00232 locale.setlocale(locale.LC_ALL, "fr_FR") 00233 gettext.install( 'qomics', self.APPLICATION["locale"], unicode=1 ) 00234 if sys.platform.startswith('win') : 00235 try : 00236 gettext.translation( 'qomics', self.APPLICATION["locale"], [ locale.getlocale()[0] ] ).install( unicode=1 ) 00237 except IOError : 00238 pass 00239 def __check_cmdline( self, cmdline, fallbacks, f_set ) :
| def py::Configuration::Configuration::__check_cmdline | ( | self, | ||
| cmdline, | ||||
| fallbacks, | ||||
| f_set | ||||
| ) | [private] |
00240 : 00241 program = cmdline.split() 00242 if len( program ) == 0 : 00243 program = "" 00244 else : 00245 program = program[0] 00246 if len(program) == 0 or self.get_program( program ) is None : 00247 program = None 00248 for x in fallbacks : 00249 if self.get_program( x ) is not None : 00250 program = x 00251 break 00252 if program is not None : 00253 f_set( program ) 00254 def get_scanner( self ) :
| def py::Configuration::Configuration::get_scanner | ( | self | ) |
| def py::Configuration::Configuration::set_scanner | ( | self, | ||
| program | ||||
| ) |
| def py::Configuration::Configuration::check_scanner | ( | self | ) |
| def py::Configuration::Configuration::check_profile | ( | self | ) |
00265 : 00266 if self.USER["config"].get( "Profile", "username" ) == "NOTDEF" : 00267 username = self.USER["name"] + str( random.randrange( 0, 9999 ) ).zfill( 4 ) 00268 password = md5.md5( str(random.random()) ).hexdigest() 00269 self.USER['config'].set( "Profile", "username", username ) 00270 self.USER['config'].set( "Profile", "password", password ) 00271 def __apply_user_configuration( self ) :
| def py::Configuration::Configuration::__apply_user_configuration | ( | self | ) | [private] |
| def py::Configuration::Configuration::__save_user_configuration | ( | self | ) | [private] |
| def py::Configuration::Configuration::load | ( | self | ) |
| def py::Configuration::Configuration::save | ( | self | ) |
| def py::Configuration::Configuration::get_dtd_dir | ( | self | ) |
| def py::Configuration::Configuration::get_locale_dir | ( | self | ) |
| def py::Configuration::Configuration::get_home_dir | ( | self | ) |
| def py::Configuration::Configuration::get_user_config | ( | self | ) |
| def py::Configuration::Configuration::get_xml_dirs | ( | self | ) |
| def py::Configuration::Configuration::get_xml_elements | ( | self | ) |
| def py::Configuration::Configuration::get_xml_element | ( | self, | ||
| name | ||||
| ) |
| def py::Configuration::Configuration::get_overlay_xml | ( | self, | ||
| name | ||||
| ) |
| def py::Configuration::Configuration::get_overlay_files | ( | self | ) |
| def py::Configuration::Configuration::get_overlay_archive | ( | self | ) |
| def py::Configuration::Configuration::get_backup_dir | ( | self | ) |
| def py::Configuration::Configuration::get_splash_img | ( | self | ) |
| def py::Configuration::Configuration::get_covers_ext | ( | self | ) |
| def py::Configuration::Configuration::get_cover_overlay | ( | self, | ||
| cover | ||||
| ) |
| def py::Configuration::Configuration::get_cover_official | ( | self, | ||
| cover | ||||
| ) |
| def py::Configuration::Configuration::get_cover_path | ( | self, | ||
| cover | ||||
| ) |
| def py::Configuration::Configuration::get_copy_comment_path | ( | self, | ||
| qoid, | ||||
| copyid | ||||
| ) |
| def py::Configuration::Configuration::get_comment_path | ( | self, | ||
| qoid, | ||||
copyid = None | ||||
| ) |
| def py::Configuration::Configuration::get_updateXML_index | ( | self | ) |
| def py::Configuration::Configuration::get_updateCOVERS_mirrors | ( | self | ) |
| def py::Configuration::Configuration::get_updateCOVERS_dir | ( | self | ) |
| def py::Configuration::Configuration::get_icon | ( | self, | ||
| name | ||||
| ) |
| def py::Configuration::Configuration::set_autosave_comics | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::get_autosave_comics | ( | self | ) |
| def py::Configuration::Configuration::set_autofetch_covers | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::get_autofetch_covers | ( | self | ) |
| def py::Configuration::Configuration::set_autosavepoint | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::get_autosavepoint | ( | self | ) |
| def py::Configuration::Configuration::set_autosend_overlay | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::get_autosend_overlay | ( | self | ) |
| def py::Configuration::Configuration::set_expand_series | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::get_expand_series | ( | self | ) |
| def py::Configuration::Configuration::set_mirrors_update | ( | self, | ||
| mirrors | ||||
| ) |
| def py::Configuration::Configuration::set_mirrors_covers | ( | self, | ||
| mirrors | ||||
| ) |
| def py::Configuration::Configuration::get_latestOut_time | ( | self | ) |
| def py::Configuration::Configuration::get_color | ( | self, | ||
| name | ||||
| ) |
| def py::Configuration::Configuration::set_color | ( | self, | ||
| name, | ||||
| bg, | ||||
| fg | ||||
| ) |
| def py::Configuration::Configuration::get_debug | ( | self | ) |
| def py::Configuration::Configuration::get_version_str | ( | self | ) |
| def py::Configuration::Configuration::get_program | ( | self, | ||
| name | ||||
| ) |
00388 : 00389 if os.path.exists(name) : 00390 return name 00391 path_join = ':' 00392 if sys.platform.startswith('win') : 00393 path_join = ';' 00394 name += '.exe' 00395 for x in os.environ['PATH'].split( path_join ) : 00396 _progpath = os.path.join( x, name ) 00397 if os.path.exists( _progpath ) : 00398 return _progpath 00399 def get_backend_domain( self ) :
| def py::Configuration::Configuration::get_backend_domain | ( | self | ) |
| def py::Configuration::Configuration::get_backend_path | ( | self | ) |
| def py::Configuration::Configuration::set_profile_registered | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::get_profile_registered | ( | self | ) |
| def py::Configuration::Configuration::get_profile_username | ( | self | ) |
| def py::Configuration::Configuration::get_profile_password | ( | self | ) |
| def py::Configuration::Configuration::get_db_engine | ( | self | ) |
| def py::Configuration::Configuration::get_db_name | ( | self | ) |
| def py::Configuration::Configuration::get_db_user | ( | self | ) |
| def py::Configuration::Configuration::get_db_password | ( | self | ) |
| def py::Configuration::Configuration::get_db_host | ( | self | ) |
| def py::Configuration::Configuration::get_db_port | ( | self | ) |
| def py::Configuration::Configuration::set_db_engine | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::set_db_name | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::set_db_user | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::set_db_password | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::set_db_host | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::set_db_port | ( | self, | ||
| value | ||||
| ) |
| def py::Configuration::Configuration::is_first_run | ( | self | ) |
| def py::Configuration::Configuration::get_distribution | ( | self | ) |
tuple py::Configuration::Configuration::xml_dir = property(lambda self: self.USER['xml_dir']) [static] |