Example #1
0
 def __init__(self, controls, collback):
     self.collback = collback 
     FControl.__init__(self, controls)        
     ChildTopWindow.__init__(self, _("Equalizer"))
     
     
     self.eq_lines = []
     for label in EQUALIZER_LABLES:
         self.eq_lines.append(EqLine(label, self.on_collback))
         
         
    
     lbox = gtk.VBox(False, 0)
     lbox.show()
     
     self.combo = gtk.combo_box_entry_new_text()
     self.combo.connect("changed", self.on_combo_chage)
     
     lbox.pack_start(self.top_row(), False, False, 0)
     lbox.pack_start(self.middle_lines_box(), False, False, 0)
     
     
     self.add(lbox)
     
     self.models = []
     self.default_models = []
Example #2
0
File: dm.py Project: n0nvme/foobnix
    def __init__(self, controls):
        self.controls = controls
        ChildTopWindow.__init__(self, _("Download Manager"))
        self.set_resizable(True)
        self.set_default_size(900, 700)

        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        #paned = Gtk.HPaned()
        #paned.set_position(200)

        self.navigation = DMNavigationTreeControl()

        self.navigation.append(FDModel(_("All")).add_artist(_("All")).add_status(DOWNLOAD_STATUS_ALL))
        self.navigation.append(FDModel(_("Downloading")).add_artist(_("Downloading")).add_status(DOWNLOAD_STATUS_DOWNLOADING))
        self.navigation.append(FDModel(_("Completed")).add_artist(_("Completed")).add_status(DOWNLOAD_STATUS_COMPLETED))
        self.navigation.append(FDModel(_("Active")).add_artist(_("Active")).add_status(DOWNLOAD_STATUS_ACTIVE))
        self.navigation.append(FDModel(_("Inactive")).add_artist(_("Inactive")).add_status(DOWNLOAD_STATUS_INACTIVE))

        self.dm_list = DownloadManagerTreeControl(self.navigation)
        self.navigation.dm_list = self.dm_list
        #paned.pack1(self.navigation.scroll)
        #paned.pack2(self.dm_list.scroll)
        playback = DMControls(self.controls, self.dm_list)

        vbox.pack_start(playback, False, True, 0)
        #vbox.pack_start(paned, True, True, 0)
        vbox.pack_start(self.dm_list.scroll, True, True, 0)

        self.add(vbox)
        threading.Thread(target = self.dowloader, args = (self.dm_list,)).start()
Example #3
0
    def __init__(self):
        Gtk.Dialog.__init__(self, _("vk.com authorization"), None,
                            Gtk.DialogFlags.MODAL, ())
        ChildTopWindow.__init__(self)
        self.set_size_request(550, -1)
        self.auth_url = "http://oauth.vk.com/oauth/authorize?" + \
                        "redirect_uri=http://oauth.vk.com/blank.html&response_type=token&" + \
                        "client_id=%s&scope=%s" % (self.CLIENT_ID, ",".join(self.SCOPE))
        self.web_view = WebKit2.WebView()

        self.vbox.pack_start(self.web_view, False, False, 0)

        self.web_view.connect('resource-load-finished', self.on_load)
        session = WebKit2.get_default_session()
        if FC().proxy_enable and FC().proxy_url:
            if FC().proxy_user and FC().proxy_password:
                proxy_url = "http://%s:%s@%s" % (
                    FC().proxy_user, FC().proxy_password, FC().proxy_url)
            else:
                proxy_url = "http://%s" % FC().proxy_url
            soup_url = Soup.URI.new(proxy_url)
            session.set_property("proxy-uri", soup_url)
        else:
            session.set_property("proxy-uri", None)

        cookiejar = Soup.CookieJarText.new(cookiefile, False)
        session.add_feature(cookiejar)

        self.access_token = None
        self.user_id = None
        self.on_load_method_finished = False
Example #4
0
    def __init__(self):
        Gtk.Dialog.__init__(self, _("vk.com authorization"), None, Gtk.DialogFlags.MODAL, ())
        ChildTopWindow.__init__(self)
        self.set_size_request(550, -1)
        self.auth_url = "http://oauth.vk.com/oauth/authorize?" + \
                        "redirect_uri=http://oauth.vk.com/blank.html&response_type=token&" + \
                        "client_id=%s&scope=%s" % (self.CLIENT_ID, ",".join(self.SCOPE))
        self.web_view = WebKit.WebView()

        self.vbox.pack_start(self.web_view, False, False, 0)

        self.web_view.connect('resource-load-finished', self.on_load)
        session = WebKit.get_default_session()
        if FC().proxy_enable and FC().proxy_url:
            if FC().proxy_user and FC().proxy_password:
                proxy_url = "http://%s:%s@%s" % (FC().proxy_user, FC().proxy_password, FC().proxy_url)
            else:
                proxy_url = "http://%s" % FC().proxy_url
            soup_url = Soup.URI.new(proxy_url)
            session.set_property("proxy-uri", soup_url)
        else:
            session.set_property("proxy-uri", None)

        cookiejar = Soup.CookieJarText.new(cookiefile, False)
        session.add_feature(cookiejar)

        self.access_token = None
        self.user_id = None
        self.on_load_method_finished = False
Example #5
0
 def __init__(self, controls, collback):
     self.collback = collback 
     FControl.__init__(self, controls)        
     ChildTopWindow.__init__(self, _("Equalizer"))
     
     
     self.eq_lines = []
     for label in EQUALIZER_LABLES:
         self.eq_lines.append(EqLine(label, self.on_collback))
         
         
    
     lbox = gtk.VBox(False, 0)
     lbox.show()
     
     self.combo = gtk.combo_box_entry_new_text()
     self.combo.connect("changed", self.on_combo_chage)
     
     lbox.pack_start(self.top_row(), False, False, 0)
     lbox.pack_start(self.middle_lines_box(), False, False, 0)
     
     
     self.add(lbox)
     
     self.models = []
     self.default_models = []
Example #6
0
    def __init__(self, controls):
        self.controls = controls
        ChildTopWindow.__init__(self, _("Download Manager"))
        self.set_resizable(True)
        self.set_default_size(900, 700)

        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        #paned = Gtk.HPaned()
        #paned.set_position(200)

        self.navigation = DMNavigationTreeControl()

        self.navigation.append(FDModel(_("All")).add_artist(_("All")).add_status(DOWNLOAD_STATUS_ALL))
        self.navigation.append(FDModel(_("Downloading")).add_artist(_("Downloading")).add_status(DOWNLOAD_STATUS_DOWNLOADING))
        self.navigation.append(FDModel(_("Completed")).add_artist(_("Completed")).add_status(DOWNLOAD_STATUS_COMPLETED))
        self.navigation.append(FDModel(_("Active")).add_artist(_("Active")).add_status(DOWNLOAD_STATUS_ACTIVE))
        self.navigation.append(FDModel(_("Inactive")).add_artist(_("Inactive")).add_status(DOWNLOAD_STATUS_INACTIVE))

        self.dm_list = DownloadManagerTreeControl(self.navigation)
        self.navigation.dm_list = self.dm_list
        #paned.pack1(self.navigation.scroll)
        #paned.pack2(self.dm_list.scroll)
        playback = DMControls(self.controls, self.dm_list)

        vbox.pack_start(playback, False, True, 0)
        #vbox.pack_start(paned, True, True)
        vbox.pack_start(self.dm_list.scroll, True, True, 0)

        self.add(vbox)
        thread.start_new_thread(self.dowloader, (self.dm_list,))
Example #7
0
    def __init__(self, controls):
        FControl.__init__(self, controls)

        controls = self.controls
        self.configs.append(MusicLibraryConfig(controls))
        self.configs.append(TabsConfig(controls))
        self.configs.append(LastFmConfig(controls))
        self.configs.append(TrayIconConfig(controls))
        self.configs.append(NetworkConfig(controls))

        try:
            """check keybinder installed, debian"""
            import gi
            gi.require_version('Keybinder', '3.0')
            from gi.repository import Keybinder  #@UnresolvedImport @UnusedImport
            from foobnix.preferences.configs.hotkey_conf import HotKeysConfig
            self.configs.append(HotKeysConfig(controls))
        except Exception as e:
            logging.warn("Keybinder not installed" + str(e))

        self.configs.append(OtherConfig(controls))

        self.label = None

        mainVBox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        ChildTopWindow.__init__(self, _("Preferences"), 900, 550)

        paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
        paned.set_position(250)

        def func():
            bean = self.navigation.get_selected_bean()
            if bean:
                self.populate_config_category(bean.text)

        self.navigation = SimpleListTreeControl(_("Categories"), controls,
                                                True)

        for plugin in self.configs:
            self.navigation.append(FDModel(plugin.name))

        self.navigation.set_left_click_func(func)

        paned.add1(self.navigation.scroll)

        cbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        for plugin in self.configs:
            cbox.pack_start(plugin.widget, False, True, 0)

        self._container = self.create_container(cbox)
        paned.add2(self._container)

        mainVBox.pack_start(paned, True, True, 0)
        mainVBox.pack_start(self.create_save_cancel_buttons(), False, False, 0)

        #self.add(mainVBox)
        GLib.idle_add(self.add, mainVBox)
Example #8
0
    def __init__(self, title):
        ChildTopWindow.__init__(self, title)

        """ get foobnix icon path"""
        try:
            self.set_icon_from_file(self.get_fobnix_logo())
            gtk.window_set_default_icon_from_file(self.get_fobnix_logo())
        except TypeError:
            pass
Example #9
0
    def __init__(self, controls, on_hide_callback):
        self.controls = controls
        ChildTopWindow.__init__(self, "movie")
        self.set_hide_on_escape(False)
        self.on_hide_callback = on_hide_callback
        ## TODO: check it
        ##self.set_flags(Gtk.CAN_FOCUS)
        self.layout = Gtk.VBox(False)
        self.set_property("skip-taskbar-hint", True)
        self.set_keep_above(True)
        self.draw = AdvancedDrawingArea(controls)
        self.draw.action_function = on_hide_callback
        self.set_resizable(True)
        self.set_border_width(0)

        self.layout.pack_start(self.draw, True, False, 0)

        self.text_label = Gtk.Label("foobnix")
        self.volume_button = Gtk.VolumeButton()
        self.volume_button.connect("value-changed", self.volume_changed)

        line = Gtk.HBox(False)
        line.pack_start(
            ImageButton(Gtk.STOCK_FULLSCREEN, on_hide_callback,
                        _("Exit Fullscrean")), False, False, 0)
        line.pack_start(PlaybackControls(controls), False, False, 0)
        line.pack_start(controls.seek_bar_movie, True, False, 0)
        line.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
        line.pack_start(self.text_label, False, False, 0)
        line.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
        line.pack_start(self.volume_button, False, False, 0)
        line.show_all()

        control_panel = Gtk.Window(Gtk.WindowType.POPUP)
        control_panel.set_size_request(800, -1)
        control_panel.add(line)

        self.add(self.layout)

        self.draw.connect("enter-notify-event",
                          lambda *a: GLib.idle_add(control_panel.hide))

        def my_event(w, e):
            if e.y > Gdk.screen_height() - 5:  #@UndefinedVariable

                def safe_task():
                    control_panel.show()
                    control_panel.set_size_request(Gdk.screen_width(),
                                                   -1)  #@UndefinedVariable
                    control_panel.move(0,
                                       Gdk.screen_height() -
                                       control_panel.get_allocation().height
                                       )  #@UndefinedVariable

                GLib.idle_add(safe_task)

        self.connect("motion-notify-event", my_event)
Example #10
0
 def __init__(self, controls, on_hide_callback):
     ChildTopWindow.__init__(self, "movie")
     self.set_hide_on_escape(False)
     self.on_hide_callback = on_hide_callback
     
     self.drow = AdvancedDrawingArea(controls)
     self.drow.action_function = on_hide_callback 
     self.set_resizable(True)
     self.set_border_width(0)
     
     self.add(self.drow)
Example #11
0
    def __init__(self):
        ChildTopWindow.__init__(self, _("Tag Editor"))
        self.set_resizable(True)
        self.set_default_size(400, 150)
        
        artist_label = gtk.Label(_("Artist"))
        title_label = gtk.Label(_("Title"))
        album_label = gtk.Label(_("Album"))
        date_label = gtk.Label(_("Year"))
        tracknumber_label = gtk.Label(_("Track number"))
        genre_label = gtk.Label(_("Genre"))
        author_label = gtk.Label(_("Author text"))
        composer_label = gtk.Label(_("Composer"))

        self.tag_names = ["artist", "title", "album", "date", "tracknumber", "genre", "author", "composer"]

        self.tag_entries = []
        
        self.labels = []

        for tag_name in self.tag_names:
    
            vars()[tag_name + "_entry"] = gtk.Entry()
            self.tag_entries.append(vars()[tag_name + "_entry"])
    
            self.labels.append(vars()[tag_name + "_label"])
    
        lvbox = gtk.VBox(True, 7)
        rvbox = gtk.VBox(True, 7)
        hpan = gtk.HPaned()
        
        for label, tag_entry in zip(self.labels, self.tag_entries):
            lvbox.pack_start(label)
            rvbox.pack_start(tag_entry)
    
        hpan.pack1(lvbox)
        hpan.pack2(rvbox)

        save_button = gtk.Button(_("Save"))
        cancel_button = gtk.Button(_("Cancel"))

        buttons_hbox = gtk.HBox(True, 10)
        buttons_hbox.pack_start(save_button)
        buttons_hbox.pack_start(cancel_button)
        
        vbox = gtk.VBox(False, 15)
        vbox.pack_start(hpan)
        vbox.pack_start(buttons_hbox, True, True, 10)
        
        save_button.connect("clicked", self.save_audio_tags)
        cancel_button.connect_object("clicked", gtk.Widget.destroy, self)
        
        self.add(vbox)
        self.show_all()
Example #12
0
        def __init__(self, controls, on_hide_callback):
            self.controls = controls
            ChildTopWindow.__init__(self, "movie")
            self.set_hide_on_escape(False)
            self.on_hide_callback = on_hide_callback
            ## TODO: check it
            ##self.set_flags(Gtk.CAN_FOCUS)
            self.layout = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
            self.set_property("skip-taskbar-hint", True)
            self.set_keep_above(True)
            self.draw = AdvancedDrawingArea(controls)
            self.draw.action_function = on_hide_callback
            self.set_resizable(True)
            self.set_border_width(0)

            self.layout.pack_start(self.draw, True, False, 0)

            self.text_label = Gtk.Label.new("foobnix")
            self.volume_button = Gtk.VolumeButton.new()
            self.volume_button.connect("value-changed", self.volume_changed)

            line = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
            line.pack_start(ImageButton("view-fullscreen", on_hide_callback, _("Exit Fullscrean")), False, False, 0)
            line.pack_start(PlaybackControls(controls), False, False, 0)
            line.pack_start(controls.seek_bar_movie, True, False, 0)
            line.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
            line.pack_start(self.text_label, False, False, 0)
            line.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
            line.pack_start(self.volume_button, False, False, 0)
            line.show_all()

            control_panel = Gtk.Window(Gtk.WindowType.POPUP)
            control_panel.set_size_request(800, -1)
            control_panel.add(line)

            self.add(self.layout)

            self.draw.connect("enter-notify-event", lambda *a: GLib.idle_add(control_panel.hide))

            def my_event(w, e):
                if e.y > Gdk.screen_height() - 5: #@UndefinedVariable
                    def safe_task():
                        control_panel.show()
                        control_panel.set_size_request(Gdk.screen_width(), -1)#@UndefinedVariable
                        control_panel.move(0, Gdk.screen_height() - control_panel.get_allocation().height)#@UndefinedVariable
                    GLib.idle_add(safe_task)

            self.connect("motion-notify-event", my_event)
Example #13
0
 def on_delete(self, *a):
     active_id = self.combobox.get_active()
     rem_icon = self.entry.get_text()
     iter = self.modconst.model.get_iter(active_id)
     try:
         if self.all_icons.index(rem_icon) > 4:
             self.all_icons.remove(rem_icon)
             self.modconst.delete_icon(iter)
             self.combobox.set_active(0)
         else:
             error_window = ChildTopWindow("Error")
             label = Gtk.Label("You can not remove a standard icon")
             error_window.add(label)
             error_window.show()
     except ValueError, e:
         logging.error("There is not such icon in the list" + str(e))
Example #14
0
 def __init__(self, controls, on_hide_callback):
     self.controls = controls
     ChildTopWindow.__init__(self, "movie")
     self.set_hide_on_escape(False)
     self.on_hide_callback = on_hide_callback
     self.set_flags(gtk.CAN_FOCUS)
     self.layout = gtk.VBox(False)
     self.set_property("skip-taskbar-hint", True)
     self.set_keep_above(True)
     self.draw = AdvancedDrawingArea(controls)
     self.draw.action_function = on_hide_callback 
     self.set_resizable(True)
     self.set_border_width(0)
     
     self.layout.pack_start(self.draw, True)
                 
     self.text_label = gtk.Label("foobnix")
     self.volume_button= gtk.VolumeButton()
     self.volume_button.connect("value-changed", self.volume_changed)
     
     line = gtk.HBox(False)            
     line.pack_start(ImageButton(gtk.STOCK_FULLSCREEN, on_hide_callback, _("Exit Fullscrean")), False)
     line.pack_start(PlaybackControls(controls), False)
     line.pack_start(controls.seek_bar_movie, True)
     line.pack_start(gtk.SeparatorToolItem(),False)
     line.pack_start(self.text_label, False)
     line.pack_start(gtk.SeparatorToolItem(),False)
     line.pack_start(self.volume_button, False)
     line.show_all()
     
     control_panel = gtk.Window(gtk.WINDOW_POPUP)
     control_panel.set_size_request(800, -1)
     control_panel.add(line)
     
     self.add(self.layout)
                
     self.draw.connect("enter-notify-event", lambda *a: gobject.idle_add(control_panel.hide))
     
     def my_event(w, e):
         if e.y > gtk.gdk.screen_height() - 5: #@UndefinedVariable
             def safe_task():
                 control_panel.show()
                 control_panel.set_size_request(gtk.gdk.screen_width(), -1)#@UndefinedVariable
                 control_panel.move(0, gtk.gdk.screen_height() - control_panel.get_allocation().height)#@UndefinedVariable
             gobject.idle_add(safe_task)
             
     self.connect("motion-notify-event", my_event)
Example #15
0
    def __init__(self, controls, on_hide_callback):
        self.controls = controls
        ChildTopWindow.__init__(self, "movie")
        self.set_hide_on_escape(False)
        self.on_hide_callback = on_hide_callback

        self.layout = gtk.VBox(False)

        self.drow = AdvancedDrawingArea(controls)
        self.drow.action_function = on_hide_callback
        self.set_resizable(True)
        self.set_border_width(0)

        self.layout.pack_start(self.drow, True)

        self.text_label = gtk.Label("foobnix")
        self.volume_button = gtk.VolumeButton()
        self.volume_button.connect("value-changed", self.volume_changed)

        line = gtk.HBox(False)

        line.pack_start(
            ImageButton(gtk.STOCK_FULLSCREEN, on_hide_callback,
                        _("Exit Fullscrean")), False)
        line.pack_start(PlaybackControls(controls), False)
        line.pack_start(controls.seek_bar_movie, True)
        line.pack_start(gtk.SeparatorToolItem(), False)
        line.pack_start(self.text_label, False)
        line.pack_start(gtk.SeparatorToolItem(), False)
        line.pack_start(self.volume_button, False)

        self.layout.pack_start(line, False)

        self.add(self.layout)
        self.set_opacity(1)

        def my_event(w, e):
            if e.y > gtk.gdk.screen_height() - 50:  #@UndefinedVariable
                line.show()
            else:
                line.hide()

        self.connect("motion-notify-event", my_event)
Example #16
0
 def __init__(self, controls, on_hide_callback):
     self.controls = controls
     ChildTopWindow.__init__(self, "movie")
     self.set_hide_on_escape(False)
     self.on_hide_callback = on_hide_callback
     
     self.layout = gtk.VBox(False)
     
     self.drow = AdvancedDrawingArea(controls)
     self.drow.action_function = on_hide_callback 
     self.set_resizable(True)
     self.set_border_width(0)
     
     self.layout.pack_start(self.drow, True)
     
     
     self.text_label = gtk.Label("foobnix")
     self.volume_button= gtk.VolumeButton()
     self.volume_button.connect("value-changed", self.volume_changed)
     
     line = gtk.HBox(False)            
      
     line.pack_start(ImageButton(gtk.STOCK_FULLSCREEN, on_hide_callback, _("Exit Fullscrean")), False)
     line.pack_start(PlaybackControls(controls), False)
     line.pack_start(controls.seek_bar_movie, True)
     line.pack_start(gtk.SeparatorToolItem(),False)
     line.pack_start(self.text_label, False)
     line.pack_start(gtk.SeparatorToolItem(),False)
     line.pack_start(self.volume_button, False)
     
     self.layout.pack_start(line,False)
     
     self.add(self.layout)
     self.set_opacity(1)
     
     def my_event(w, e):
         if e.y > gtk.gdk.screen_height() - 50: #@UndefinedVariable
             line.show()
         else:
             line.hide()          
     
     self.connect("motion-notify-event", my_event)
Example #17
0
 def __init__(self, controls):
     ChildTopWindow.__init__(self, "Progress", 500, 100)
     
     self.set_transient_for(controls.main_window)
     
     self.label = gtk.Label("Total analyzed folders: ")
     self.label1 = gtk.Label("Total analyzed files: ")
     self.label2 = gtk.Label("Folders with media files found: ")
     self.label3 = gtk.Label("Media files found: ")
     
     self.analyzed_files_label = gtk.Label("0")
     self.analyzed_folders_label = gtk.Label("0")
     self.media_files_label = gtk.Label("0")
     self.media_folders_label = gtk.Label("0")
     
     self.analyzed_files = 0
     self.analyzed_folders = 0
     self.media_files = 0
     self.media_folders = 0
     
     left_box = gtk.VBox()
     left_box.pack_start(self.label)
     left_box.pack_start(self.label1)
     left_box.pack_start(self.label2)
     left_box.pack_start(self.label3)
     
     right_box = gtk.VBox()
     right_box.pack_start(self.analyzed_folders_label)
     right_box.pack_start(self.analyzed_files_label)
     right_box.pack_start(self.media_folders_label)
     right_box.pack_start(self.media_files_label)
     
     box = gtk.HBox()
     box.pack_start(left_box)
     box.pack_start(right_box)
     
     self.add(box)
     
     gobject.idle_add(self.show_all)
Example #18
0
    def __init__(self, controls):
        ChildTopWindow.__init__(self, "Progress", 500, 100)

        self.set_transient_for(controls.main_window)

        self.label = Gtk.Label.new("Total analyzed folders: ")
        self.label1 = Gtk.Label.new("Total analyzed files: ")
        self.label2 = Gtk.Label.new("Folders with media files found: ")
        self.label3 = Gtk.Label.new("Media files found: ")

        self.analyzed_files_label = Gtk.Label.new("0")
        self.analyzed_folders_label = Gtk.Label.new("0")
        self.media_files_label = Gtk.Label.new("0")
        self.media_folders_label = Gtk.Label.new("0")

        self.analyzed_files = 0
        self.analyzed_folders = 0
        self.media_files = 0
        self.media_folders = 0

        left_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        left_box.pack_start(self.label, False, False, 0)
        left_box.pack_start(self.label1, False, False, 0)
        left_box.pack_start(self.label2, False, False, 0)
        left_box.pack_start(self.label3, False, False, 0)

        right_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        right_box.pack_start(self.analyzed_folders_label, False, False, 0)
        right_box.pack_start(self.analyzed_files_label, False, False, 0)
        right_box.pack_start(self.media_folders_label, False, False, 0)
        right_box.pack_start(self.media_files_label, False, False, 0)

        box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        box.pack_start(left_box, False, False, 0)
        box.pack_start(right_box, False, False, 0)

        self.add(box)

        self.show_all()
Example #19
0
    def __init__(self, controls):
        ChildTopWindow.__init__(self, "Progress", 500, 100)

        self.set_transient_for(controls.main_window)

        self.label = Gtk.Label.new("Total analyzed folders: ")
        self.label1 = Gtk.Label.new("Total analyzed files: ")
        self.label2 = Gtk.Label.new("Folders with media files found: ")
        self.label3 = Gtk.Label.new("Media files found: ")

        self.analyzed_files_label = Gtk.Label.new("0")
        self.analyzed_folders_label = Gtk.Label.new("0")
        self.media_files_label = Gtk.Label.new("0")
        self.media_folders_label = Gtk.Label.new("0")

        self.analyzed_files = 0
        self.analyzed_folders = 0
        self.media_files = 0
        self.media_folders = 0

        left_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        left_box.pack_start(self.label, False, False, 0)
        left_box.pack_start(self.label1, False, False, 0)
        left_box.pack_start(self.label2, False, False, 0)
        left_box.pack_start(self.label3, False, False, 0)

        right_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        right_box.pack_start(self.analyzed_folders_label, False, False, 0)
        right_box.pack_start(self.analyzed_files_label, False, False, 0)
        right_box.pack_start(self.media_folders_label, False, False, 0)
        right_box.pack_start(self.media_files_label, False, False, 0)

        box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        box.pack_start(left_box, False, False, 0)
        box.pack_start(right_box, False, False, 0)

        self.add(box)

        self.show_all()
Example #20
0
    def __init__(self, controls):
        ChildTopWindow.__init__(self, "Progress", 500, 100)

        self.set_transient_for(controls.main_window)

        self.label = Gtk.Label("Total analyzed folders: ")
        self.label1 = Gtk.Label("Total analyzed files: ")
        self.label2 = Gtk.Label("Folders with media files found: ")
        self.label3 = Gtk.Label("Media files found: ")

        self.analyzed_files_label = Gtk.Label("0")
        self.analyzed_folders_label = Gtk.Label("0")
        self.media_files_label = Gtk.Label("0")
        self.media_folders_label = Gtk.Label("0")

        self.analyzed_files = 0
        self.analyzed_folders = 0
        self.media_files = 0
        self.media_folders = 0

        left_box = Gtk.VBox()
        left_box.pack_start(self.label)
        left_box.pack_start(self.label1)
        left_box.pack_start(self.label2)
        left_box.pack_start(self.label3)

        right_box = Gtk.VBox()
        right_box.pack_start(self.analyzed_folders_label)
        right_box.pack_start(self.analyzed_files_label)
        right_box.pack_start(self.media_folders_label)
        right_box.pack_start(self.media_files_label)

        box = Gtk.HBox()
        box.pack_start(left_box)
        box.pack_start(right_box)

        self.add(box)

        self.show_all()
Example #21
0
    def __init__(self, controls, callback):
        self.callback = callback
        FControl.__init__(self, controls)
        ChildTopWindow.__init__(self, _("Equalizer"))

        self.combo = Gtk.ComboBoxText.new_with_entry()
        self.combo.connect("changed", self.on_combo_change)

        self.eq_lines = []
        for label in EQUALIZER_LABLES:
            self.eq_lines.append(EqLine(label, self.on_callback))

        lbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        lbox.show()

        lbox.pack_start(self.top_row(), False, False, 0)
        lbox.pack_start(self.middle_lines_box(), False, False, 0)

        self.add(lbox)

        self.models = []
        self.default_models = []
Example #22
0
    def __init__(self, controls, callback):
        self.callback = callback
        FControl.__init__(self, controls)
        ChildTopWindow.__init__(self, _("Equalizer"))

        self.combo = Gtk.ComboBoxText.new_with_entry()
        self.combo.connect("changed", self.on_combo_change)

        self.eq_lines = []
        for label in EQUALIZER_LABLES:
            self.eq_lines.append(EqLine(label, self.on_callback))

        lbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        lbox.show()

        lbox.pack_start(self.top_row(), False, False, 0)
        lbox.pack_start(self.middle_lines_box(), False, False, 0)

        self.add(lbox)

        self.models = []
        self.default_models = []
Example #23
0
 def on_delete(self, *a):
     active_id = self.combobox.get_active()
     rem_icon = self.entry.get_text()
     iter = self.modconst.model.get_iter(active_id)
     try:
         if self.all_icons.index(rem_icon) > 4:
             self.all_icons.remove(rem_icon)
             self.modconst.delete_icon(iter)
             self.combobox.set_active(0)
         else:
             error_window = ChildTopWindow("Error")
             label = gtk.Label("You can not remove a standard icon")
             error_window.add(label)
             error_window.show()
     except ValueError, e:
         logging.error("There is not such icon in the list" + str(e))
Example #24
0
    def __init__(self, service):
        self.service = service
        ChildTopWindow.__init__(
            self, _("VKontakte Authorization (require for music search)"))
        self.set_resizable(True)
        vbox = gtk.VBox(False, 0)
        self.access_token = None

        default_button = gtk.Button(_("Get Login and Password"))
        default_button.connect("clicked", self.on_defaults)

        def web_kit_token():
            import webkit
            self.web_view = webkit.WebView()
            self.web_view.set_size_request(640, -1)

            self.web_view.load_uri(self.get_web_url())
            self.web_view.connect("navigation-policy-decision-requested",
                                  self._nav_request_policy_decision_cb)

            vbox.pack_start(self.web_view, True, True)
            vbox.pack_start(default_button, False, False)

        def dialog_token():
            self.set_keep_above(True)
            self.token = gtk.Entry()
            self.set_size_request(550, -1)
            self.user_id = gtk.Entry()
            if FC().user_id:
                self.user_id.set_text(FC().user_id)

            edit = gtk.Entry()
            edit.set_text(self.API_URL)
            link = gtk.LinkButton(self.API_URL, _("Open"))

            line = gtk.HBox(False, 0)
            line.pack_start(edit, True, True)
            line.pack_start(link, False, False)

            apply = gtk.Button(_("2: Apply Token"))
            apply.connect("clicked", self.on_apply)

            self.info_line = gtk.Label(_("Please generate token..."))

            vbox.pack_start(ImageBase("vk.png"), False, False)
            vbox.pack_start(line, False, False)

            vbox.pack_start(HBoxLableEntry(gtk.Label(_("Token:")), self.token))
            vbox.pack_start(
                HBoxLableEntry(gtk.Label(_("User ID:")), self.user_id))

            vbox.pack_start(apply, False, False)
            vbox.pack_start(self.info_line, False, False)

        if os.name == 'nt':
            dialog_token()
        else:
            try:
                web_kit_token()
            except:
                dialog_token()

        self.add(vbox)
Example #25
0
    def __init__(self):
        ChildTopWindow.__init__(self, _("Tag Editor"))
        self.set_resizable(True)
        self.set_default_size(430, 150)
        
        artist_label = gtk.Label(_("Artist"))
        title_label = gtk.Label(_("Title"))
        album_label = gtk.Label(_("Album"))
        date_label = gtk.Label(_("Year"))
        tracknumber_label = gtk.Label(_("Track number"))
        genre_label = gtk.Label(_("Genre"))
        author_label = gtk.Label(_("Author text"))
        composer_label = gtk.Label(_("Composer"))
        
        self.paths = []
        self.tag_names = ["artist", "title", "album", "date", "tracknumber", "genre", "author", "composer"]
        self.tag_mp4_names = ['\xa9ART', '\xa9nam', '\xa9alb', '\xa9day', 'trkn', '\xa9gen', '', '\xa9wrt']
        self.tag_entries = []
        self.labels = []
        self.toggle_buttons = []
        self.hboxes = []
           
        for tag_name in self.tag_names:
    
            vars()[tag_name + "_entry"] = gtk.Entry()
            self.tag_entries.append(vars()[tag_name + "_entry"])
    
            self.labels.append(vars()[tag_name + "_label"])
            
            vars()[tag_name + "_tbutton"] = gtk.ToggleButton()
            self.toggle_buttons.append(vars()[tag_name + "_tbutton"])
            tbutton_image = gtk.image_new_from_stock(gtk.STOCK_COPY, gtk.ICON_SIZE_SMALL_TOOLBAR)
            
            toggle_button = self.toggle_buttons[-1]
            toggle_button.add(tbutton_image)
            
            toggle_button.set_focus_on_click(False) 
            toggle_button.set_tooltip_text(_("Apply for all selected tracks"))
            
            vars()[tag_name + "_hbox"] = gtk.HBox(False, 5)
            self.hboxes.append(vars()[tag_name + "_hbox"])
            
            self.hboxes[-1].pack_end(toggle_button,False,False)
            self.hboxes[-1].pack_end(self.tag_entries[-1],True,True)
            
    
        lvbox = gtk.VBox(True, 7)
        rvbox = gtk.VBox(True, 7)
        hpan = gtk.HPaned()
        
        for label, hbox in zip(self.labels, self.hboxes):
            lvbox.pack_start(label)
            rvbox.pack_start(hbox)
    
        hpan.pack1(lvbox)
        hpan.pack2(rvbox)

        apply_button = gtk.Button(_("Apply"))
        close_button = gtk.Button(_("Close"))

        buttons_hbox = gtk.HBox(True, 10)
        buttons_hbox.pack_start(apply_button)
        buttons_hbox.pack_start(close_button)
        
        vbox = gtk.VBox(False, 15)
        vbox.pack_start(hpan)
        vbox.pack_start(buttons_hbox, True, True, 10)
        
        apply_button.connect("clicked", self.save_audio_tags, self.paths)
        close_button.connect("clicked", lambda *a: self.hide())
        
        self.add(vbox)
        self.show_all()
Example #26
0
    def __init__(self):
        ChildTopWindow.__init__(self,
                                title="Audio Converter",
                                width=500,
                                height=400)

        self.area = ScrolledText()
        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 10)
        vbox.pack_start(self.area.scroll, False, False, 0)
        vbox.show()
        format_label = Gtk.Label.new(_('Format'))
        bitrate_label = Gtk.Label.new(_('Bitrate'))
        channels_label = Gtk.Label.new(_('Channels'))
        hertz_label = Gtk.Label.new(_('Frequency'))

        format_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        bitrate_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        channels_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        hertz_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        self.format_list = [
            "Choose", "  mp3", "  ogg", "  mp2", "  ac3", "  m4a", "  wav"
        ]
        self.bitrate_list = [
            "  64 kbps", "  96 kbps", "  128 kbps", "  160 kbps", "  192 kbps",
            "  224 kbps", "  256 kbps", "  320 kbps", "  384 kbps",
            "  448 kbps", "  640 kbps"
        ]
        self.channels_list = ["  1", "  2", "  6"]
        self.hertz_list = [
            "  22050 Hz", "  44100 Hz", "  48000 Hz", "  96000 Hz"
        ]

        self.format_combo = combobox_constr(self.format_list)
        self.format_combo.connect("changed", self.on_change_format)

        self.bitrate_combo = combobox_constr()
        self.channels_combo = combobox_constr()
        self.hertz_combo = combobox_constr()

        format_box.pack_start(format_label, False, False, 0)
        format_box.pack_start(self.format_combo, False, False, 0)
        bitrate_box.pack_start(bitrate_label, False, False, 0)
        bitrate_box.pack_start(self.bitrate_combo, False, False, 0)
        channels_box.pack_start(channels_label, False, False, 0)
        channels_box.pack_start(self.channels_combo, False, False, 0)
        hertz_box.pack_start(hertz_label, False, False, 0)
        hertz_box.pack_start(self.hertz_combo, False, False, 0)

        hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 30)
        hbox.pack_start(format_box, False, False, 0)
        hbox.pack_start(bitrate_box, False, False, 0)
        hbox.pack_start(channels_box, False, False, 0)
        hbox.pack_start(hertz_box, False, False, 0)
        hbox.set_border_width(10)
        hbox.show_all()

        vbox.pack_start(hbox, False, False, 0)

        self.button_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 10)
        close_button = Gtk.Button.new_with_label(_("Close"))
        close_button.set_size_request(150, 30)
        close_button.connect("clicked", lambda *a: self.hide())
        self.convert_button = Gtk.Button.new_with_label(_("Convert"))
        self.convert_button.set_size_request(150, 30)
        self.convert_button.connect("clicked", self.save)

        self.progressbar = Gtk.ProgressBar()

        self.stop_button = Gtk.Button.new_with_label(_("Stop"))
        self.stop_button.set_size_request(100, 30)
        self.stop_button.connect("clicked", self.on_stop)

        self.open_folder_button = Gtk.Button.new_with_label(_("Show files"))
        self.open_folder_button.connect('released', self.open_in_fm)

        self.progress_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        self.progress_box.pack_end(self.open_folder_button, False, False, 0)
        self.progress_box.pack_end(self.stop_button, False, False, 0)
        self.progress_box.pack_end(self.progressbar, True, False, 0)

        self.output = ScrolledText()
        self.output.text.set_size_request(-1, 50)
        self.output.scroll.set_size_request(-1, 50)
        self.output.scroll.set_placement(Gtk.CornerType.BOTTOM_LEFT)
        vbox.pack_start(self.progress_box, False, False, 0)

        self.button_box.pack_end(self.convert_button, False, False, 0)
        self.button_box.pack_end(close_button, False, False, 0)

        self.button_box.show_all()

        vbox.pack_start(self.button_box, False, False, 0)
        vbox.pack_start(self.output.scroll, False, False, 0)
        self.add(vbox)
Example #27
0
    def __init__(self, service):
        self.service = service
        ChildTopWindow.__init__(self, _("VKontakte Authorization (require for music search)"))
        self.set_resizable(True)
        vbox = gtk.VBox(False, 0)
        self.access_token = None
        
        default_button = gtk.Button(_("Get Login and Password"))
        default_button.connect("clicked", self.on_defaults)
        
        apply_button = gtk.Button(_("Sing In"))
        apply_button.connect("clicked", self.on_apply_vk)
        self.finished = False

        
        def web_kit_token():
            import webkit            
            self.web_view = webkit.WebView()
            self.web_view.set_size_request(640, -1) 
            
            self.web_view.load_uri(self.get_web_url())
            self.web_view.connect("navigation-policy-decision-requested", self._nav_request_policy_decision_cb)
            self.web_view.connect("load-finished", self.load_finished)
            
               
            vbox.pack_start(self.web_view, True, True)
            
            
            """VK"""
        
            vk_frame = gtk.Frame(label=_("VKontakte"))
            vk_frame.set_border_width(0)
            
            vk_layout = gtk.VBox(False, 0)
            
            """VK LOGIN"""
            vlbox = gtk.HBox(False, 0)
            vlbox.show()
            
            vlogin = gtk.Label(_("Login"))
            vlogin.set_size_request(150, -1)
            vlogin.show()
            
            
            self.vlogin_text = gtk.Entry()
            self.vlogin_text.show()
            
            vlbox.pack_start(vlogin, False, False, 0)
            vlbox.pack_start(self.vlogin_text, True, True, 0)
            
            """VK PASSWORD"""
            vpbox = gtk.HBox(False, 0)
            vpbox.show()
            
            vpassword = gtk.Label(_("Password"))
            vpassword.set_size_request(150, -1)
            vpassword.show()
            
            self.vpassword_text = gtk.Entry()
            self.vpassword_text.set_visibility(False)
            self.vpassword_text.set_invisible_char("*")
            self.vpassword_text.show()
            
            vpbox.pack_start(vpassword, False, False, 0)
            vpbox.pack_start(self.vpassword_text, True, True, 0)
            
            vk_layout.pack_start(vlbox)
            vk_layout.pack_start(vpbox)
            
            """apply"""
            vk_layout.pack_start(apply_button, False, False)
            
            vk_frame.add(vk_layout)
            vbox.pack_start(vk_frame)
            
            self.init_pass()
            

        def dialog_token():
            self.set_keep_above(True)
            self.token = gtk.Entry() 
            self.set_size_request(550, -1)           
            self.user_id = gtk.Entry()
            if FC().user_id:
                self.user_id.set_text(FC().user_id) 
            
            
            edit = gtk.Entry()
            edit.set_text(self.API_URL)
            link = gtk.LinkButton(self.API_URL,_("Open"))
            
            line = gtk.HBox(False, 0)                    
            line.pack_start(edit, True, True)
            line.pack_start(link, False, False)
            
            apply = gtk.Button(_("2: Apply Token"))
            apply.connect("clicked", self.on_apply)
            
            self.info_line = gtk.Label(_("Please generate token..."))
            
            vbox.pack_start(ImageBase("vk.png"), False, False)
            vbox.pack_start(line, False, False)
            
            vbox.pack_start(HBoxLableEntry(gtk.Label(_("Token:")) , self.token))
            vbox.pack_start(HBoxLableEntry(gtk.Label(_("User ID:")) , self.user_id))
            
            vbox.pack_start(apply, False, False)
            vbox.pack_start(self.info_line, False, False)
        
        if os.name == 'nt':
            dialog_token()
        else:
            try:
                web_kit_token()
            except:
                dialog_token()
                pass
                
                
    
        self.add(vbox)
Example #28
0
    def __init__(self, controls):
        ChildTopWindow.__init__(self, _("Tag Editor"))
        self.controls = controls

        self.store = {}

        self.set_resizable(True)
        self.set_default_size(430, 150)

        """make tooltip more quick (useful for checkbuttons)"""
        Gtk.Settings().set_property('gtk-tooltip-timeout', 0)


        artist_label = Gtk.Label(_("Artist")) #@UnusedVariable
        title_label = Gtk.Label(_("Title")) #@UnusedVariable
        album_label = Gtk.Label(_("Album")) #@UnusedVariable
        date_label = Gtk.Label(_("Year")) #@UnusedVariable
        tracknumber_label = Gtk.Label(_("Track number")) #@UnusedVariable
        genre_label = Gtk.Label(_("Genre")) #@UnusedVariable
        author_label = Gtk.Label(_("Author text")) #@UnusedVariable
        composer_label = Gtk.Label(_("Composer")) #@UnusedVariable

        self.paths = []
        self.tag_names = ["artist", "title", "album", "date", "tracknumber", "genre", "author", "composer"]
        self.tag_mp4_names = ['\xa9ART', '\xa9nam', '\xa9alb', '\xa9day', 'trkn', '\xa9gen', '', '\xa9wrt']
        self.tag_entries = []
        self.labels = []
        self.check_buttons = []
        self.hboxes = []

        for tag_name in self.tag_names:

            vars()[tag_name + "_entry"] = Gtk.Entry()
            self.tag_entries.append(vars()[tag_name + "_entry"])

            self.labels.append(vars()[tag_name + "_label"])

            vars()[tag_name + "_chbutton"] = Gtk.CheckButton()
            self.check_buttons.append(vars()[tag_name + "_chbutton"])
#
            check_button = self.check_buttons[-1]

            check_button.set_focus_on_click(False)
            check_button.set_tooltip_text(_("Apply for all selected tracks\n(active on multi selection)"))

            vars()[tag_name + "_hbox"] = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5)
            self.hboxes.append(vars()[tag_name + "_hbox"])

            self.hboxes[-1].pack_end(check_button, False, False)
            self.hboxes[-1].pack_end(self.tag_entries[-1], True, True)


        lvbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 7)
        lvbox.set_homogeneous(True)
        rvbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 7)
        rvbox.set_homogeneous(True)

        hpan = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)

        for label, hbox in zip(self.labels, self.hboxes):
            lvbox.pack_start(label)
            rvbox.pack_start(hbox)

        hpan.pack1(lvbox)
        hpan.pack2(rvbox)

        apply_button = Gtk.Button(_("Apply"))
        close_button = Gtk.Button(_("Close"))

        buttons_hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 10)
        buttons_hbox.set_homogeneous(True)
        buttons_hbox.pack_start(apply_button)
        buttons_hbox.pack_start(close_button)

        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 15)
        vbox.pack_start(hpan)
        vbox.pack_start(buttons_hbox, True, True, 10)

        apply_button.connect("clicked", self.save_audio_tags, self.paths)
        close_button.connect("clicked", lambda * a: self.hide())

        self.add(vbox)
        self.show_all()
Example #29
0
class PreferencesWindow(ChildTopWindow, FControl, LoadSave):

    configs = []
    POS_NAME = 0

    def __init__(self, controls):
        FControl.__init__(self, controls)
        self.number_inits = 0
        self.lazy_init()

    def lazy_init(self):
        self.number_inits += 1
        controls = self.controls
        self.configs.append(MusicLibraryConfig(controls))
        #self.configs.append(DMConfig(controls))
        self.configs.append(TabsConfig(controls))
        self.configs.append(LastFmConfig(controls))
        #self.configs.append(VkontakteConfig(controls))
        #self.configs.append(InfoPagenConfig(controls))
        self.configs.append(TrayIconConfig(controls))
        #self.configs.append(NetworkConfig(controls))
        #self.configs.append(NotificationConfig(controls))

        try:
            """check keybinder installed, debian"""
            import keybinder  #@UnresolvedImport @UnusedImport
            from foobnix.preferences.configs.hotkey_conf import HotKeysConfig
            self.configs.append(HotKeysConfig(controls))
        except Exception, e:
            logging.warn("Keybinder not installed" + str(e))

        self.configs.append(OtherConfig(controls))

        self.label = None

        mainVBox = gtk.VBox(False, 0)

        ChildTopWindow.__init__(self, _("Preferences"), 900, 500)

        paned = gtk.HPaned()
        paned.set_position(250)

        def func():
            bean = self.navigation.get_selected_bean()
            if bean:
                self.populate_config_category(bean.text)

        self.navigation = SimpleListTreeControl(_("Categories"), controls,
                                                True)

        for plugin in self.configs:
            self.navigation.append(FDModel(plugin.name))

        self.navigation.set_left_click_func(func)

        paned.add1(self.navigation.scroll)

        cbox = gtk.VBox(False, 0)
        for plugin in self.configs:
            cbox.pack_start(plugin.widget, False, True)

        self.container = self.create_container(cbox)
        paned.add2(self.container)

        mainVBox.pack_start(paned, True, True, 0)
        mainVBox.pack_start(self.create_save_cancel_buttons(), False, False, 0)

        self.add(mainVBox)
Example #30
0
    def __init__(self, controls):
        ChildTopWindow.__init__(self, _("Tag Editor"))
        self.controls = controls

        self.store = {}

        self.set_resizable(True)
        self.set_default_size(430, 150)
        """make tooltip more quick (useful for checkbuttons)"""
        gtk.Settings().set_property('gtk-tooltip-timeout', 0)

        artist_label = gtk.Label(_("Artist"))  #@UnusedVariable
        title_label = gtk.Label(_("Title"))  #@UnusedVariable
        album_label = gtk.Label(_("Album"))  #@UnusedVariable
        date_label = gtk.Label(_("Year"))  #@UnusedVariable
        tracknumber_label = gtk.Label(_("Track number"))  #@UnusedVariable
        genre_label = gtk.Label(_("Genre"))  #@UnusedVariable
        author_label = gtk.Label(_("Author text"))  #@UnusedVariable
        composer_label = gtk.Label(_("Composer"))  #@UnusedVariable

        self.paths = []
        self.tag_names = [
            "artist", "title", "album", "date", "tracknumber", "genre",
            "author", "composer"
        ]
        self.tag_mp4_names = [
            '\xa9ART', '\xa9nam', '\xa9alb', '\xa9day', 'trkn', '\xa9gen', '',
            '\xa9wrt'
        ]
        self.tag_entries = []
        self.labels = []
        self.check_buttons = []
        self.hboxes = []

        for tag_name in self.tag_names:

            vars()[tag_name + "_entry"] = gtk.Entry()
            self.tag_entries.append(vars()[tag_name + "_entry"])

            self.labels.append(vars()[tag_name + "_label"])

            vars()[tag_name + "_chbutton"] = gtk.CheckButton()
            self.check_buttons.append(vars()[tag_name + "_chbutton"])
            #
            check_button = self.check_buttons[-1]

            check_button.set_focus_on_click(False)
            check_button.set_tooltip_text(
                _("Apply for all selected tracks\n(active on multi selection)")
            )

            vars()[tag_name + "_hbox"] = gtk.HBox(False, 5)
            self.hboxes.append(vars()[tag_name + "_hbox"])

            self.hboxes[-1].pack_end(check_button, False, False)
            self.hboxes[-1].pack_end(self.tag_entries[-1], True, True)

        lvbox = gtk.VBox(True, 7)
        rvbox = gtk.VBox(True, 7)
        hpan = gtk.HPaned()

        for label, hbox in zip(self.labels, self.hboxes):
            lvbox.pack_start(label)
            rvbox.pack_start(hbox)

        hpan.pack1(lvbox)
        hpan.pack2(rvbox)

        apply_button = gtk.Button(_("Apply"))
        close_button = gtk.Button(_("Close"))

        buttons_hbox = gtk.HBox(True, 10)
        buttons_hbox.pack_start(apply_button)
        buttons_hbox.pack_start(close_button)

        vbox = gtk.VBox(False, 15)
        vbox.pack_start(hpan)
        vbox.pack_start(buttons_hbox, True, True, 10)

        apply_button.connect("clicked", self.save_audio_tags, self.paths)
        close_button.connect("clicked", lambda *a: self.hide())

        self.add(vbox)
        self.show_all()
Example #31
0
    def __init__(self, service):
        self.service = service
        ChildTopWindow.__init__(self, _("VKontakte Authorization (require for music search)"))
        self.set_resizable(True)
        vbox = gtk.VBox(False, 0)
        self.access_token = None
        
        default_button = gtk.Button(_("Get Login and Password"))
        default_button.connect("clicked", self.on_defaults)

        
        def web_kit_token():
            import webkit            
            self.web_view = webkit.WebView()
            self.web_view.set_size_request(640, -1) 
            
            self.web_view.load_uri(self.get_web_url())
            self.web_view.connect("navigation-policy-decision-requested", self._nav_request_policy_decision_cb)
               
            vbox.pack_start(self.web_view, True, True)
            vbox.pack_start(default_button, False, False)
        
       

        def dialog_token():
            self.set_keep_above(True)
            self.token = gtk.Entry() 
            self.set_size_request(550, -1)           
            self.user_id = gtk.Entry()
            if FC().user_id:
                self.user_id.set_text(FC().user_id) 
            
            
            edit = gtk.Entry()
            edit.set_text(self.API_URL)
            link = gtk.LinkButton(self.API_URL,_("Open"))
            
            line = gtk.HBox(False, 0)                    
            line.pack_start(edit, True, True)
            line.pack_start(link, False, False)
            
            apply = gtk.Button(_("2: Apply Token"))
            apply.connect("clicked", self.on_apply)
            
            self.info_line = gtk.Label(_("Please generate token..."))
            
            vbox.pack_start(ImageBase("vk.png"), False, False)
            vbox.pack_start(line, False, False)
            
            vbox.pack_start(HBoxLableEntry(gtk.Label(_("Token:")) , self.token))
            vbox.pack_start(HBoxLableEntry(gtk.Label(_("User ID:")) , self.user_id))
            
            vbox.pack_start(apply, False, False)
            vbox.pack_start(self.info_line, False, False)
        
        if os.name == 'nt':
            dialog_token()
        else:
            try:
                web_kit_token()
            except:
                dialog_token()
    
        self.add(vbox)
Example #32
0
    def __init__(self):
        ChildTopWindow.__init__(self, title="Audio Converter", width=500, height=400)

        self.area = ScrolledText()
        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 10)
        vbox.pack_start(self.area.scroll, True, True, 0)
        vbox.show()
        format_label = Gtk.Label.new(_('Format'))
        bitrate_label = Gtk.Label.new(_('Bitrate'))
        channels_label = Gtk.Label.new(_('Channels'))
        hertz_label = Gtk.Label.new(_('Frequency'))

        format_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        bitrate_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        channels_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        hertz_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        self.format_list = ["Choose", "  mp3", "  ogg", "  mp2", "  ac3", "  m4a", "  wav"]
        self.bitrate_list = ["  64 kbps", "  96 kbps", "  128 kbps", "  160 kbps", "  192 kbps", "  224 kbps", "  256 kbps", "  320 kbps", "  384 kbps", "  448 kbps", "  640 kbps"]
        self.channels_list = ["  1", "  2", "  6"]
        self.hertz_list = ["  22050 Hz", "  44100 Hz", "  48000 Hz", "  96000 Hz"]

        self.format_combo = combobox_constr(self.format_list)
        self.format_combo.connect("changed", self.on_change_format)

        self.bitrate_combo = combobox_constr()
        self.channels_combo = combobox_constr()
        self.hertz_combo = combobox_constr()

        format_box.pack_start(format_label, False, False, 0)
        format_box.pack_start(self.format_combo, False, False, 0)
        bitrate_box.pack_start(bitrate_label, False, False, 0)
        bitrate_box.pack_start(self.bitrate_combo, False, False, 0)
        channels_box.pack_start(channels_label, False, False, 0)
        channels_box.pack_start(self.channels_combo, False, False, 0)
        hertz_box.pack_start(hertz_label, False, False, 0)
        hertz_box.pack_start(self.hertz_combo, False, False, 0)

        hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 30)
        hbox.pack_start(format_box, False, False, 0)
        hbox.pack_start(bitrate_box, False, False, 0)
        hbox.pack_start(channels_box, False, False, 0)
        hbox.pack_start(hertz_box, False, False, 0)
        hbox.set_border_width(10)
        hbox.show_all()

        vbox.pack_start(hbox, False, False, 0)

        self.button_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 10)
        close_button = Gtk.Button.new_with_label(_("Close"))
        close_button.set_size_request(150, 30)
        close_button.connect("clicked", lambda *a: self.hide())
        self.convert_button = Gtk.Button.new_with_label(_("Convert"))
        self.convert_button.set_size_request(150, 30)
        self.convert_button.connect("clicked", self.save)

        self.progressbar = Gtk.ProgressBar()

        self.stop_button = Gtk.Button.new_with_label(_("Stop"))
        self.stop_button.set_size_request(100, 30)
        self.stop_button.connect("clicked", self.on_stop)

        self.open_folder_button = Gtk.Button.new_with_label(_("Show files"))
        self.open_folder_button.connect('released', self.open_in_fm)

        self.progress_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        self.progress_box.pack_end(self.open_folder_button, False, False, 0)
        self.progress_box.pack_end(self.stop_button, False, False, 0)
        self.progress_box.pack_end(self.progressbar, True, True, 0)

        self.output = ScrolledText()
        self.output.text.set_size_request(-1, 150)
        self.output.scroll.set_size_request(-1, 150)
        self.output.scroll.set_placement(Gtk.CornerType.BOTTOM_LEFT)
        vbox.pack_start(self.progress_box, False, False, 0)

        self.button_box.pack_end(self.convert_button, False, False, 0)
        self.button_box.pack_end(close_button, False, False, 0)

        self.button_box.show_all()

        vbox.pack_start(self.button_box, False, False, 0)
        vbox.pack_start(self.output.scroll, False, False, 0)
        self.add(vbox)