Exemplo n.º 1
0
 def __init__(self):
     print "CoherenceExportExtension", os.getpid()
     try:
         from coherence.ui.av_widgets import DeviceExportWidget
         self.ui = DeviceExportWidget(standalone=False)
         self.ui_create()
     except:
         print "can't setup Coherence connection"
         self.ui = None
    class CoherenceExportExtension(nautilus.MenuProvider):

        def __init__(self):
            print "CoherenceExportExtension", os.getpid()
            try:
                from coherence.ui.av_widgets import DeviceExportWidget
                self.ui = DeviceExportWidget(standalone=False)
                self.ui_create()
            except:
                print "can't setup Coherence connection"
                self.ui = None

        def ui_destroy(self,*args):
            self.window = None

        def ui_create(self):
            import gi
            gi.require_version("Gtk", "3.0")
            from gi.repository import Gtk

            self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
            self.window.set_default_size(350, 300)
            self.window.set_title('Coherence DLNA/UPnP Share')

            self.window.connect("delete_event", self.ui_destroy)

            self.window.add(self.ui.build_ui(root=self.window))

        def get_file_items(self, window, files):
            if self.ui == None:
                return
            if len(files) == 0:
                return

            for file in files:
                if not file.is_directory():
                    return

            item = nautilus.MenuItem('CoherenceExportExtension::export_resources',
                                     'Sharing as a MediaServer...',
                                     'Share the selected folders as a DLNA/UPnP MediaServer')
            item.connect('activate', self.export_resources, files)

            return item,

        def export_resources(self, menu, files):
            if len(files) == 0:
                return

            self.build()

            if self.window == None:
                self.ui_create()

            self.ui.add_files([unquote(file.get_uri()[7:]) for file in files])
            self.window.show_all()
Exemplo n.º 3
0
    class CoherenceExportExtension(nautilus.MenuProvider):

        def __init__(self):
            print "CoherenceExportExtension", os.getpid()
            try:
                from coherence.ui.av_widgets import DeviceExportWidget
                self.ui = DeviceExportWidget(standalone=False)
                self.ui_create()
            except:
                print "can't setup Coherence connection"
                self.ui = None

        def ui_destroy(self,*args):
            self.window = None

        def ui_create(self):
            import pygtk
            pygtk.require("2.0")
            import gtk

            self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
            self.window.set_default_size(350, 300)
            self.window.set_title('Coherence DLNA/UPnP Share')

            self.window.connect("delete_event", self.ui_destroy)

            self.window.add(self.ui.build_ui(root=self.window))

        def get_file_items(self, window, files):
            if self.ui == None:
                return
            if len(files) == 0:
                return

            for file in files:
                if not file.is_directory():
                    return

            item = nautilus.MenuItem('CoherenceExportExtension::export_resources',
                                     'Sharing as a MediaServer...',
                                     'Share the selected folders as a DLNA/UPnP MediaServer')
            item.connect('activate', self.export_resources, files)

            return item,

        def export_resources(self, menu, files):
            if len(files) == 0:
                return

            self.build()

            if self.window == None:
                self.ui_create()

            self.ui.add_files([unquote(file.get_uri()[7:]) for file in files])
            self.window.show_all()
 def __init__(self):
     print "CoherenceExportExtension", os.getpid()
     try:
         from coherence.ui.av_widgets import DeviceExportWidget
         self.ui = DeviceExportWidget(standalone=False)
         self.ui_create()
     except:
         print "can't setup Coherence connection"
         self.ui = None