def allocation_lrc_file(self, song, lrc_path):    
     if os.path.exists(lrc_path):
         if self.vaild_lrc(lrc_path):
             save_lrc_path = self.get_lrc_filepath(song)
             if os.path.exists(save_lrc_path): os.unlink(save_lrc_path)
             utils.run_command("cp %s %s" % (lrc_path, save_lrc_path))
             Dispatcher.reload_lrc(song)
 def on_iconview_single_click_item(self, widget, item, x, y):    
     if item:
         if hasattr(item, "is_more") and item.mask_flag:
             self.start_fetch_channels()
         else:    
             if item.mask_flag:
                 Dispatcher.emit("play-radio", item.chl)
    def __init__(self, *args, **kwargs):
        TreeView.__init__(self, *args, **kwargs)
        targets = [
            ("text/deepin-radios", gtk.TARGET_SAME_APP, 1),
        ]
        self.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_DROP,
                           targets, gtk.gdk.ACTION_COPY)

        self.connect_after("drag-data-received", self.on_drag_data_received)
        self.connect("double-click-item", self.on_double_click_item)
        self.connect("button-press-event", self.on_button_press_event)
        self.connect("delete-select-items", self.try_emit_empty_signal)
        self.connect("right-press-items", self.on_right_press_items)

        Dispatcher.connect("play-radio", self.on_dispatcher_play_radio)
        Player.connect("play-end", self.on_play_end)

        self.lock = threading.Lock()

        self.current_index = 0
        self.playlist = []
        self.limit_number = 25
        self.preview_db_file = get_config_file("preview_radios.db")
        self.status_db_file = get_cache_file("musicfm/status.db")
        self.load_status()
    def __init__(self):
        DialogBox.__init__(self,
                           _("Task Manager"),
                           350,
                           450,
                           DIALOG_MASK_SINGLE_PAGE,
                           modal=False,
                           close_callback=self.hide_all)

        self.is_changed = False
        scrolled_window = ScrolledWindow(0, 0)
        scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)

        scrolled_align = gtk.Alignment()
        scrolled_align.set(1, 1, 1, 1)
        scrolled_align.set_padding(10, 0, 0, 0)
        scrolled_align.add(scrolled_window)

        self.jobs_view = JobsView()
        self.jobs_view.draw_mask = self.get_mask_func(self.jobs_view)
        scrolled_window.add_child(self.jobs_view)

        pause_button = Button(_("Pause"))
        pause_button.connect("clicked", self.pause_job)
        stop_button = Button(_("Close"))
        stop_button.connect("clicked", lambda w: self.hide_all())

        self.body_box.add(scrolled_align)
        self.right_button_box.set_buttons([pause_button, stop_button])

        Dispatcher.connect("transfor-job", self.add_new_job)
 def on_tab_box_switch_tab(self, widget, item):    
     try:
         config.set("listmanager", "source", item.title)
         config.write()
     except: pass    
     
     Dispatcher.emit("switch-browser", item, True)
 def single_click(self, column, x, y):
     if column ==3:
         from wlan_config import WirelessSetting
         Dispatcher.to_setting_page(WirelessSetting(self.ap, net_manager.get_primary_wireless(self.ap)), False)
     elif column < 2:
         if self.network_state != 2:
             self.connect_by_ssid(self.ssid, self.ap)
 def unallocation_lrc_file(self, song):            
     try:
         del song["location_lrc"]
     except KeyError:    
         pass
     else:
         Dispatcher.reload_lrc(song)
    def __init__(self, *args, **kwargs):
        TreeView.__init__(self, *args, **kwargs)
        targets = [
            ("text/deepin-radios", gtk.TARGET_SAME_APP, 1),
        ]
        self.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_DROP,
                           targets, gtk.gdk.ACTION_COPY)

        self.connect_after("drag-data-received", self.on_drag_data_received)
        self.connect("double-click-item", self.on_double_click_item)
        self.connect("button-press-event", self.on_button_press_event)
        self.connect("delete-select-items", self.try_emit_empty_signal)
        self.connect("right-press-items", self.on_right_press_items)

        Dispatcher.connect("play-radio", self.on_dispatcher_play_radio)
        Player.connect("play-end", self.on_play_end)

        self.lock = threading.Lock()

        self.current_index = 0
        self.playlist = []
        self.limit_number = 25
        self.preview_db_file = get_config_file("preview_radios.db")
        self.status_db_file = get_cache_file("musicfm/status.db")
        self.load_status()
 def apply_changes(self, connection):
         device_path = nm_module.nmclient.get_wired_devices()[0].object_path
     #FIXME need to change device path into variables
         nm_module.nmclient.activate_connection_async(connection.object_path,
                                        device_path,
                                        "/")
         Dispatcher.to_setting_page()
    def init(self, connection):
        if connection == None:
            self.connection_type = None
        else:
            self.connection = connection
            mobile_type = connection.get_setting("connection").type
            self.connection_type = mobile_type
        Dispatcher.send_submodule_crumb(_("Region"), 2)

        from mm.provider import ServiceProviders
        self.__sp = ServiceProviders()
        self.country_list = self.__sp.get_country_name_list()
        self.country_tree.delete_all_items()
        self.country_tree.add_items([CountryItem(_(country)) for country in self.country_list])
        # add a bottom line for last item

        code = self.__sp.get_country_from_timezone()

        self.country_codes = self.__sp.get_country_list()
        try:
            selected_country = self.country_tree.visible_items[self.country_codes.index(code)]
            self.country_tree.select_items([selected_country])
            self.auto_scroll_to()
            self.country_tree.emit("button-press-item", selected_country, 0, 1, 1)
        except:
            pass
Beispiel #11
0
 def on_tab_box_switch_tab(self, widget, item):    
     try:
         config.set("listmanager", "source", item.title)
         config.write()
     except: pass    
     
     Dispatcher.emit("switch-browser", item, True)
Beispiel #12
0
 def unallocation_lrc_file(self, song):
     try:
         del song["location_lrc"]
     except KeyError:
         pass
     else:
         Dispatcher.reload_lrc(song)
    def __init__(self):
        super(CoverButton, self).__init__()
        
        self.cover_side_pixbuf = app_theme.get_pixbuf("cover/side.png").get_pixbuf()
        self.set_size_request(self.cover_side_pixbuf.get_width(), self.cover_side_pixbuf.get_height())
        self.webcast_dpixbuf = app_theme.get_pixbuf("cover/webcast.png")
        self.local_dpixbuf = app_theme.get_pixbuf("cover/default_cover.png")

        self.connect("expose-event", self.expose_button_cb)
        Dispatcher.connect("album-changed", self.on_album_changed)
        
        self.current_song = None
        self.next_cover_to_download = None
        
        self.condition = threading.Condition()
        self.thread = threading.Thread(target=self.func_thread)
        self.thread.setDaemon(True)
        self.thread.start()
        
        # animation params.
        self.active_alpha = 1.0
        self.target_alpha = 0.0
        self.in_animation = False
        self.animation_time = 1500
        self.active_pixbuf = self.get_default_pixbuf()
        self.target_pixbuf = None
        self.is_default = True
    def save_changes(self, widget):

        log.debug(self.manual_radio.get_active())
        #self.proxysetting.set_proxy_mode("none")
        if self.manual_radio.get_active():
            http_host = self.http_entry.get_text()
            http_port = self.http_spin.get_value()
            https_host = self.https_entry.get_text()
            https_port = self.https_spin.get_value()
            ftp_host = self.ftp_entry.get_text()
            ftp_port = self.ftp_spin.get_value()
            socks_host = self.socks_entry.get_text()
            socks_port = self.socks_spin.get_value()

            mode = "manual"
            self.proxysetting.set_proxy_mode(mode)
            self.proxysetting.set_http_host(http_host)
            self.proxysetting.set_http_port(http_port)
            self.proxysetting.set_https_host(https_host)
            self.proxysetting.set_https_port(https_port)
            self.proxysetting.set_ftp_host(ftp_host)
            self.proxysetting.set_ftp_port(ftp_port)

            self.proxysetting.set_socks_host(socks_host)
            self.proxysetting.set_socks_port(socks_port)

        else:
            conf_url = self.conf_entry.get_text()
            self.proxysetting.set_proxy_mode("auto")
            self.proxysetting.set_proxy_autoconfig_url(conf_url)

        Dispatcher.to_main_page()
Beispiel #15
0
    def change_cover(self, song_or_name, new_cover):
        save_path = self.get_cover_path(song_or_name)
        if not os.path.exists(new_cover):
            return False

        try:
            pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
                new_cover, COVER_SAVE_SIZE["x"], COVER_SAVE_SIZE["y"])
        except gobject.GError:
            return False
        else:
            str_pixbuf = pixbuf.get_pixels()
            if str_pixbuf.count(
                    "\x00") > len(str_pixbuf) / 2 or str_pixbuf.count(
                        "\xff") > len(str_pixbuf) / 2:
                return False
            else:
                if os.path.exists(save_path): os.unlink(save_path)
                pixbuf.save(save_path, "jpeg", {"quality": "85"})
                del pixbuf

                # Change property album to update UI
                if isinstance(song_or_name, Song):
                    Dispatcher.emit("album-changed", song_or_name)
                    MediaDB.set_property(song_or_name,
                                         {"album": song_or_name.get("album")})
                return True
 def decrease_volume(self):   
     current_volume = self.get_volume()
     current_volume -= 0.2
     if current_volume < 0:
         current_volume = 0.0
     # self.set_volume(current_volume)    
     Dispatcher.volume(current_volume)
    def load_list(self, network_object):
        '''
        will add hasattr part for network_object
        '''

        log.info("sidebar start load list")
        self.network_object = network_object
        self.connections = self.network_object.get_connections()
        #print self.connections, "load_list"
        connections = []
        for connection in self.connections:
            if isinstance(connection, NMRemoteConnection):
                connection.init_settings_prop_dict()
            connections.append(connection)
        self.connections = connections
        self.connection_tree = EntryTreeView()
        self.connection_tree.set_expand_column(1)
        self.__init_tree(self.connections)

        if hasattr(self.network_object, "add_new_connection"):
            self.new_connection = self.network_object.add_new_connection
            #self.add_button.change_add_setting(self.network_object.add_new_connection)
        if hasattr(self.network_object, "delete_request_redraw"):
            self.request_redraw = self.network_object.delete_request_redraw
        self.init_select(network_object.spec_connection)
        # FIXME: COME ON, why check the connections count?!
        #if self.connections !=[]:
        crumb_name = network_object.crumb_name
        if crumb_name == "":
            crumb_name = _("Hidden network")
        Dispatcher.send_submodule_crumb(2, crumb_name)
        Dispatcher.slide_to_page("setting", "none")
Beispiel #18
0
    def update_menu(self):
        menu_items = []
        if Player.is_paused():
            pixbuf_group = self.get_pixbuf_group("play")
            status_label = _("Play")
        else:
            pixbuf_group = self.get_pixbuf_group("pause")
            status_label = _("Pause")
        menu_items.append((pixbuf_group, status_label, Player.playpause))
        menu_items.append((self.get_pixbuf_group("previous"), _("Previous"), Player.previous))
        menu_items.append((self.get_pixbuf_group("next"), _("Next"), Player.next))
        menu_items.append(None)
        menu_items.append((self.get_pixbuf_group("volume"), _("Volume"), self.get_volume_menu()))
        menu_items.append(None)

        if config.getboolean("lyrics", "status"):
            menu_items.append((None, _("Close Lyrics"), lambda: Dispatcher.close_lyrics()))
            menu_items.append((None, _("Search Lyrics"), lambda: Dispatcher.emit("search-lyrics")))
        else:
            menu_items.append((None, _("Show Lyrics"), lambda: Dispatcher.show_lyrics()))

        if config.getboolean("lyrics", "locked"):
            menu_items.append((self.get_pixbuf_group("unlock"), _("Unlock Lyrics"), lambda: Dispatcher.unlock_lyrics()))
        else:
            menu_items.append((self.get_pixbuf_group("lock"), _("Lock Lyrics"), lambda: Dispatcher.lock_lyrics()))

        menu_items.append(None)
        menu_items.append((self.get_pixbuf_group("setting"), _("Preferences"), lambda: Dispatcher.show_setting()))
        menu_items.append((self.get_pixbuf_group("close"), _("Quit"), lambda: Dispatcher.quit()))
        if self.menu is not None:
            del self.menu
        self.menu = Menu(menu_items, True)
 def __init__(self):
     TreeView.__init__(self, enable_drag_drop=False, enable_multiple_select=False)
     
     # Player.connect("instant-new-song", self.on_new_song)
     Dispatcher.connect("download-songs", self.on_dispatcher_download_songs)
     
     self.set_expand_column(1)
    def save_changes(self, widget):

        log.debug(self.manual_radio.get_active())
        #self.proxysetting.set_proxy_mode("none")
        if self.manual_radio.get_active():
            http_host = self.http_entry.get_text()
            http_port = self.http_spin.get_value()
            https_host = self.https_entry.get_text()
            https_port = self.https_spin.get_value()
            ftp_host = self.ftp_entry.get_text()
            ftp_port = self.ftp_spin.get_value()
            socks_host = self.socks_entry.get_text()
            socks_port = self.socks_spin.get_value()

            mode = "manual"
            self.proxysetting.set_proxy_mode(mode)
            self.proxysetting.set_http_host(http_host)
            self.proxysetting.set_http_port(http_port)
            self.proxysetting.set_https_host(https_host)
            self.proxysetting.set_https_port(https_port)
            self.proxysetting.set_ftp_host(ftp_host)
            self.proxysetting.set_ftp_port(ftp_port)

            self.proxysetting.set_socks_host(socks_host)
            self.proxysetting.set_socks_port(socks_port)

        else:
            conf_url = self.conf_entry.get_text()
            self.proxysetting.set_proxy_mode("auto")
            self.proxysetting.set_proxy_autoconfig_url(conf_url)

        Dispatcher.to_main_page()
 def on_iconview_single_click_item(self, widget, item, x, y):
     if item:
         if hasattr(item, "is_more") and item.mask_flag:
             self.start_fetch_channels()
         else:
             if item.mask_flag:
                 Dispatcher.emit("play-radio", item.chl)
    def load_list(self, network_object):
        '''
        will add hasattr part for network_object
        '''
        
        log.info("sidebar start load list")
        self.network_object = network_object
        self.connections = self.network_object.get_connections()
        #print self.connections, "load_list"
        connections = []
        for connection in self.connections:
            if isinstance(connection, NMRemoteConnection):
                connection.init_settings_prop_dict()
            connections.append(connection)
        self.connections = connections
        self.connection_tree = EntryTreeView()
        self.connection_tree.set_expand_column(1)
        self.__init_tree(self.connections)

        if hasattr(self.network_object, "add_new_connection"):
            self.new_connection = self.network_object.add_new_connection
            #self.add_button.change_add_setting(self.network_object.add_new_connection)
        if hasattr(self.network_object, "delete_request_redraw"):
            self.request_redraw = self.network_object.delete_request_redraw
        self.init_select(network_object.spec_connection)
        # FIXME: COME ON, why check the connections count?!
        #if self.connections !=[]:
        crumb_name = network_object.crumb_name
        if crumb_name == "":
            crumb_name = _("Hidden network")
        Dispatcher.send_submodule_crumb(2, crumb_name)
        Dispatcher.slide_to_page("setting", "none")
    def set_ip_address(self, widget, content, index):
        # if you really want no gateway, just put a 0.0.0.0
        names = ["ip4", "netmask", "gw"]
        verbose_name = [_("IPv4"), _("Subnet Mask"), _("Gateway")]
        self.ip[index] = content

        if self.check_valid(names[index]):
            setattr(self, names[index] + "_flag", True)
            Dispatcher.set_tip(_("Valid %s address.")%verbose_name[index])
        else:
            setattr(self, names[index] + "_flag", False)
            Dispatcher.set_tip(_("Invalid %s address.")%verbose_name[index])

        ############
        # 检查ip、子网掩码、网关是否正确
        log.debug(widget, content, index)
        is_valid = True
        for n in names:
            if not getattr(self, "%s_flag"%n):
                is_valid = False
                break
        if is_valid:
            if self.setting.addresses:
                self.setting.clear_addresses()
            self.setting.add_address(self.ip)
        
        if self.settings_obj:
            self.settings_obj.ipv4_ip_is_valid = is_valid
            self.settings_obj.set_button("save", is_valid)
    def click_mppe_callback(self, widget, key):
        active = widget.get_active()
        if active and key != "name":
            self.vpn_setting.set_data_item(key, "yes")
            #self.set_group_active(False)
            self.set_group_sensitive(False)

            self.mppe_group_set_sensitive(True)
            self.init_ui()
        else:
            #self.set_group_active(True)
            self.set_group_sensitive(True)
            self.vpn_setting.delete_data_item(key)
            self.mppe_group_set_active(False)
            self.mppe_group_set_sensitive(False)
            self.init_ui()

        if self.init_lock:
            if self.connection.check_setting_finish():
                Dispatcher.set_button("save", True)
            else:
                Dispatcher.set_button("save", False)

        if self.auth_lock():
            self.require_mppe_label.set_sensitive(False)
            self.require_mppe.set_sensitive(False)
            return
 def increase_volume(self):        
     current_volume = self.get_volume()
     current_volume += 0.2
     if current_volume > 1.0:
         current_volume = 1.0
     # self.set_volume(current_volume)    
     Dispatcher.volume(current_volume)
    def set_ip_address(self, widget, content, index):
        # if you really want no gateway, just put a 0.0.0.0
        names = ["ip4", "netmask", "gw"]
        verbose_name = [_("IPv4"), _("Subnet Mask"), _("Gateway")]
        self.ip[index] = content

        if self.check_valid(names[index]):
            setattr(self, names[index] + "_flag", True)
            Dispatcher.set_tip(_("Valid %s address.") % verbose_name[index])
        else:
            setattr(self, names[index] + "_flag", False)
            Dispatcher.set_tip(_("Invalid %s address.") % verbose_name[index])

        ############
        # 检查ip、子网掩码、网关是否正确
        log.debug(widget, content, index)
        is_valid = True
        for n in names:
            if not getattr(self, "%s_flag" % n):
                is_valid = False
                break
        if is_valid:
            if self.setting.addresses:
                self.setting.clear_addresses()
            self.setting.add_address(self.ip)

        if self.settings_obj:
            self.settings_obj.ipv4_ip_is_valid = is_valid
            self.settings_obj.set_button("save", is_valid)
Beispiel #27
0
    def __init__(self):
        super(CoverButton, self).__init__()

        self.cover_side_pixbuf = app_theme.get_pixbuf(
            "cover/side.png").get_pixbuf()
        self.set_size_request(self.cover_side_pixbuf.get_width(),
                              self.cover_side_pixbuf.get_height())
        self.webcast_dpixbuf = app_theme.get_pixbuf("cover/webcast.png")
        self.local_dpixbuf = app_theme.get_pixbuf("cover/default_cover.png")

        self.connect("expose-event", self.expose_button_cb)
        Dispatcher.connect("album-changed", self.on_album_changed)

        self.current_song = None
        self.next_cover_to_download = None

        self.condition = threading.Condition()
        self.thread = threading.Thread(target=self.func_thread)
        self.thread.setDaemon(True)
        self.thread.start()

        # animation params.
        self.active_alpha = 1.0
        self.target_alpha = 0.0
        self.in_animation = False
        self.animation_time = 1500
        self.active_pixbuf = self.get_default_pixbuf()
        self.target_pixbuf = None
        self.is_default = True
 def __init__(self):
     DialogBox.__init__(self, _("Task Manager"), 350, 450, DIALOG_MASK_SINGLE_PAGE,
                        modal=False, close_callback=self.hide_all)
     
     self.is_changed = False
     scrolled_window = ScrolledWindow(0, 0)
     scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     
     scrolled_align = gtk.Alignment()
     scrolled_align.set(1, 1, 1, 1)
     scrolled_align.set_padding(10, 0, 0, 0)
     scrolled_align.add(scrolled_window)
     
     self.jobs_view = JobsView()
     self.jobs_view.draw_mask = self.get_mask_func(self.jobs_view)
     scrolled_window.add_child(self.jobs_view)
     
     pause_button = Button(_("Pause"))
     pause_button.connect("clicked", self.pause_job)
     stop_button = Button(_("Close"))
     stop_button.connect("clicked", lambda w: self.hide_all())
     
     self.body_box.add(scrolled_align)
     self.right_button_box.set_buttons([pause_button, stop_button])
     
     Dispatcher.connect("transfor-job", self.add_new_job)
    def click_mppe_callback(self, widget, key):
        active = widget.get_active()
        if active and key != "name":
            self.vpn_setting.set_data_item(key, "yes")
            #self.set_group_active(False)
            self.set_group_sensitive(False)

            self.mppe_group_set_sensitive(True)
            self.init_ui()
        else:
            #self.set_group_active(True)
            self.set_group_sensitive(True)
            self.vpn_setting.delete_data_item(key)
            self.mppe_group_set_active(False)
            self.mppe_group_set_sensitive(False)
            self.init_ui()
        
        if self.init_lock:
            if self.connection.check_setting_finish():
                Dispatcher.set_button("save", True)
            else:
                Dispatcher.set_button("save", False)

        if self.auth_lock():
            self.require_mppe_label.set_sensitive(False)
            self.require_mppe.set_sensitive(False)
            return
    def init(self, connection):
        if connection == None:
            self.connection_type = None
        else:
            self.connection = connection
            mobile_type = connection.get_setting("connection").type
            self.connection_type = mobile_type
        Dispatcher.send_submodule_crumb(_("Region"), 2)

        from mm.provider import ServiceProviders
        self.__sp = ServiceProviders()
        self.country_list = self.__sp.get_country_name_list()
        self.country_tree.delete_all_items()
        self.country_tree.add_items(
            [CountryItem(_(country)) for country in self.country_list])
        # add a bottom line for last item

        code = self.__sp.get_country_from_timezone()

        self.country_codes = self.__sp.get_country_list()
        try:
            selected_country = self.country_tree.visible_items[
                self.country_codes.index(code)]
            self.country_tree.select_items([selected_country])
            self.auto_scroll_to()
            self.country_tree.emit("button-press-item", selected_country, 0, 1,
                                   1)
        except:
            pass
 def allocation_lrc_file(self, song, lrc_path):
     if os.path.exists(lrc_path):
         if self.vaild_lrc(lrc_path):
             save_lrc_path = self.get_lrc_filepath(song)
             if os.path.exists(save_lrc_path): os.unlink(save_lrc_path)
             utils.run_command("cp %s %s" % (lrc_path, save_lrc_path))
             Dispatcher.reload_lrc(song)
Beispiel #32
0
 def get_locked_menu_items(self):
     if config.getboolean("lyrics", "locked"):
         return (self.get_pixbuf_group("unlock"), _("Unlock lyrics"),
                 lambda: Dispatcher.unlock_lyrics())
     else:
         return (self.get_pixbuf_group("lock"), _("Lock lyrics"),
                 lambda: Dispatcher.lock_lyrics())
def check_settings(connection, fn):
    if connection.check_setting_finish():
        Dispatcher.set_button('save', True)
        print "pass"
        #print connection.get_setting("802-11-wireless-security").prop_dict
    else:
        Dispatcher.set_button("save", False)
        print "not pass, ==================>"
Beispiel #34
0
def check_settings(connection, fn):
    if connection.check_setting_finish():
        Dispatcher.set_button('save', True)
        print "pass"
        #print connection.get_setting("802-11-wireless-security").prop_dict
    else:
        Dispatcher.set_button("save", False)
        print "not pass, ==================>"
Beispiel #35
0
 def __init__(self, auto_hide=True, mini_mode=False):
     super(VolumeSlider, self).__init__()
     self.volume_button = VolumeButton(auto_hide=auto_hide, mini_mode=mini_mode)
     Tooltip.custom(self.volume_button, self.get_tip_label).always_update(self.volume_button, True)
     self.volume_button.connect("volume-state-changed",self.__volume_changed)
     self.load_volume_config()
     Dispatcher.connect("volume", self.change_volume)
     self.add(self.volume_button)
Beispiel #36
0
 def ChangeVolume(self, value):
     try: value = float(value)
     
     except:
         return False
     else:
         Dispatcher.volume(value)
         return True
Beispiel #37
0
 def set_foot_bar_button(self, connection):
     if type(connection) == NMRemoteConnection:
         self.foot_box.show_delete(connection)
     else:
         self.foot_box.hide_delete()
     states = self.setting_group.get_button_state(connection)
     if states:
         Dispatcher.set_button(*states)
 def set_foot_bar_button(self, connection):
     if type(connection) == NMRemoteConnection:
         self.foot_box.show_delete(connection)
     else:
         self.foot_box.hide_delete()
     states = self.setting_group.get_button_state(connection)
     if states:
         Dispatcher.set_button(*states)
 def save_changes(self, connection):
     if isinstance(connection, NMRemoteConnection):
         connection.update()
         net_manager.rename_hidden(connection)
     else:
         connection = nm_module.nm_remote_settings.new_connection_finish(connection.settings_dict, 'lan')
         net_manager.add_hidden(connection)
     Dispatcher.to_main_page()
     Dispatcher.emit("wireless-redraw")
    def __init__(self):
        TreeView.__init__(self,
                          enable_drag_drop=False,
                          enable_multiple_select=False)

        # Player.connect("instant-new-song", self.on_new_song)
        Dispatcher.connect("download-songs", self.on_dispatcher_download_songs)

        self.set_expand_column(1)
 def apply_changes(self, connection):
     wired_device = net_manager.device_manager.get_wired_devices()[0]
     if wired_device.get_state() != 20:
         nm_module.nmclient.activate_connection_async(connection.object_path,
                                            wired_device.object_path,
                                            "/")
         self.device_ethernet = nm_module.cache.get_spec_object(wired_device.object_path)
         self.device_ethernet.emit("try-activate-begin")
     Dispatcher.to_main_page()
 def init_signals(self):
     self._init_signals() 
     Dispatcher.connect("switch-device", self.switch_devices)
     Dispatcher.connect("wireless-device-add", self.device_added)
     Dispatcher.connect("ap-added", self.ap_added_callback)
     Dispatcher.connect("ap-removed", self.ap_removed_callback)
     Dispatcher.connect("wireless-redraw", self.wireless_redraw)
     self.label.connect("button-release-event", self.create_a_hidden_network)
     event_manager.add_callback('hidden-connection-removed', self.on_delete_redraw)
 def show_more_options(self, widget):
     widget.destroy()
     self.ipv4 = SettingSection(_("IPv4 settings"), always_show=True)
     self.ipv4.load([IPV4Conf(self.connection, self.set_button, settings_obj=self.settings_obj)])
     ppp = SettingSection(_("PPP settings"), always_show=True)
     ppp.load([PPPConf(settings_obj=self.settings_obj)])
     Dispatcher.emit("vpn-type-change", self.connection)
     self.main_box.pack_start(self.ipv4, False, False, 15)
     self.main_box.pack_start(ppp, False, False)
 def select(self):
     #print self.get_highlight()
     #Dispatcher.select_connection(self.connection)
     self.is_select = True
     if self.is_hover:
         self.hover(0,0,0)
     # TODO 切换网络连接时更改按钮状态
     Dispatcher.change_setting(self.connection)
     if self.redraw_request_callback:
         self.redraw_request_callback(self)
 def run(self):
     uri = None
     Dispatcher.emit("dialog-run")
     response = gtk.FileChooserDialog.run(self)
     self.set_modal(True)
     if response == gtk.RESPONSE_OK:
         uri =  self.get_uri()
     self.destroy()
     Dispatcher.emit("dialog-close")
     return uri
Beispiel #46
0
 def remove_cover(self, song, emit=False):
     image_path = self.get_cover_path(song)
     if os.path.exists(image_path):
         try:
             os.unlink(image_path)
         except:
             pass
     if emit:
         Dispatcher.emit("album-changed", song)
         MediaDB.set_property(song, {"album": song.get("album")})
Beispiel #47
0
 def save_changes(self, connection):
     if isinstance(connection, NMRemoteConnection):
         connection.update()
         net_manager.rename_hidden(connection)
     else:
         connection = nm_module.nm_remote_settings.new_connection_finish(
             connection.settings_dict, 'lan')
         net_manager.add_hidden(connection)
     Dispatcher.to_main_page()
     Dispatcher.emit("wireless-redraw")
 def toggle_item_collected(self, item):        
     if not item: return 
     song = item.webcast
     if song.get("collected", False):
         collected = False
     else:
         collected = True
     WebcastDB.set_property(song, {"collected": collected}, emit_update=False)
     item.update_webcast(song)
     Dispatcher.emit("change-webcast", song)
Beispiel #49
0
 def run(self):
     uri = None
     Dispatcher.emit("dialog-run")
     response = gtk.FileChooserDialog.run(self)
     self.set_modal(True)
     if response == gtk.RESPONSE_OK:
         uri = self.get_uri()
     self.destroy()
     Dispatcher.emit("dialog-close")
     return uri
Beispiel #50
0
 def single_click(self, column, x, y):
     if column == 3:
         from wlan_config import WirelessSetting
         Dispatcher.to_setting_page(
             WirelessSetting(self.ap,
                             net_manager.get_primary_wireless(self.ap)),
             False)
     elif column < 2:
         if self.network_state != 2:
             self.connect_by_ssid(self.ssid, self.ap)
 def remove_cover(self, song, emit=False):
     image_path = self.get_cover_path(song)
     if os.path.exists(image_path):    
         try:
             os.unlink(image_path)
         except:    
             pass
     if emit:    
         Dispatcher.emit("album-changed", song)
         MediaDB.set_property(song, {"album" : song.get("album")})
    def entry_changed_cb(self, widget, string, key):
        if string == "":
            #print key,"entry is empty"
            self.vpn_setting.delete_data_item(key)
        elif key != "name":
            self.vpn_setting.set_data_item(key, string)

        if self.connection.check_setting_finish():
            Dispatcher.set_button("save", True)
        else:
            Dispatcher.set_button("save", False)
 def init_signals(self):
     self._init_signals()
     Dispatcher.connect("switch-device", self.switch_devices)
     Dispatcher.connect("wireless-device-add", self.device_added)
     Dispatcher.connect("ap-added", self.ap_added_callback)
     Dispatcher.connect("ap-removed", self.ap_removed_callback)
     Dispatcher.connect("wireless-redraw", self.wireless_redraw)
     self.label.connect("button-release-event",
                        self.create_a_hidden_network)
     event_manager.add_callback('hidden-connection-removed',
                                self.on_delete_redraw)
Beispiel #54
0
 def post_mount_cb(self, track_infos, device_path, udi):
     track_tags, cd_label = track_infos
     if len(track_tags) > 0:
         songs = []
         for tag in track_tags:
             cd_song = Song()
             cd_song.init_from_dict(tag)
             cd_song.set_type("cdda")
             songs.append(cd_song)
         Dispatcher.new_audiocd_playlist(cd_label, songs, udi)
         self.audiocd_items[udi] = songs
 def toggle_item_collected(self, item):
     if not item: return
     song = item.webcast
     if song.get("collected", False):
         collected = False
     else:
         collected = True
     WebcastDB.set_property(song, {"collected": collected},
                            emit_update=False)
     item.update_webcast(song)
     Dispatcher.emit("change-webcast", song)
Beispiel #56
0
    def ready(self, show=True):
        first_started = config.get("setting", "first_started", "")
        if show and first_started:
            self.ready_show()

        self.emit("ready")
        Dispatcher.emit("ready")
        # wizard
        if not first_started:
            self.show_wizard_win(True, self.ready_show)
            config.set("setting", "first_started", "false")
Beispiel #57
0
 def __init__(self, auto_hide=True, mini_mode=False):
     super(VolumeSlider, self).__init__()
     self.volume_button = VolumeButton(auto_hide=auto_hide,
                                       mini_mode=mini_mode)
     Tooltip.custom(self.volume_button, self.get_tip_label).always_update(
         self.volume_button, True)
     self.volume_button.connect("volume-state-changed",
                                self.__volume_changed)
     self.load_volume_config()
     Dispatcher.connect("volume", self.change_volume)
     self.add(self.volume_button)