コード例 #1
0
ファイル: application.py プロジェクト: cunidev/solus-sc
    def __init__(self):
        Gtk.Application.__init__(
            self,
            application_id=SC_APP_ID,
            flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
        self.connect("activate", self.on_activate)
        self.connect("startup", self.startup)
        self.connect("command-line", self.handle_command_line)
        self.connect("handle-local-options", self.handle_local_options)

        option = GLib.OptionEntry()
        option.long_name = "update-view"
        option.short_name = 0
        option.flags = 0
        option.arg = GLib.OptionArg.NONE
        option.arg_data = None
        description = _("Open up the updates view of the application")
        option.description = description
        self.add_main_option_entries([option])

        # Need notifications
        Notify.init("Solus Software Centre")

        # Make sure random is moar betterer
        random.seed(time.time())
コード例 #2
0
ファイル: application.py プロジェクト: shubham2110/gajim1
 def _get_remaining_entry():
     option = GLib.OptionEntry()
     option.arg = GLib.OptionArg.STRING_ARRAY
     option.arg_data = None
     option.arg_description = ('[URI …]')
     option.flags = GLib.OptionFlags.NONE
     option.long_name = GLib.OPTION_REMAINING
     option.short_name = 0
     return [option]
コード例 #3
0
ファイル: app.py プロジェクト: frankjardel/sc-controller
		def aso(long_name, short_name, description,
				arg=GLib.OptionArg.NONE,
				flags=GLib.OptionFlags.IN_MAIN):
			""" add_simple_option, adds program argument in simple way """
			o = GLib.OptionEntry()
			if short_name:
				o.long_name = long_name
				o.short_name = short_name
			o.description = description
			o.flags = flags
			o.arg = arg
			self.add_main_option_entries([o])
コード例 #4
0
def make_option(long_name, short_name=None, flags=0, arg=GLib.OptionArg.NONE,
                arg_data=None, description=None, arg_description=None):
    # surely something like this should exist inside PyGObject itself?!
    option = GLib.OptionEntry()
    option.long_name = long_name.lstrip('-')
    option.short_name = 0 if not short_name else short_name.lstrip('-')
    option.flags = flags
    option.arg = arg
    option.arg_data = arg_data
    option.description = description
    option.arg_description = arg_description
    return option
コード例 #5
0
ファイル: gui.py プロジェクト: schachmett/gxps
def make_option(long_name, short_name=None, arg=GLib.OptionArg.NONE, **kwargs):
    """Make GLib option for the command line. Uses kwargs description, flags,
    arg_data and arg_description."""
    # surely something like this should exist inside PyGObject itself?!
    option = GLib.OptionEntry()
    option.long_name = long_name.lstrip('-')
    option.short_name = 0 if not short_name else ord(short_name.lstrip('-'))
    option.arg = arg
    option.flags = kwargs.get("flags", 0)
    option.arg_data = kwargs.get("arg_data", None)
    option.description = kwargs.get("description", None)
    option.arg_description = kwargs.get("arg_description", None)
    return option
コード例 #6
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args,
                      application_id="org.example.myapp",
                      flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
                      **kwargs)
     self.window = None
     option = GLib.OptionEntry()  #Create GlibOptionEntry object
     #Set option entry attributes: https://lazka.github.io/pgi-docs/GLib-2.0/classes/OptionEntry.html#GLib.OptionEntry
     option.arg_description = "Command line test"
     option.description = "Command line description"
     option.short_name = ord("t")
     option.long_name = "test"
     self.add_main_option_entries([option])
コード例 #7
0
ファイル: view.py プロジェクト: leinardi/gst
def build_glib_option(long_name: str,
                      short_name: Optional[str] = None,
                      flags: int = 0,
                      arg: int = GLib.OptionArg.NONE,
                      arg_data: Optional[object] = None,
                      description: Optional[str] = None,
                      arg_description: Optional[str] = None) -> GLib.OptionEntry:
    option = GLib.OptionEntry()
    option.long_name = long_name
    option.short_name = 0 if not short_name else ord(short_name[0])
    option.flags = flags
    option.description = description
    option.arg = arg
    option.arg_description = arg_description
    option.arg_data = arg_data
    return option
コード例 #8
0
ファイル: app.py プロジェクト: ashed/fontlink
 def _make_option(self,
                  long_name,
                  short_name,
                  description,
                  flags=0,
                  arg=GLib.OptionArg.NONE,
                  arg_data=None,
                  arg_description=None):
     opt = GLib.OptionEntry()
     opt.long_name = long_name
     opt.short_name = short_name
     opt.description = description
     opt.flags = flags
     opt.arg = arg
     opt.arg_data = arg_data
     opt.arg_description = arg_description
     return opt
コード例 #9
0
def make_option(long_name,
                short_name=None,
                flags=0,
                arg=GLib.OptionArg.NONE,
                arg_data=None,
                description=None,
                arg_description=None):
    ''' create struct for commandline options '''
    option = GLib.OptionEntry()
    option.long_name = long_name
    option.short_name = 0 if not short_name else short_name
    option.flags = flags
    option.description = description
    option.arg = arg
    option.arg_description = arg_description
    option.arg_data = arg_data
    return option
コード例 #10
0
 def create_option_entry(self,
                         long_name,
                         short_name=None,
                         flags=0,
                         arg=GLib.OptionArg.NONE,
                         arg_data=None,
                         description=None,
                         arg_description=None,
                         ):
     option = GLib.OptionEntry()
     option.long_name = long_name.lstrip("-")
     option.short_name = 0 if not short_name else ord(short_name.lstrip("-"))
     option.flags = flags
     option.arg = arg
     option.arg_data = arg_data
     option.description = description
     option.arg_description = arg_description
     return option
コード例 #11
0
ファイル: application.py プロジェクト: vdemir/solus-sc
    def __init__(self):
        Gtk.Application.__init__(
            self,
            application_id=SC_APP_ID,
            flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
        self.connect("activate", self.on_activate)
        self.connect("startup", self.startup)
        self.connect("command-line", self.handle_command_line)
        self.connect("handle-local-options", self.handle_local_options)

        option = GLib.OptionEntry()
        option.long_name = "update-view"
        option.short_name = 0
        option.flags = 0
        option.arg = GLib.OptionArg.NONE
        option.arg_data = None
        description = _("Open up the updates view of the application")
        option.description = description
        self.add_main_option_entries([option])
コード例 #12
0
 def _get_option(shortname, longname, description):
     option = GLib.OptionEntry()
     option.short_name = ord(shortname)
     option.long_name = longname
     option.description = description
     return option
コード例 #13
0
ファイル: __main__.py プロジェクト: tjol/sunflower
	def __init__(self):
		self.window = None

		# temporary loading config to find multiple_instances setting
		options = Config('config', common.get_config_path())
		if options.get('multiple_instances'):
			application_id = None # defining no application id enables multiple instances

		# call parent constructor
		Gtk.Application.__init__(
				self,
				application_id=self.application_id,
				flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE
			)

		# load translations
		common.load_translation()

		# create command line option entries
		version_entry = GLib.OptionEntry()
		version_entry.long_name = 'version'
		version_entry.short_name = ord('v')
		version_entry.flags = 0
		version_entry.arg = GLib.OptionArg.NONE
		version_entry.arg_date = None
		version_entry.description = _('Show version number')
		version_entry.arg_description = None

		no_plugins_entry = GLib.OptionEntry()
		no_plugins_entry.long_name = 'no-plugins'
		no_plugins_entry.short_name = ord('p')
		no_plugins_entry.flags = 0
		no_plugins_entry.arg = GLib.OptionArg.NONE
		no_plugins_entry.arg_date = None
		no_plugins_entry.description = _('Skip loading additional plugins')
		no_plugins_entry.arg_description = None

		no_load_tabs_entry = GLib.OptionEntry()
		no_load_tabs_entry.long_name = 'no-load-tabs'
		no_load_tabs_entry.short_name = ord('t')
		no_load_tabs_entry.flags = 0
		no_load_tabs_entry.arg = GLib.OptionArg.NONE
		no_load_tabs_entry.arg_date = None
		no_load_tabs_entry.description = _('Skip loading additional plugins')
		no_load_tabs_entry.arg_description = None

		left_tab_entry = GLib.OptionEntry()
		left_tab_entry.long_name = 'left-tab'
		left_tab_entry.short_name = ord('l')
		left_tab_entry.flags = 0
		left_tab_entry.arg = GLib.OptionArg.STRING_ARRAY
		left_tab_entry.arg_date = None
		left_tab_entry.description = _('Open new tab on the left notebook')
		left_tab_entry.arg_description = None

		right_tab_entry = GLib.OptionEntry()
		right_tab_entry.long_name = 'right-tab'
		right_tab_entry.short_name = ord('r')
		right_tab_entry.flags = 0
		right_tab_entry.arg = GLib.OptionArg.STRING_ARRAY
		right_tab_entry.arg_date = None
		right_tab_entry.description = _('Open new tab on the right notebook')
		right_tab_entry.arg_description = None

		left_terminal_entry = GLib.OptionEntry()
		left_terminal_entry.long_name = 'left-terminal'
		left_terminal_entry.short_name = ord('L')
		left_terminal_entry.flags = 0
		left_terminal_entry.arg = GLib.OptionArg.STRING_ARRAY
		left_terminal_entry.arg_date = None
		left_terminal_entry.description = _('Open terminal tab on the left notebook')
		left_terminal_entry.arg_description = None

		right_terminal_entry = GLib.OptionEntry()
		right_terminal_entry.long_name = 'right-terminal'
		right_terminal_entry.short_name = ord('R')
		right_terminal_entry.flags = 0
		right_terminal_entry.arg = GLib.OptionArg.STRING_ARRAY
		right_terminal_entry.arg_date = None
		right_terminal_entry.description = _('Open terminal tab on the right notebook')
		right_terminal_entry.arg_description = None

		option_entries = [
				version_entry, no_plugins_entry, no_load_tabs_entry,
				left_tab_entry, right_tab_entry, left_terminal_entry,
				right_terminal_entry
			]

		self.add_main_option_entries(option_entries)