コード例 #1
0
ファイル: plugin.py プロジェクト: jchtt/kupfer-adds
 def __init__(self, serverid, name):
     try:
         obj = gio.unix.DesktopAppInfo("gvim.desktop")
     except RuntimeError:
         obj = gio.AppInfo(VIM)
     Leaf.__init__(self, obj, name)
     self.serverid = serverid
コード例 #2
0
 def get_app_info(self,
                  commandline,
                  application_name=None,
                  flags=gio.APP_INFO_CREATE_NONE):
     try:
         return gio.AppInfo(commandline, application_name, flags)
     except:
         print "get app info failed"
コード例 #3
0
 def set_app_from_file(self, file):
     '''
     Установка в буфер приложения для ассоциации на основе файла
     '''
     dirpath = os.path.dirname(file)
     in_path = False
     for i in os.getenv('PATH').split(':'):
         if i == dirpath:
             in_path = True
             break
     if in_path: file = os.path.basename(file)
     self.__set_new_app__(gio.AppInfo(file, os.path.basename(file)))
コード例 #4
0
    def on_add_button_clicked(self, widget):
        dialog = AddAppDialog(self.types[0], widget.get_toplevel())
        if dialog.run() == gtk.RESPONSE_ACCEPT:
            if dialog.get_command_runable():
                we = dialog.get_command_or_appinfo()
                if type(we) == gio.unix.DesktopAppInfo:
                    app = we
                else:
                    app = gio.AppInfo(we)
                for filetype in self.types:
                    app.set_as_default_for_type(filetype)

                self.update_model()
                self.emit('update', self.types)
            else:
                ErrorDialog(_('Could not find %s') %
                            dialog.get_command_or_appinfo(),
                            title=_('Could not find application')).launch()

        dialog.destroy()
コード例 #5
0
ファイル: test_gio.py プロジェクト: NikolenkoAV2020/Selena
 def setUp(self):
     self.appinfo = gio.AppInfo("does-not-exist")
コード例 #6
0
ファイル: quicklists.py プロジェクト: genesi/dockmanager
 def menu_pressed(self, menu_id):
     gio.AppInfo(self.items[self.id_map[menu_id]]).launch()