def test02_instance(self): print("\n>>> Testing _instance") Configuration._set_configuration_filename("rsync_test.cfg") config1 = Configuration() config2 = Configuration() assert config1 == config2 path1 = config1.config_path if platform.system() == "Darwin": assert path1 == os.path.expanduser("~") + "/.config/rsync" elif platform.system() == "Windows": path_expected = os.path.join(os.path.expanduser("~"), "AppData", "Local", "rsync") assert path1 == path_expected elif platform.system() == "Linux": assert path1 == os.path.expanduser("~") + "/.config/rsync" else: assert path1 == os.path.expanduser("~") + "/rsync" assert config1.get_cfg_resource_dir() == os.path.expanduser("~") config1.set_cfg_resource_dir("foo/bar/baz") assert config1.get_cfg_resource_dir() == "foo/bar/baz" config2.persist() config1 = None config2 = None Configuration._set_configuration_filename(None)
def test03_read(self): print("\n>>> Testing read") Configuration._set_configuration_filename("rsync_test.cfg") config1 = Configuration() config2 = Configuration() assert config1.cfg_resource_dir() == "foo/bar/baz" assert config2.cfg_resource_dir() == "foo/bar/baz"
def test04_set_get_language(self): print("\n>>> Testing language") Configuration._set_configuration_filename("rsync_test.cfg") config1 = Configuration() print("current language: " + config1.settings_language()) config1.set_settings_language("foo-BR") print("now the language is: " + config1.settings_language())
def test99_cleanup(self): print("\n>>> Cleaning up") Configuration._set_configuration_filename("rsync_test.cfg") config1 = Configuration() os.remove(config1.config_file) assert not os.path.exists(config1.config_file) config1._instance = None Configuration._set_configuration_filename(None)
def __init__(self, parent): super().__init__(parent) self.config = Configuration() self.le_resourcedir = QLineEdit(self.config.cfg_resource_dir()) self.le_resyncdir = QLineEdit(self.config.cfg_resync_dir()) self.le_sourcedesc = QLineEdit(self.config.cfg_sourcedesc()) self.le_urlprefix = QLineEdit(self.config.cfg_urlprefix()) # self.language_choice = QLabel(_("Interface Language"), self) self.init_ui()
def __init__(self): super().__init__() self.logger = logging.getLogger(__name__) self.config = Configuration() self.menubar = self.menuBar() self.create_menu() self.tabframe = TabbedFrame(self) self.setCentralWidget(self.tabframe) self.resize(self.config.window_width(), self.config.window_height()) self.show()
def __init__(self, args): super().__init__(args) logger.info("Starting application") language = Configuration().settings_language() i18n.set_language(language) self.main_window = RsMainWindow() self.aboutToQuit.connect(self.__before_close__) sys.exit(self.exec_())
def __init__(self, parent): super().__init__(parent) self.config = Configuration() self.initUI()