Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    def _handle_local_options(self, application,
                              options: GLib.VariantDict) -> int:

        logging_helpers.init()

        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)
            self.profile = profile
        if options.contains('separate'):
            self.profile_separation = True
        if options.contains('config-path'):
            self.config_path = options.lookup_value('config-path').get_string()
        if options.contains('version'):
            from gajim import __version__
            print(__version__)
            return 0
        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()
        if options.contains(GLib.OPTION_REMAINING):
            unhandled = options.lookup_value(GLib.OPTION_REMAINING).get_strv()
            print('Error: Unhandled arguments: %s' % unhandled)
            return 0
        return -1
Ejemplo n.º 3
0
'''
Some diverse tests covering functionality in the GUI Interface class.
'''
import unittest

import lib
lib.setup_env()

from gajim.common import logging_helpers
logging_helpers.set_quiet()

from gajim.common import app

from gajim_mocks import MockLogger
app.logger = MockLogger()

from gajim.gui_interface import Interface

from gi.repository import GLib


class TestInterface(unittest.TestCase):
    def test_instantiation(self):
        ''' Test that we can proper initialize and do not fail on globals '''
        def close_app():
            app.app.quit()

        GLib.idle_add(close_app)
        app.app.run()

    def test_links_regexp_entire(self):