コード例 #1
0
    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
コード例 #2
0
 def __on_select_all(self, widget):
     self.delete_view.select_all()
     if self.delete_view.is_select_all():
         self.select_all_button.set_label(_("Clear all"))
     else:
         self.select_all_button.set_label(_("Select all"))
     self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
コード例 #3
0
    def RequestConfirmation(self, device, passkey):
        print("RequestConfirmation (%s, %06d)" % (device, passkey))

        # def action_invoked(_id, _action):
        #     if _action == "pair_accept":
        #         pass
        #     elif _action == "pair_reject":
        #         raise Rejected("Passkey doesn't match")

        # noti = pynotify.Notification(_("Pair request"),
        #                              _("Device %s request for pair,\n please make sure the key is %s") % (device, passkey))
        # noti.add_action("pair_accept", _("Accept"), action_invoked)
        # noti.add_action("pair_reject", _("Reject"), action_invoked)
        # noti.show()

        result = []
        loop = None
        agent_d = AgentDialog(_("Please confirm %s pin match as below") % Device(device).get_alias(),
                              str(passkey),
                              confirm_button_text = _("Yes"),
                              cancel_button_text = _("No"),
                              confirm_callback = lambda : result.append("yes"),
                              cancel_callback = lambda : result.append(None)
                              )

        agent_d.connect("destroy", lambda widget : loop.quit())
        agent_d.show_all()

        loop = gobject.MainLoop(None, False)
        gtk.gdk.threads_leave()
        loop.run()
        gtk.gdk.threads_enter()
        
        if not result[0]:
            raise_rejected("Passkey doesn't match.")
コード例 #4
0
 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)
コード例 #5
0
 def save_operate(self, widget=None):
     '''do save operate'''
     screenshot = self.screenshot
     if screenshot.is_subprocess:
         screenshot.save_to_tmp_file()
     else:
         # auto save
         if screenshot.save_op_index == SAVE_OP_AUTO:
             folder = utils.get_pictures_dir()
             filename = "%s%s.%s" % (_(DEFAULT_FILENAME),
                                     utils.get_format_time(), "png")
             screenshot.save_snapshot("%s/%s" % (folder, filename))
         # save as
         elif screenshot.save_op_index == SAVE_OP_AS:
             self.save_to_file()
         # copy to clip
         elif screenshot.save_op_index == SAVE_OP_CLIP:
             screenshot.save_snapshot()
         # auto save and copy to clip
         else:
             folder = utils.get_pictures_dir()
             filename = "%s%s.%s" % (_(DEFAULT_FILENAME),
                                     utils.get_format_time(), "png")
             screenshot.save_snapshot("%s/%s" % (folder, filename),
                                      clip_flag=True)
コード例 #6
0
    def update_power_icon(self, percentage):
        if self.online_value:
            return
        self.check_for_warning(percentage)
        if percentage >= 91 and percentage <= 100:
            self.tray_icon.set_icon_theme("battery91-100")
        elif percentage >= 81 and percentage <= 90:
            self.tray_icon.set_icon_theme("battery81-90")
        elif percentage >= 71 and percentage <= 80:
            self.tray_icon.set_icon_theme("battery71-80")
        elif percentage >= 61 and percentage <= 70:
            self.tray_icon.set_icon_theme("battery61-70")
        elif percentage >= 51 and percentage <= 60:
            self.tray_icon.set_icon_theme("battery51-60")
        elif percentage >= 31 and percentage <= 50:
            self.tray_icon.set_icon_theme("battery31-50")
        elif percentage >= 21 and percentage <= 30:
            self.tray_icon.set_icon_theme("battery21-30")
        elif percentage >= 0 and percentage <= 20:
            self.tray_icon.set_icon_theme("battery0-10-20")
        #
        string = _("%s remaining") % (str(int(percentage)) + '%')
        if int(percentage) == 100:
            string = _("Fully charged")

        self.tray_icon.set_tooltip_text(string)
コード例 #7
0
 def pause_job(self, widget):    
     value = self.jobs_view.playpause_jobs()
     if value:
         if widget.label == _("Pause"):
             widget.label = (_("Continue"))
         else:    
             widget.label = (_("Pause"))
コード例 #8
0
def get_phonetic_symbol(text):
    data = { "keyfrom" : "deskdict.mini", "q" : text, "doctype" : "xml", "xmlVersion" : 8.2,
             "client" : "deskdict", "id" : "cee84504d9984f1b2", "vendor": "unknown", 
             "in" : "YoudaoDict", "appVer" : "5.4.46.5554", "appZengqiang" : 0, "le" : "eng", "LTH" : 40}
    ret = requests.get("http://dict.youdao.com/search", params=data).text
    if isinstance(ret, unicode):
        ret = ret.encode('utf-8')
    pq = PyQuery(ret, parser="xml")
    
    phonetic_symbol = pq.find('usphone').text()
    phonetic_type = _("US")
    
    try:    
        if phonetic_symbol == '':
            phonetic_symbol = pq.find('ukphone').text()
            phonetic_type = _("UK")
    except: 
        pass
    
    if phonetic_symbol == '' or phonetic_symbol == None or phonetic_symbol.isspace():
        return ""
    else:
        if isinstance(phonetic_type, unicode):
            phonetic_type = phonetic_type.encode('utf-8')

        if isinstance(phonetic_symbol, unicode):
            phonetic_symbol = phonetic_symbol.encode('utf-8')
        
        return "[%s] %s" % (phonetic_type, phonetic_symbol)
コード例 #9
0
    def __toggled(self, widget, object=None):
        if object == "wakeup_password":
            if widget.get_active():
                self.__send_message("status", (
                    "power",
                    _("You will be asked for a password when computer wakes")))
            else:
                self.__send_message(
                    "status",
                    ("power",
                     _("The system will not requrie a password after sleep")))
            self.power_manager.set_wakeup_password(widget.get_active())
            #self.wakeup_password_label.set_sensitive(widget.get_active())
            return

        if object == "tray_battery_status":
            if widget.get_active():
                self.__send_message(
                    "status",
                    ("power", _("Battery status will be shown in the tray")))
            else:
                self.__send_message(
                    "status",
                    ("power",
                     _("Battery status will not be shown in the tray")))
            self.power_manager.set_tray_battery_status(widget.get_active())
            return
コード例 #10
0
 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)
コード例 #11
0
 def get_add_menu(self):    
     menu_items = [
         (None, _("File"), self.add_file),
         (None, _("Directory(include subdirectories)"), self.recursion_add_dir),
         (None, _("Directory"), self.add_dir),
         ]
     return Menu(menu_items)
コード例 #12
0
    def __init__(self, connection, set_button, settings_obj=None):
        gtk.Alignment.__init__(self, 0, 0, 0, 0)
        self.connection = connection
        self.set_button = set_button
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj

        self.set_padding(35, 0, 20, 0)

        self.main_box = gtk.VBox()
        self.tab_name = "sfds"
        basic = SettingSection(_("Basic"))

        self.button = Button(_("Advanced"))
        self.button.connect("clicked", self.show_more_options)
        self.wired = SettingSection(_("Wired"), always_show=False)
        align = gtk.Alignment(0, 0, 0, 0)
        align.set_padding(0, 0, 376, 0)
        align.set_size_request(-1, 30)
        align.add(self.button)

        basic.load([
            PPTPConf(connection, set_button, settings_obj=self.settings_obj),
            align
        ])

        self.main_box.pack_start(basic, False, False)

        self.add(self.main_box)
コード例 #13
0
    def cancall_opeartion(self, object, res):
        source = res.get_source_object()
        try:
            if isinstance(source, gio.Volume):
                summary = _("Mount Failed")
                body = _("Mount '%s' error.") % source.get_name()
                result = source.mount_finish(res)
            else:
                summary = _("Unmount Failed")
                #body = _("Unmount '%s' error.") % source.get_root().get_uri()
                body = _(
                    "Unmount '%s' error. Please unmount it in file manager"
                ) % source.get_root().get_uri()
                result = source.unmount_finish(res)
        except:
            result = False

        if not result:
            try:
                ntf = DbusNotify(
                    "deepin-system-settings",
                    "/usr/share/icons/Deepin/apps/48/mountmanager.png")
                ntf.set_summary(summary)
                ntf.set_body(body)
                ntf.notify()
            except:
                pass
コード例 #14
0
    def __init_widgets(self):
        self.start_record_button = Button(_("Start"))
        self.start_record_button.set_size_request(CAMERA_BOX_SIZE, 25)
        self.start_record_button.connect("clicked",
                                         self.__start_record_clicked)

        self.no_device_warning = Label(
            _("Please plug in or enable your camera"),
            label_width=300,
            text_x_align=pango.ALIGN_CENTER)
        self.keep_few_minutes = Label(_("Please keep still for 5 seconds"),
                                      label_width=300,
                                      text_x_align=pango.ALIGN_CENTER)
        # self.success = Label(_("Your face has been successfully recorded"), label_width=300, text_x_align=pango.ALIGN_CENTER)
        self.fail = Label(_("Failed to record your face"),
                          label_width=300,
                          text_x_align=pango.ALIGN_CENTER)

        self.success = gtk.Alignment(0.5, 0.5, 0, 0)
        self.success.set_size_request(300, -1)
        self.success_img = gtk.Image()
        self.success_img.set_from_pixbuf(self.success_pixbuf)
        self.success_box = gtk.HBox()
        self.success_box.pack_start(self.success_img, False, False, 5)
        self.success_box.pack_start(
            Label(_("Your face has been successfully recorded")))
        self.success.add(self.success_box)
コード例 #15
0
    def on_music_view_right_press_items(self, widget, x, y, current_item,
                                        select_items):
        if current_item and select_items:
            selected_songs_id = [
                item.get_song()['id'] for item in select_items
            ]
            # 子菜单 - 添加到创建的歌单
            addto_submenu = [
                (None, _(gobject.markup_escape_text(key)), self.add_to_list,
                 selected_songs_id, self.CREATED_LISTS_DICT[key])
                for key in self.CREATED_LISTS_DICT.keys()
            ]
            addto_submenu.insert(
                0, (None, _('播放列表'), self.add_to_list, selected_songs_id, 0))
            addto_submenu = Menu(addto_submenu)

            if len(select_items) > 1:
                items = [
                    (None, _("播放"), lambda: self.add_play_emit(
                        [item.get_song()['id'] for item in select_items])),
                ]
            else:
                items = [
                    (None, _("播放"), lambda: self.add_play_emit(
                        [current_item.get_song()['id']])),
                ]
            items.insert(0, (None, _("添加到"), addto_submenu))
            Menu(items, True).show((int(x), int(y)))
コード例 #16
0
 def __init__(self):
     gtk.VBox.__init__(self)
     
     self.set_spacing(5)
     self.plugins = utils.get_main_window().plugins
     self.plugins_view = TreeView()
     self.plugins_view.add_items = self.plugins_view_add_items
     self.plugins_view.set_expand_column(0)
     self.plugins_view.draw_mask = self.plugins_view_draw_mask
     self.plugins_view.set_size_request(420, 330)        
     self.plugins_view.connect("single-click-item", self.on_plugins_view_single_click)
     self.plugins_view.connect("press-return", self.on_plugins_view_press_return)
             
     self.plugins_view.set_column_titles([_("Name"), _("Version"), _("Enable"), ""],
                                         (self.sort_by_title, self.sort_by_title,
                                          self.sort_by_title, self.sort_by_title))
     plugins_view_align = set_widget_gravity(self.plugins_view, gravity=(1, 1, 1, 1),
                                             paddings=(10, 0, 0, 0))
     
     self.plugin_infos = PluginInfos()
     self.plugin_infos.set_size_request(420, 90)
     
     # plugin info
     self.pack_start(plugins_view_align, False, True)
     self.pack_start(self.plugin_infos, False, True)
コード例 #17
0
    def __init_navigatebar(self):
        self.navigatebar = TreeView(enable_drag_drop=False,
                                    enable_multiple_select=False)
        self.navigatebar.connect("single-click-item",
                                 self.on_navigatebar_single_click)
        self.navigatebar.set_size_request(132, -1)
        self.navigatebar.draw_mask = self.on_navigatebar_draw_mask

        local_expand_item = ExpandItem(_("Library"))
        network_expand_item = ExpandItem(_("Internet"))
        self.navigatebar.add_items([
            local_expand_item,
            network_expand_item,
        ])
        local_expand_item.add_childs([
            (FavoritesTitle, self.favorites_page),
            (LocalWallpapersTitle, self.pictures_page),
        ],
                                     expand=True)
        network_expand_item.add_childs([
            (_("360 Wallpaper"), self.bizhi360_cache_page),
            (_("LoveWallpaper"), self.aibizhi_cache_page),
        ],
                                       expand=True)

        if get_favorite_number() == 0:
            self.navigatebar.set_highlight_item(
                self.navigatebar.get_items()[2])
            self.switch_page.add(self.pictures_page)
        else:
            self.navigatebar.set_highlight_item(
                self.navigatebar.get_items()[1])
            self.switch_page.add(self.favorites_page)
コード例 #18
0
    def __init__(self, has_title=False):

        targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1),
                   ("text/uri-list", 0, 2), ("text/plain", 0, 3)]
        TreeView.__init__(self, drag_data=(targets, gtk.gdk.ACTION_COPY, 1))

        self.sorts = [
            lambda items, reverse: self.sort_by_key(items, reverse, "title"),
            lambda items, reverse: self.sort_by_key(items, reverse, "artist"),
            lambda items, reverse: self.sort_by_key(items, reverse, "album"),
            lambda items, reverse: self.sort_by_key(items, reverse, "#added"),
        ]

        del self.keymap["Delete"]
        self.connect("drag-data-get", self.__on_drag_data_get)
        self.connect("double-click-item", self.__on_double_click_item)
        self.connect("right-press-items", self.popup_right_menu)
        self.connect("press-return", self.__on_press_return)

        if has_title:
            self.set_column_titles(
                [_("Title"),
                 _("Artist"),
                 _("Album"),
                 _("Added time")], self.sorts)

        self.set_expand_column(0)
コード例 #19
0
    def __init__(self, connection, set_button, settings_obj=None):
        gtk.Alignment.__init__(self, 0, 0 ,0, 0)
        self.set_padding(35, 0, 20, 0)

        self.main_box = gtk.VBox()
        self.tab_name = "sfds"
        basic = SettingSection(_("Basic"))

        self.button = Button(_("Advanced"))
        self.button.set_size_request(50, 22)
        self.button.connect("clicked", self.show_more_options)
        self.broadband = SettingSection(_("Broadband"), always_show=True)
        self.ipv4 = SettingSection(_("IPv4 settings"), always_show=True)
        self.ppp = SettingSection(_("PPP"), always_show=True)
        align = gtk.Alignment(0, 0, 0, 0)
        align.set_padding(0, 0, 225, 0)
        align.add(self.button)
        
        self.broadband = Broadband(connection, set_button, settings_obj)
        basic.load([self.broadband, align])
        self.ipv4.load([IPV4Conf(connection, set_button, settings_obj=settings_obj)])
        self.ppp.load([PPPConf(connection, set_button, settings_obj)])

        self.space = gtk.HBox()
        self.space.set_size_request(-1 ,30)

        self.main_box.pack_start(basic, False, False)

        self.add(self.main_box)
コード例 #20
0
def check_before_voice():
    need_install_packages = get_install_packages(["libttspico-utils"])
    if len(need_install_packages) > 0:
        show_message(_("Package svox is required to enable pronunciation"), _("Cancel"), _("Install"), lambda : install_packages(need_install_packages))
        return False
    else:
        return True
コード例 #21
0
 def get_volume_menu(self):
     menu_items = [
         (None, _("Volume Up"), Player.increase_volume),
         (None, _("Volume Down"), Player.decrease_volume),
         (None, _("Mute"), Player.mute_volume),
     ]
     return Menu(menu_items)
コード例 #22
0
ファイル: toolbar.py プロジェクト: xbot/deepin-screenshot
 def _list_menu_show(self, button, x, y, offset_x, offset_y):
     '''the combo button clicked callback. show combo_buton list menu'''
     menu_item = [(None, _("save automatically"), self._list_menu_click,
                   SAVE_OP_AUTO, button),
                  (None, _("save as"), self._list_menu_click, SAVE_OP_AS,
                   button),
                  (None, _("save to clipboard"), self._list_menu_click,
                   SAVE_OP_CLIP, button),
                  (None, _("save automatically to file and clipboard"),
                   self._list_menu_click, SAVE_OP_AUTO_AND_CLIP, button)]
     # set current operate icon
     current_item = menu_item[self.screenshot.save_op_index]
     menu_pixbuf = (app_theme.get_pixbuf("action/selected.png"),
                    app_theme.get_pixbuf("action/selected_hover.png"),
                    app_theme.get_pixbuf("action/selected.png"))
     menu_item[self.screenshot.save_op_index] = (menu_pixbuf,
                                                 current_item[1],
                                                 current_item[2],
                                                 current_item[3])
     self.combo_menu = Menu(
         menu_item,
         is_root_menu=True,
         menu_item_select_color=app_theme.get_shadow_color(
             "menu_item_select").get_color_info())
     self.set_all_inactive()
     self.combo_menu.show((x, y), (offset_x, offset_y))
コード例 #23
0
 def handle_pkg_status(self, reply, success):
     container_remove_all(self.left_action_box)
     if success:
         install_status = str(reply)
         print install_status
         if install_status == "installed":
             if not self.data_manager.get_pkg_desktop_info(self.pkg_name):
                 status_label = Label(_("Successfully installed"))
                 self.left_action_box.pack_start(status_label)
             else:
                 action_button = ImageButton(
                     app_theme.get_pixbuf("button/start_normal.png"),
                     app_theme.get_pixbuf("button/start_hover.png"),
                     app_theme.get_pixbuf("button/start_press.png"),
                     )
                 action_button.connect("button-press-event", self.button_press_start_button)
                 self.left_action_box.pack_start(action_button)
         elif install_status == "unknown":
             status_label = Label(_("Not found"))
             self.left_action_box.pack_start(status_label)
         else:
             action_button = ImageButton(
                 app_theme.get_pixbuf("button/install_normal.png"),
                 app_theme.get_pixbuf("button/install_hover.png"),
                 app_theme.get_pixbuf("button/install_press.png"),
                 )
             action_button.connect("clicked", lambda w: global_event.emit("install-pkg", [self.pkg_name]))
             self.left_action_box.pack_start(action_button)
         self.left_action_box.show_all()
         global_event.emit('update-current-status-pkg-page', self)
     else:
         global_logger.logerror("get_pkg_installed handle_dbus_error")
         global_logger.logerror(reply)
コード例 #24
0
    def RequestConfirmation(self, device, passkey):
        print("RequestConfirmation (%s, %06d)" % (device, passkey))

        # def action_invoked(_id, _action):
        #     if _action == "pair_accept":
        #         pass
        #     elif _action == "pair_reject":
        #         raise Rejected("Passkey doesn't match")

        # noti = pynotify.Notification(_("Pair request"),
        #                              _("Device %s request for pair,\n please make sure the key is %s") % (device, passkey))
        # noti.add_action("pair_accept", _("Accept"), action_invoked)
        # noti.add_action("pair_reject", _("Reject"), action_invoked)
        # noti.show()

        result = []
        loop = None
        agent_d = AgentDialog(_("Please confirm %s pin match as below") %
                              Device(device).get_alias(),
                              str(passkey),
                              confirm_button_text=_("Yes"),
                              cancel_button_text=_("No"),
                              confirm_callback=lambda: result.append("yes"),
                              cancel_callback=lambda: result.append(None))

        agent_d.connect("destroy", lambda widget: loop.quit())
        agent_d.show_all()

        loop = gobject.MainLoop(None, False)
        gtk.gdk.threads_leave()
        loop.run()
        gtk.gdk.threads_enter()

        if not result[0]:
            raise_rejected("Passkey doesn't match.")
コード例 #25
0
    def __init__(self):
        '''
        init docs
        '''
        gtk.VBox.__init__(self)

        self.draw_title_background = self.draw_tab_title_background
        self.theme = None
        
        self.delete_view = DeleteView(padding_x=30, padding_y=ITEM_PADDING_Y)
        self.delete_view_sw = self.delete_view.get_scrolled_window()
        
        self.action_align = gtk.Alignment()
        self.action_align.set_padding(5, 5, 510, 5)
        self.action_box = gtk.HBox(spacing = 10)
        self.back_button = Button(_("Back"))
        self.back_button.set_size_request(80, WIDGET_HEIGHT)
        self.back_button.connect("clicked", self.__on_back)
        self.select_all_button = Button(_("Select all"))
        self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
        self.select_all_button.connect("clicked", self.__on_select_all)
        self.delete_button = Button(_("Delete"))
        self.delete_button.set_size_request(80, WIDGET_HEIGHT)
        self.delete_button.connect("clicked", self.__on_delete)
        self.action_box.pack_start(self.select_all_button, False, False)
        self.action_box.pack_start(self.delete_button, False, False)
        self.action_box.pack_start(self.back_button, False, False)
        self.action_align.add(self.action_box)
        
        self.pack_start(self.delete_view_sw, True, True)
        self.pack_start(self.action_align, False, False)

        event_manager.add_callback("select-delete-wallpaper", self.__on_select_delete_wallpaper)
コード例 #26
0
 def pause_job(self, widget):    
     value = self.jobs_view.playpause_jobs()
     if value:
         if widget.label == _("Pause"):
             widget.label = (_("Continue"))
         else:    
             widget.label = (_("Pause"))
コード例 #27
0
 def __init_navigatebar(self):
     self.navigatebar = TreeView(enable_drag_drop=False, enable_multiple_select=False)
     self.navigatebar.connect("single-click-item", self.on_navigatebar_single_click)
     self.navigatebar.set_size_request(132, -1)
     self.navigatebar.draw_mask = self.on_navigatebar_draw_mask
     
     local_expand_item = ExpandItem(_("Library"))
     network_expand_item = ExpandItem(_("Internet"))
     self.navigatebar.add_items([local_expand_item, 
                                 network_expand_item, 
                                ])
     local_expand_item.add_childs([
         (FavoritesTitle, self.favorites_page),
         (LocalWallpapersTitle, self.pictures_page),
         ],
         expand=True)
     network_expand_item.add_childs([(_("360 Wallpaper"), self.bizhi360_cache_page), 
                                     (_("LoveWallpaper"), self.aibizhi_cache_page),
                                    ], expand=True)        
     
     if get_favorite_number() == 0:
         self.navigatebar.set_highlight_item(self.navigatebar.get_items()[2])
         self.switch_page.add(self.pictures_page)
     else:
         self.navigatebar.set_highlight_item(self.navigatebar.get_items()[1])
         self.switch_page.add(self.favorites_page)
コード例 #28
0
    def create_source_update_frequency_table(self):
        main_table = gtk.Table(3, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)

        dir_title_label = Label(_("Refresh package lists"))

        # auto update check button
        self.is_auto_update_button = CheckButton(label_text=_('Upgrade automatically'))
        self.is_auto_update_button.connect('released', self.change_auto_update)
        self.is_auto_update_button.set_active(utils.is_auto_update())

        self.update_label = Label(_("Time interval: "))
        self.update_spin = SpinBox(int(get_update_interval()), 0, 168, 1)
        self.update_spin.connect("value-changed", lambda w, v: set_update_interval(v))
        self.hour_lablel = Label(_(" hour"))
        self.hour_lablel.set_size_request(50, 12)
        spin_hbox = gtk.HBox(spacing=3)
        spin_hbox.pack_start(self.update_label, False, False)
        spin_hbox.pack_start(self.update_spin, False, False)
        spin_hbox.pack_start(self.hour_lablel, False, False)

        main_table.attach(dir_title_label, 0, 2, 0, 1, yoptions=gtk.FILL)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
        main_table.attach(self.is_auto_update_button, 0, 1, 2, 3, xoptions=gtk.FILL)
        main_table.attach(spin_hbox, 1, 2, 2, 3, xpadding=10, xoptions=gtk.FILL)
        return main_table
コード例 #29
0
 def __on_select_all(self, widget):
     self.delete_view.select_all()
     if self.delete_view.is_select_all():
         self.select_all_button.set_label(_("Clear all"))
     else:
         self.select_all_button.set_label(_("Select all"))
     self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
コード例 #30
0
 def set_current_lrc(self, try_web=True, force_song=None):        
     ret = False
     if not force_song:
         force_song = self.current_song
     filename = self.lrc_manager.get_lrc(force_song, try_web)    
     if filename and os.path.exists(filename):
         if self.time_source != None:
             gobject.source_remove(self.time_source)
             self.time_source = None
             self.clear_lyrics()
         if try_web:
             gobject.idle_add(self.set_lrc_file, filename)
         else:    
             self.set_lrc_file(filename)
             ret = True
         self.set_duration(force_song.get("#duration"))    
         self.__find_flag = True
         if config.getboolean("lyrics", "status"):
             self.play_time_source()
     else:    
         if self.current_song != force_song:
             return 
         if self.time_source != None:
             gobject.source_remove(self.time_source)
             self.time_source = None
             self.clear_lyrics()
         if try_web:    
             self.set_message(self.get_default_message(force_song) + " "+ _("No lyrics found!"))
             self.scroll_lyrics.set_message(self.get_default_message(force_song) + " " +  _("No lyrics found!"))
         else:    
             self.set_search_fail_message(_("Searching for lyrics..."))
             self.scroll_lyrics.set_message(_("Searching for lyrics..."))
         self.__find_flag = False    
     return ret    
コード例 #31
0
    def get_tracks(self):
        if not self.disc_info:
            print "W:DiscID:No disk id"
            return []
        query_infos = mscddb.query(self.disc_info[1:])
        lengths = self.get_track_lengths()

        if query_infos is None:
            track_tags = []
            for i in range(0, self.disc_info[1]):
                tags = {
                    "title": _("Track") + " %d" % (i + 1),
                    "album": _("Unknown album"),
                    "artist": _("Unknown artist"),
                    "#track": (i + 1),
                    "uri": "cdda://%d#%s" % (i + 1, self.device_path),
                    "#duration": lengths[i]
                }
                track_tags.append(tags)
            return track_tags, _("Audio CD")

        query_tags, query_label = query_infos
        [
            info.update({
                "uri":
                "cdda://%d#%s" % (info["#track"], self.device_path),
                "#duration":
                lengths[info["#track"] - 1]
            }) for info in query_tags
        ]

        return query_tags, query_label or _("Audio CD")
コード例 #32
0
    def __init__(self):
        '''
        init docs
        '''
        gtk.VBox.__init__(self)

        self.draw_title_background = self.draw_tab_title_background
        self.theme = None

        self.delete_view = DeleteView(padding_x=30, padding_y=ITEM_PADDING_Y)
        self.delete_view_sw = self.delete_view.get_scrolled_window()

        self.action_align = gtk.Alignment()
        self.action_align.set_padding(5, 5, 510, 5)
        self.action_box = gtk.HBox(spacing=10)
        self.back_button = Button(_("Back"))
        self.back_button.set_size_request(80, WIDGET_HEIGHT)
        self.back_button.connect("clicked", self.__on_back)
        self.select_all_button = Button(_("Select all"))
        self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
        self.select_all_button.connect("clicked", self.__on_select_all)
        self.delete_button = Button(_("Delete"))
        self.delete_button.set_size_request(80, WIDGET_HEIGHT)
        self.delete_button.connect("clicked", self.__on_delete)
        self.action_box.pack_start(self.select_all_button, False, False)
        self.action_box.pack_start(self.delete_button, False, False)
        self.action_box.pack_start(self.back_button, False, False)
        self.action_align.add(self.action_box)

        self.pack_start(self.delete_view_sw, True, True)
        self.pack_start(self.action_align, False, False)

        event_manager.add_callback("select-delete-wallpaper",
                                   self.__on_select_delete_wallpaper)
コード例 #33
0
    def draw_lyrics(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation
        font_height = self.render_lyrics.get_font_height()
        xpos = rect.x + 5
        ypos = rect.y + 5
        cr.save()
        cr.rectangle(xpos, ypos, rect.width, rect.height)
        cr.clip()
        cr.set_operator(cairo.OPERATOR_OVER)
        
        # draw_active
        cr.save()
        cr.rectangle(xpos, ypos, rect.width * 0.5, rect.height)
        cr.clip()
        active_surface = self.draw_lyric_surface(_("Deepin Music Player"), True)
        if active_surface:
            cr.set_source_surface(active_surface, xpos, ypos)
            cr.paint()
        cr.restore()    
        
        # draw_inactive
        cr.save()
        cr.rectangle(xpos + rect.width * 0.5, ypos, rect.width*0.5, rect.height)
        cr.clip()
        inactive_surface = self.draw_lyric_surface(_("Deepin Music Player"))
        if inactive_surface:
            cr.set_source_surface(inactive_surface, xpos, ypos)
            cr.paint()
        cr.restore()    
        
        cr.restore()

        return False
コード例 #34
0
 def get_favorite_menu_item(self, item):        
     song = item.webcast        
     if song.get("collected", False):
         menu_name = _("Remove from Favorites")
     else:
         menu_name = _("Add to Favorites")
     return (None, menu_name, lambda : self.toggle_item_collected(item))    
コード例 #35
0
    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)
コード例 #36
0
ファイル: preference.py プロジェクト: kissthink/deepin-store
    def create_source_update_frequency_table(self):
        main_table = gtk.Table(3, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)

        dir_title_label = Label(_("Refresh package lists"))

        # auto update check button
        self.is_auto_update_button = CheckButton(label_text=_('Upgrade automatically'))
        self.is_auto_update_button.connect('released', self.change_auto_update)
        self.is_auto_update_button.set_active(utils.is_auto_update())

        self.update_label = Label(_("Time interval: "))
        self.update_spin = SpinBox(int(get_update_interval()), 0, 168, 1)
        self.update_spin.connect("value-changed", lambda w, v: set_update_interval(v))
        self.hour_lablel = Label(_(" hour"))
        self.hour_lablel.set_size_request(50, 12)
        spin_hbox = gtk.HBox(spacing=3)
        spin_hbox.pack_start(self.update_label, False, False)
        spin_hbox.pack_start(self.update_spin, False, False)
        spin_hbox.pack_start(self.hour_lablel, False, False)

        main_table.attach(dir_title_label, 0, 2, 0, 1, yoptions=gtk.FILL)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
        main_table.attach(self.is_auto_update_button, 0, 1, 2, 3, xoptions=gtk.FILL)
        main_table.attach(spin_hbox, 1, 2, 2, 3, xpadding=10, xoptions=gtk.FILL)
        return main_table
コード例 #37
0
    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)
コード例 #38
0
 def show_more_options(self, widget):
     self.settings_obj.initial_lock = True
     widget.parent.destroy()
     self.wireless = SettingSection(_("Wireless"), always_show=True)
     self.ipv4 = SettingSection(_("IPv4 settings"), always_show=True)
     self.ipv6 = SettingSection(_("IPv6 settings"), always_show=True)
     self.wireless.load([
         Wireless(self.connection,
                  self.set_button,
                  settings_obj=self.settings_obj)
     ])
     self.ipv4.load([
         IPV4Conf(self.connection,
                  self.set_button,
                  settings_obj=self.settings_obj,
                  link_local=True)
     ])
     self.ipv6.load([
         IPV6Conf(self.connection,
                  self.set_button,
                  settings_obj=self.settings_obj,
                  link_local=True)
     ])
     self.main_box.pack_start(self.wireless, False, False, 15)
     self.main_box.pack_start(self.ipv4, False, False)
     self.main_box.pack_start(self.ipv6, False, False, 15)
     self.settings_obj.initial_lock = False
コード例 #39
0
ファイル: tray.py プロジェクト: linuxmint17/deepin-music
 def get_volume_menu(self):
     menu_items = [
         (None, _("Volume Up"), Player.increase_volume),
         (None, _("Volume Down"), Player.decrease_volume),
         (None, _("Mute"), Player.mute_volume),
     ]
     return Menu(menu_items)
コード例 #40
0
    def on_listview_right_press_items(self, widget, root_x, root_y, current_item, select_items):
        if self.owner == "detail":        
            def on_delete_selected_record():
                def on_ok_clicked():
                    def _remove_selected():
                        for item in select_items:
                            db.remove(item.id)
                        db.commit()
                        widget.delete_items(select_items)
                        widget.get_toplevel()._init_data()
                    Thread(target=_remove_selected).run()
                
                dialog = ConfirmDialog(
                    _("Delete Item(s)"),
                    _("Are you sure you want to delete the selected item(s)?"),
                    confirm_callback = on_ok_clicked)
                dialog.show_all()
                
            def on_delete_all_record():
                def on_ok_clicked():
                    def _remove_all():
                        for item in self.items:
                            db.remove(item.id)
                        db.commit()
                        widget.get_toplevel().refresh_view()                        
                    Thread(target=_remove_all).run()

                dialog = ConfirmDialog(
                    _("Delete Item(s)"),
                    _("Are you sure delete all items?"),
                    confirm_callback = on_ok_clicked)
                dialog.show_all()
                
            Menu([(None, _("Delete selected item(s)"), on_delete_selected_record),
                  (None, _("Delete all items"), on_delete_all_record)], True).show((root_x, root_y))
コード例 #41
0
    def __init__(self):
        gtk.VBox.__init__(self)
        self.set_spacing(5)        
        
        # home slider.
        self.home_slider = SlideSwitcher()
        self.home_slider.set_size_request(-1, 200)
        
        # recommmend tab switcher.
        self.recommend_tab = PageSwitcher([_("Hot MHz"), _("Pop MHz")])
        self.recommend_tab.connect("tab-switch-start", lambda switcher, tab_index: self.switch_recommend_view(tab_index))

        # Init recommend view.
        self.hot_recommend_box = NetworkRadioView(tag=TAG_HOT, padding_y=5)
        self.fast_recommend_box = NetworkRadioView(tag=TAG_FAST, padding_y=5)
        
        # Use switch recommend view.
        self.recommend_page_box = gtk.VBox()        
        self.recommend_page_box.add(self.hot_recommend_box)
        
        self.pack_start(self.home_slider, False, True)
        self.pack_start(self.recommend_tab, False, True)
        self.pack_start(self.recommend_page_box, True, True)
        
        # Init data
        self.banner_thread_id = 0
コード例 #42
0
    def __init__(self):
        gtk.VBox.__init__(self)
        self.set_spacing(5)        
        
        # home slider.
        self.home_slider = SlideSwitcher()
        self.home_slider.set_size_request(-1, 200)
        
        # recommmend tab switcher.
        self.recommend_tab = PageSwitcher([_("Hot MHz"), _("Pop MHz")])
        self.recommend_tab.connect("tab-switch-start", lambda switcher, tab_index: self.switch_recommend_view(tab_index))

        # Init recommend view.
        self.hot_recommend_box = NetworkRadioView(tag=TAG_HOT, padding_y=5)
        self.fast_recommend_box = NetworkRadioView(tag=TAG_FAST, padding_y=5)
        
        # Use switch recommend view.
        self.recommend_page_box = gtk.VBox()        
        self.recommend_page_box.add(self.hot_recommend_box)
        
        self.pack_start(self.home_slider, False, True)
        self.pack_start(self.recommend_tab, False, True)
        self.pack_start(self.recommend_page_box, True, True)
        
        # Init data
        self.banner_thread_id = 0
コード例 #43
0
 def create_play_box(self):
     main_table = gtk.Table(4, 2)
     main_table.set_row_spacings(10)
     
     play_title_label = Label(_("Playing"))
     play_title_label.set_size_request(350, 12)
     
     fade_check_hbox = gtk.HBox()
     self.fade_check_button = CheckButton(_("Crossfade"))        
     fade_check_hbox.pack_start(self.fade_check_button, False, False)
     fade_check_hbox.pack_start(create_right_align(), True, True)
     self.album_check_button = CheckButton(_("Crossfade gapless album"))
     
     fade_label = Label(_("Fade timeout:"))
     self.fade_spin = SpinBox(300, 1, 1000, 100)
     millisecond_lablel = Label(_(" ms"))        
     millisecond_lablel.set_size_request(50, 12)
     spin_hbox = gtk.HBox(spacing=3)
     spin_hbox.pack_start(fade_label, False, False)
     spin_hbox.pack_start(self.fade_spin, False, False)
     spin_hbox.pack_start(millisecond_lablel, False, False)
     
     main_table.attach(play_title_label, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
     main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
     main_table.attach(fade_check_hbox, 0, 1, 2, 3, yoptions=gtk.FILL)
     main_table.attach(self.album_check_button, 1, 2, 2, 3, yoptions=gtk.FILL)
     main_table.attach(spin_hbox, 0, 1, 3, 4, yoptions=gtk.FILL, xpadding=8)
     return main_table
コード例 #44
0
    def create_source_update_frequency_table(self):
        main_table = gtk.Table(3, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)
        
        dir_title_label = Label(_("Update applications lists"))
        dir_title_label.set_size_request(200, 12)
        label_align = gtk.Alignment()
        label_align.set_padding(0, 0, 0, 0)
        label_align.add(dir_title_label)

        self.is_auto_update_button = CheckButton(label_text=_('Update automatically'))
        self.is_auto_update_button.connect('toggled', self.change_auto_update)
        
        self.update_label = Label(_("Time interval: "))
        self.update_spin = SpinBox(int(get_update_interval()), 0, 168, 1)
        self.update_spin.connect("value-changed", lambda w, v: set_update_interval(v))
        self.hour_lablel = Label(_(" hour"))
        self.hour_lablel.set_size_request(50, 12)
        spin_hbox = gtk.HBox(spacing=3)
        spin_hbox.pack_start(self.update_label, False, False)
        spin_hbox.pack_start(self.update_spin, False, False)
        spin_hbox.pack_start(self.hour_lablel, False, False)

        main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
        main_table.attach(self.is_auto_update_button, 0, 1, 2, 3, xpadding=10, xoptions=gtk.FILL)
        main_table.attach(spin_hbox, 1, 2, 2, 3, xpadding=10, xoptions=gtk.FILL)

        if is_auto_update():
            self.is_auto_update_button.set_active(True)
        else:
            self.is_auto_update_button.toggled()

        return main_table
コード例 #45
0
 def __on_delete(self, widget):
     if self.delete_view.is_deletable():
         dlg = ConfirmDialog(_("Delete Wallpaper"),
                             _("Are you sure delete wallpaper?"), 300, 100,
                             lambda: self.__delete_confirm(), None, True,
                             CONTENT_FONT_SIZE)
         dlg.show_all()
コード例 #46
0
 def check_before_translate(self):
     self.need_install_packages = get_install_packages(["sdcv", "stardict-xdict-ce-gb", "stardict-xdict-ec-gb"])
     if len(self.need_install_packages) > 0:
         show_message(_("Need install sdcv package to enable translate feature"), _("Cancel"), _("Install"), self.install_sdcv)
         return False
     else:
         return True
コード例 #47
0
    def __toggled(self, widget, argv):
        if argv == "auto_time_toggle":
            is_auto_set_time = widget.get_active()
            self.datetime_settings.set_boolean("is-auto-set", is_auto_set_time)
            if is_auto_set_time:
                self.__send_message("status", ("date_time", _("Time will be synchronized with an Internet time server")))
                self.set_time_spin_align.set_child_visible(False)
                gobject.timeout_add_seconds(3, self.__set_using_ntp, True)
            else:
                self.__send_message("status", ("date_time", _("Time will not be synchronized with an Internet time server")))
                self.set_time_spin_align.set_child_visible(True)
                if self.__toggle_id:
                    gobject.source_remove(self.__toggle_id)
                self.__toggle_id = gobject.timeout_add_seconds(3, self.__set_using_ntp, False)
            return

        if argv == "time_display_toggle":
            self.is_24hour = widget.get_active()
            if self.is_24hour:
                self.__send_message("status", ("date_time", _("Time will be shown in 24 hour format")))
            else:
                self.__send_message("status", ("date_time", _("Time will be shown in 12 hour format")))
            self.datetime_settings.set_boolean("is-24hour", self.is_24hour)
            self.datetime_widget.set_is_24hour(self.is_24hour)
            self.set_time_spin.set_24hour(self.is_24hour)
コード例 #48
0
    def get_tracks(self):
        if not self.disc_info:
            print "W:DiscID:No disk id"
            return []
        query_infos = mscddb.query(self.disc_info[1:])
        lengths = self.get_track_lengths()

        if query_infos is None:
            track_tags = []
            for i in range(0, self.disc_info[1]):
                tags = {
                    "title": _("Track") + " %d" % (i + 1),
                    "album": _("Unknown album"),
                    "artist": _("Unknown artist"),
                    "#track": (i + 1),
                    "uri": "cdda://%d#%s" % (i + 1, self.device_path),
                    "#duration": lengths[i],
                }
                track_tags.append(tags)
            return track_tags, _("Audio CD")

        query_tags, query_label = query_infos
        [
            info.update(
                {"uri": "cdda://%d#%s" % (info["#track"], self.device_path), "#duration": lengths[info["#track"] - 1]}
            )
            for info in query_tags
        ]

        return query_tags, query_label or _("Audio CD")
コード例 #49
0
    def __combo_item_selected(self, widget, item_text=None, item_value=None, item_index=None, object=None):
        if object == "press_button_power":
            self.__send_message("status", ("power", _("%s when pressing the power button") % item_text))
            self.power_manager.set_press_button_power(item_value)
            return

        if object == "close_notebook_cover":
            self.__send_message("status", ("power", _("%s when closing the lid") % item_text))
            self.power_manager.set_close_notebook_cover(item_value)
            return

        if object == "power_plan":
            self.__send_message("status", ("power", _("Power plan has been changed to %s") % item_text))
            self.power_manager.set_current_plan(item_value)
            return

        if object == "suspend":
            self.__send_message("status", ("power", _("Changed Suspend Status to %s") % item_text))
            self.power_plan_combo.set_select_index(self.power_manager.customized)
            self.power_manager.set_suspend_status(item_value)
            self.power_manager.update_xml(self.close_monitor_combo.get_current_item()[1], item_value)
            self.power_manager.set_current_plan(PowerManager.customized)
            return

        if object == "close_monitor":
            self.__send_message("status", ("power", _("The time before turning off monitor has been changed to %s") % item_text))
            self.power_plan_combo.set_select_index(self.power_manager.customized)
            self.power_manager.set_close_monitor(item_value)
            self.power_manager.update_xml(item_value, self.suspend_combo.get_current_item()[1])
            self.power_manager.set_current_plan(PowerManager.customized)
            return
コード例 #50
0
 def get_add_menu(self):    
     menu_items = [
         (None, _("File"), self.add_file),
         (None, _("Folder(include subdirectories)"), self.recursion_add_dir),
         (None, _("Folder"), self.add_dir),
         ]
     return Menu(menu_items)
コード例 #51
0
 def create_lyrics_dir_table(self):    
     main_table = gtk.Table(3, 2)
     main_table.set_row_spacings(CONTENT_ROW_SPACING)
     
     dir_title_label = Label(_("Lyrics directory"))
     dir_title_label.set_size_request(200, 12)
     label_align = gtk.Alignment()
     label_align.set_padding(0, 0, 0, 0)
     label_align.add(dir_title_label)
     
     self.dir_entry = InputEntry()
     self.dir_entry.set_text(os.path.expanduser(config.get("lyrics", "save_lrc_path", "~/.lyrics")))
     self.dir_entry.set_editable(False)        
     self.dir_entry.set_size(250, 25)
     
     modify_button = Button(_("Change"))
     modify_button.connect("clicked", self.change_lyrics_save_dir)
     hbox = gtk.HBox(spacing=5)
     hbox.pack_start(self.dir_entry, False, False)
     hbox.pack_start(modify_button, False, False)
     
     main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
     main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
     main_table.attach(hbox, 0, 2, 2, 3, xpadding=10, xoptions=gtk.FILL)
     return main_table
コード例 #52
0
 def create_play_box(self):
     main_table = gtk.Table(5, 2)
     main_table.set_row_spacings(CONTENT_ROW_SPACING)
     
     play_title_label = Label(_("Playback settings"))
     play_title_label.set_size_request(350, 12)
     
     fade_check_hbox = gtk.HBox()
     self.fade_check_button = CheckButton(_("Enable crossfade"))        
     fade_check_hbox.pack_start(self.fade_check_button, False, False)
     fade_check_hbox.pack_start(create_right_align(), True, True)
     self.album_check_button = CheckButton(_("Seamless switching between the same album"))
     album_check_hbox = gtk.HBox()
     album_check_hbox.pack_start(self.album_check_button, False, False)
     album_check_hbox.pack_start(create_right_align(), True, True)
     
     fade_label = Label("%s" % _("Crossfade"))
     self.fade_spin = SpinBox(200, 0, 900, 100)
     millisecond_lablel = Label(_(" ms"))        
     millisecond_lablel.set_size_request(50, 12)
     spin_hbox = gtk.HBox(spacing=3)
     spin_hbox.pack_start(fade_label, False, False)
     spin_hbox.pack_start(self.fade_spin, False, False)
     spin_hbox.pack_start(millisecond_lablel, False, False)
     
     main_table.attach(play_title_label, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
     main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
     main_table.attach(fade_check_hbox, 0, 2, 2, 3, yoptions=gtk.FILL)
     main_table.attach(album_check_hbox, 0, 2, 3, 4, yoptions=gtk.FILL)
     main_table.attach(spin_hbox, 0, 1, 4, 5, yoptions=gtk.FILL, xpadding=8)
     return main_table
コード例 #53
0
 def __set_card_treeview_status(self):
     card_list = []
     cards = pypulse.PULSE.get_cards()
     for idx in cards:
         active_profile = cards[idx]['active_profile']
         if active_profile:
             if active_profile['n_sinks'] > 1:
                 io_num = _("%d Outputs") % active_profile['n_sinks']
             else:
                 io_num = _("%d Output") % active_profile['n_sinks']
             if active_profile['n_sources'] > 1:
                 io_num += " / " + _("%d Inputs") % active_profile['n_sources']
             else:
                 io_num += " / " + _("%d Input") % active_profile['n_sources']
             if 'device.description' in cards[idx]['proplist']:
                 description = cards[idx]['proplist']['device.description'].strip('\x00')
             else:
                 description = ""
             card_info = "%s(%s)[%s]" % (description, io_num, active_profile['description'])
         else:
             if 'device.description' in cards[idx]['proplist']:
                 card_info = cards[idx]['proplist']['device.description']
             else:
                 card_info = " "
         card_list.append(TreeItem(self.image_widgets["device"], card_info, cards[idx]['name'], idx))
     self.view_widgets["ad_hardware"].add_items(card_list, clear_first=True)
     if card_list:
         self.view_widgets["ad_hardware"].set_select_rows([0])
コード例 #54
0
    def plugin_widget(self):
        self.__get_devices()
        plugin_box = gtk.VBox()
        adapter_box = gtk.HBox(spacing=5)
        adapter_image = ImageBox(
            app_theme.get_pixbuf("bluetooth/enable_open.png"))
        adapter_label = self.__setup_label(_("Adapter"))
        adapter_toggle = self.__setup_toggle()
        if self.my_bluetooth.adapter:
            adapter_toggle.set_active(self.my_bluetooth.adapter.get_powered())
            if self.my_bluetooth.adapter.get_powered():
                self.tray_icon.set_icon_theme("enable")
            else:
                self.tray_icon.set_icon_theme("enable_disconnect")
        adapter_toggle.connect("toggled", self.__adapter_toggled)
        separator_align = self.__setup_align(padding_bottom=0)
        separator = self.__setup_separator()
        separator_align.add(separator)
        '''
        devices treeview
        '''
        device_treeview = TreeView()
        device_separator_align = self.__setup_align()
        device_separator = self.__setup_separator()
        device_separator_align.add(device_separator)
        device_count = len(self.device_items)
        if device_count:
            device_treeview.delete_all_items()
            device_treeview.add_items(self.device_items)
            device_treeview.set_size_request(
                self.width, device_count * DeviceItem.ITEM_HEIGHT)
        else:
            device_treeview.set_child_visible(False)
            device_separator_align.set_size_request(-1, 0)
            device_separator_align.set_child_visible(False)
        '''
        select button
        '''
        select_button_align = self.__setup_align()
        select_button = SelectButton(_("Advanced options..."),
                                     font_size=10,
                                     ali_padding=5)
        select_button.set_size_request(self.width, 25)
        select_button.connect(
            "clicked", self.__bluetooth_selected
        )  # I don't know why, but replacing "button-press-event" with
        select_button_align.add(select_button)  # clicked really works...

        adapter_box.pack_start(adapter_image, False, False)
        adapter_box.pack_start(adapter_label, False, False)
        adapter_box.pack_start(adapter_toggle, False, False)

        plugin_box.pack_start(adapter_box, False, False)
        plugin_box.pack_start(separator_align, False, False)
        plugin_box.pack_start(device_treeview, False, False)
        plugin_box.pack_start(device_separator_align, False, False)
        plugin_box.pack_start(select_button_align, False, False)

        return plugin_box
コード例 #55
0
 def popup_delete_menu(self, x, y):
     items = [
         (None, _("Remove Track from this List"), self.remove_select_items),
         (None, _("Remove Unavailable Tracks"), self.delete_error_items),
         (None, _("Move to Trash"), lambda: self.try_move_trash()),
         (None, _("Clear List"), self.erase_items)
     ]
     Menu(items, True).show((int(x), int(y)))
コード例 #56
0
 def web_view_load_error(self, web, fram, url, error, data=None):
     web.load_string(
         "<html><body><p><h1>%s</h1></p>%s</body></html>" % (
         _("Unable to load page"),
         _("Problem occurred while loading the URL '%s'") % (url)),
         "text/html", "UTF-8", "")
     print url
     return True
コード例 #57
0
    def __on_wallpaper_apply(self, name, obj, select_item):
        self.__random_disable()

        if self.wallpaper_view.is_select_all():
            self.select_all_button.set_label(_("Clear all"))
        else:
            self.select_all_button.set_label(_("Select all"))
        self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
コード例 #58
0
 def __get_info(self, song):
     genre = song.get_str("genre")
     artist = song.get_str("artist")
     album = song.get_str("album")
     if not genre.strip(): genre = _("Unknown")
     if not artist.strip(): artist = _("Unknown")
     if not album.strip(): album = _("Unknown")
     return genre, artist, album