def _handle_local_options(self, application, options: GLib.VariantDict) -> int: # Parse all options that have to be executed before ::startup if options.contains('profile'): # Incorporate profile name into application id # to have a single app instance for each profile. profile = options.lookup_value('profile').get_string() app_id = '%s.%s' % (self.get_application_id(), profile) self.set_application_id(app_id) configpaths.set_profile(profile) if options.contains('separate'): configpaths.set_separation(True) if options.contains('config-path'): path = options.lookup_value('config-path').get_string() configpaths.set_config_root(path) configpaths.init() logging_helpers.init() if options.contains('quiet'): logging_helpers.set_quiet() if options.contains('verbose'): logging_helpers.set_verbose() if options.contains('loglevel'): loglevel = options.lookup_value('loglevel').get_string() logging_helpers.set_loglevels(loglevel) if options.contains('warnings'): self.show_warnings() return -1
def setup_env(): # wipe config directory if os.path.isdir(configdir): import shutil shutil.rmtree(configdir) os.mkdir(configdir) os.mkdir(pluginsconfigdir) from gajim.common import configpaths configpaths.set_config_root(configdir) configpaths.init() # for some reason gajim.common.app needs to be imported before xmpppy? from gajim.common import app import logging logging.basicConfig() configpaths.override_path('DATA', gajim_root + '/gajim/data') app.use_x = use_x app.contacts = LegacyContactsAPI() app.connections = {} if use_x: from gajim import gtkgui_helpers gtkgui_helpers.GUI_DIR = gajim_root + '/gajim/data/gui' from gajim.application import GajimApplication app.app = GajimApplication()
def setup_env(use_x=True): # wipe config directory if os.path.isdir(configdir): import shutil shutil.rmtree(configdir) os.mkdir(configdir) os.mkdir(pluginsconfigdir) os.mkdir(themedir) from gajim.common import configpaths configpaths.set_config_root(configdir) configpaths.init() # for some reason gajim.common.app needs to be imported before xmpppy? from gajim.common import app import logging logging.basicConfig() app.use_x = use_x app.contacts = LegacyContactsAPI() app.connections = {} if use_x: from gajim.application import GajimApplication app.app = GajimApplication()
opts = getopt.getopt(sys.argv[1:], shortargs, longargs.split())[0] except getopt.error as msg: print(str(msg)) print('for help use --help') sys.exit(2) for o, a in opts: if o in ('-h', '--help'): print(_('Usage:') + \ '\n gajim-history-manager [options] filename\n\n' + \ _('Options:') + \ '\n -h, --help ' + \ _('Show this help message and exit') + \ '\n -c, --config-path ' + _('Choose folder for logfile') + '\n') sys.exit() elif o in ('-c', '--config-path'): configpaths.set_config_root(a) configpaths.init() from gajim.common import app from gajim.common.const import JIDConstant, KindConstant from gajim.common import helpers from gajim.gtk import YesNoDialog from gajim.gtk import ErrorDialog from gajim.gtk import ConfirmationDialog from gajim.gtk.filechoosers import FileSaveDialog from gajim import gtkgui_helpers @unique class Column(IntEnum):
import time # define _ for i18n import builtins builtins._ = lambda x: x # wipe config directory import os if os.path.isdir(configdir): import shutil shutil.rmtree(configdir) os.mkdir(configdir) from gajim.common import configpaths configpaths.set_config_root(configdir) configpaths.init() # for some reason common.app needs to be imported before xmpppy? configpaths.override_path('DATA', gajim_root + '/gajim/data') # name to use for the test account account_name = 'test' from plugins import PluginManager class PluginManagerTestCase(unittest.TestCase): def setUp(self): self.pluginmanager = PluginManager()