def __init__(self, network_interface):
        gtk.VBox.__init__(self)

        self.theme = None

        self.set_spacing(10)

        self.cache_view = CacheView(network_interface, download_dir=get_download_wallpaper_dir())
        self.cache_view_sw = self.cache_view.get_scrolled_window()

        self.nolink_image = ImageBox(app_theme.get_pixbuf("individuation/notlink.png"))

        self.back_button = Button(_("Back"))
        self.back_button.connect("clicked", self.__on_back)
        download_button = Button(_("Download All"))
        download_button.connect("clicked", self.on_download_button_clicked)

        control_box = gtk.HBox(spacing=10)
        control_box.pack_start(self.back_button, False, False)

        self.control_align = gtk.Alignment()
        self.control_align.set(1.0, 0.5, 0, 0)
        self.control_align.set_padding(0, 5, 0, 10)
        self.control_align.add(control_box)

        self.pack_start(self.cache_view_sw, True, True)
        self.pack_start(self.control_align, False, True)

        event_manager.add_callback("fetch-failed", self.__fetch_failed)
 def __init__(self, title="(无文件)"):
     Button.__init__(self, title)
     self.filename = None # conv file name.
     self.uri = None # uri file name.
     self.folder_path = None # dir path.        
     # button connect signal (clicked).
     self.connect("clicked", self.fil_choose_button_clicked)
Ejemplo n.º 3
0
    def create_mirror_select_table(self):
        main_table = gtk.Table(3, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)

        mirror_select_title = Label(_("Select mirror"))
        self.select_best_mirror_button = Button(self.select_best_mirror_button_texts["normal"])
        self.select_best_mirror_button.connect("clicked", self.select_best_mirror)

        self.mirrors_dir = os.path.join(get_parent_dir(__file__, 2), 'mirrors')
        self.current_mirror_hostname = utils.get_current_mirror_hostname()
        self.mirror_items = self.get_mirror_items()
        self.mirror_view = TreeView(self.mirror_items,
                                enable_drag_drop=False,
                                enable_multiple_select=False,
                                mask_bound_height=0,
                             )
        self.mirror_view.set_expand_column(1)
        self.mirror_view.set_size_request(-1, 280)
        self.mirror_view.draw_mask = self.mirror_treeview_draw_mask

        main_table.attach(mirror_select_title, 0, 1, 0, 1, yoptions=gtk.FILL)
        main_table.attach(self.select_best_mirror_button, 1, 2, 0, 1, xoptions=gtk.FILL)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, xoptions=gtk.FILL)
        main_table.attach(self.mirror_view, 0, 2, 2, 3, xoptions=gtk.FILL)


        return main_table
    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)
    def __init__(self,
                 title,
                 message,
                 default_width=400,
                 default_height=220,
                 confirm_callback=None,
                 cancel_callback=None,
                 confirm_button_text="Yes",
                 cancel_button_text="No"):
        DialogBox.__init__(self, "", default_width, default_height, DIALOG_MASK_SINGLE_PAGE)
        self.confirm_callback = confirm_callback
        self.cancel_callback = cancel_callback

        self.title_align = gtk.Alignment()
        self.title_align.set(0, 0, 0, 0)
        self.title_align.set_padding(0, 0, FRAME_LEFT_PADDING, 8)
        self.title_label = Label(title, wrap_width=300)

        self.label_align = gtk.Alignment()
        self.label_align.set(0.5, 0.5, 0, 0)
        self.label_align.set_padding(0, 0, 8, 8)
        self.label = Label(message, text_x_align=ALIGN_MIDDLE, text_size=55)

        self.confirm_button = Button(confirm_button_text)
        self.cancel_button = Button(cancel_button_text)

        self.confirm_button.connect("clicked", lambda w: self.click_confirm_button())
        self.cancel_button.connect("clicked", lambda w: self.click_cancel_button())

        self.body_box.pack_start(self.title_align, False, False)
        self.title_align.add(self.title_label)
        self.body_box.pack_start(self.label_align, True, True)
        self.label_align.add(self.label)

        self.right_button_box.set_buttons([self.cancel_button, self.confirm_button])
Ejemplo n.º 6
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)
    def __init__(self, default_width=300, default_height=160, cancel_cb=None):
        DialogBox.__init__(self, "", default_width, default_height, self.DIALOG_MASK_SINGLE_PAGE)

        self.cancel_cb = cancel_cb

        self.message_align = gtk.Alignment()
        self.message_align.set(0, 0, 0, 0)
        self.message_align.set_padding(0, 0, 10, 0)
        self.message_label = Label("", label_width=300)
        self.message_align.add(self.message_label)
        self.progress_align = gtk.Alignment()
        self.progress_align.set(0, 0, 0, 0)
        self.progress_align.set_padding(20, 0, 10, 10)
        self.progress_bar = ProgressBar()
        self.progress_bar.set_size_request(default_width, -1)
        self.progress_align.add(self.progress_bar)
        self.percentage_align = gtk.Alignment()
        self.percentage_align.set(0, 0, 0, 0)
        self.percentage_align.set_padding(10, 0, 140, 0)
        self.percentage_label = Label("0%", label_width=300)
        self.percentage_label.set_size_request(default_width, -1)
        self.percentage_align.add(self.percentage_label)
        self.cancel_align = gtk.Alignment()
        self.cancel_align.set(0, 0, 0, 0)
        self.cancel_align.set_padding(20, 0, 200, 0)
        self.cancel_button = Button(_("Cancel"))
        self.cancel_button.set_size_request(70, WIDGET_HEIGHT)
        self.cancel_button.connect("clicked", self.__on_cancel_button_clicked)
        self.cancel_align.add(self.cancel_button)

        self.body_box.pack_start(self.message_align, False, False)
        self.body_box.pack_start(self.progress_align, False, False)
        self.body_box.pack_start(self.percentage_align, False, False)
        self.body_box.pack_start(self.cancel_align)
class BluetoothReplyDialog(DialogBox):
    DIALOG_MASK_SINGLE_PAGE = 0

    def __init__(self, message, default_width=300, default_height=140, is_succeed=True):
        DialogBox.__init__(self, "", default_width, default_height, self.DIALOG_MASK_SINGLE_PAGE)

        self.hbox = gtk.HBox()
        self.image_align = gtk.Alignment()
        self.image_align.set(0, 0, 0, 0)
        self.image_align.set_padding(0, 0, 20, 0)
        self.image_box = ImageBox(app_theme.get_pixbuf("bluetooth/succeed.png"))
        if not is_succeed:
            self.image_box = ImageBox(app_theme.get_pixbuf("bluetooth/failed.png"))
        self.image_align.add(self.image_box)
        self.message_align = gtk.Alignment()
        self.message_align.set(0, 0, 0, 0)
        self.message_align.set_padding(20, 0, 10, 0)
        if not is_succeed:
            self.message_align.set_padding(0, 0, 10, 0)
        self.message_label = Label(message, wrap_width = 200)
        self.message_align.add(self.message_label)
        self.hbox.pack_start(self.image_align)
        self.hbox.pack_start(self.message_align)
        self.confirm_align = gtk.Alignment()
        self.confirm_align.set(0, 0, 0, 0)
        self.confirm_align.set_padding(20, 0, 200, 0)
        self.confirm_button = Button(_("Ok"))
        self.confirm_button.set_size_request(70, WIDGET_HEIGHT)
        self.confirm_button.connect("clicked", lambda widget : self.destroy())
        self.confirm_align.add(self.confirm_button)

        self.body_box.pack_start(self.hbox, False, False)
        self.body_box.pack_start(self.confirm_align, False, False)
Ejemplo n.º 9
0
 def __init__(self, title="(无文件)"):
     Button.__init__(self, title)
     self.filename = None  # conv file name.
     self.uri = None  # uri file name.
     self.folder_path = None  # dir path.
     # button connect signal (clicked).
     self.connect("clicked", self.fil_choose_button_clicked)
Ejemplo n.º 10
0
class BluetoothInputDialog(BluetoothDialog):
    
    def __init__(self, title, ok_cb=None, cancel_cb=None):
        BluetoothDialog.__init__(self, title)
        
        self.ok_cb = ok_cb
        self.cancel_cb = cancel_cb
        
        self.input_entry_align = gtk.Alignment()
        self.input_entry_align.set_padding(20, 20, 5, 5)
        
        self.input_entry = InputEntry("")
        self.input_entry.set_size(500, 25)
        
        self.ok_button = Button(_("OK"))
        self.ok_button.connect("clicked", self.__ok_callback)
        self.cancel_button = Button(_("Cancel"))
        self.cancel_button.connect("clicked", self.__cancel_callback)
        
        self.input_entry_align.add(self.input_entry)
        self.vbox.pack_end(self.input_entry_align)
        self.add_dtk_button(self.ok_button, gtk.RESPONSE_OK)
        self.add_dtk_button(self.cancel_button, gtk.RESPONSE_CANCEL)
        
        self.input_entry.entry.connect("press-return", ok_cb, self.input_entry.get_text())
        
    def __ok_callback(self, widget):
        if self.ok_cb:
            apply(self.ok_cb, [self.input_entry.get_text()])
            
    def __cancel_callback(self, widget):
        if self.cancel_cb:
            self.cancel_cb()
Ejemplo n.º 11
0
 def __init__(self, song=None):
     super(InfoSetting, self).__init__()
     self.song = song
     main_align = gtk.Alignment()
     main_align.set_padding(40, 0, 100, 0)
     main_align.set(0, 0, 0.5, 0.5)
     self.main_table = gtk.Table(6, 3)
     self.main_table.set_col_spacings(10)
     self.main_table.set_row_spacings(10)
     
     self.title_entry  = self.create_combo_entry(0, 1, _("Title:"))
     self.artist_entry = self.create_combo_entry(1, 2, _("Artist:"))
     self.album_entry  = self.create_combo_entry(2, 3, _("Album:"))
     self.genre_entry  = self.create_combo_entry(3, 4, _("Genre:"))
     self.date_entry   = self.create_combo_entry(4, 5, _("Date:"))
     
     main_align.add(self.main_table)
     
     # Update song
     if song:
         self.update_song(song)
         
     save_button = Button(_("Save"))    
     save_button.connect("clicked", self.save_taginfo)
     block_box = gtk.EventBox()
     block_box.set_visible_window(False)
     block_box.set_size_request(90, -1)
     button_box = gtk.HBox()
     button_box.pack_start(create_right_align(), True, True)
     button_box.pack_start(save_button, False, False)
     button_box.pack_start(block_box, False, False)
     self.pack_start(main_align, False, True)
     self.pack_start(button_box, False, False)
Ejemplo n.º 12
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)
    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)
Ejemplo n.º 14
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
    def __init__(self, message, default_width=300, default_height=140, is_succeed=True):
        DialogBox.__init__(self, "", default_width, default_height, self.DIALOG_MASK_SINGLE_PAGE)

        self.hbox = gtk.HBox()
        self.image_align = gtk.Alignment()
        self.image_align.set(0, 0, 0, 0)
        self.image_align.set_padding(0, 0, 20, 0)
        self.image_box = ImageBox(app_theme.get_pixbuf("bluetooth/succeed.png"))
        if not is_succeed:
            self.image_box = ImageBox(app_theme.get_pixbuf("bluetooth/failed.png"))
        self.image_align.add(self.image_box)
        self.message_align = gtk.Alignment()
        self.message_align.set(0, 0, 0, 0)
        self.message_align.set_padding(20, 0, 10, 0)
        if not is_succeed:
            self.message_align.set_padding(0, 0, 10, 0)
        self.message_label = Label(message, wrap_width = 200)
        self.message_align.add(self.message_label)
        self.hbox.pack_start(self.image_align)
        self.hbox.pack_start(self.message_align)
        self.confirm_align = gtk.Alignment()
        self.confirm_align.set(0, 0, 0, 0)
        self.confirm_align.set_padding(20, 0, 200, 0)
        self.confirm_button = Button(_("Ok"))
        self.confirm_button.set_size_request(70, WIDGET_HEIGHT)
        self.confirm_button.connect("clicked", lambda widget : self.destroy())
        self.confirm_align.add(self.confirm_button)

        self.body_box.pack_start(self.hbox, False, False)
        self.body_box.pack_start(self.confirm_align, False, False)
Ejemplo n.º 16
0
    def __init__(self, song=None):
        super(InfoSetting, self).__init__()
        self.song = song
        main_align = gtk.Alignment()
        main_align.set_padding(40, 0, 100, 0)
        main_align.set(0, 0, 0.5, 0.5)
        self.main_table = gtk.Table(6, 3)
        self.main_table.set_col_spacings(10)
        self.main_table.set_row_spacings(10)

        self.title_entry = self.create_combo_entry(0, 1, _("Title"))
        self.artist_entry = self.create_combo_entry(1, 2, _("Artist"))
        self.album_entry = self.create_combo_entry(2, 3, _("Album"))
        self.genre_entry = self.create_combo_entry(3, 4, _("Genre"))
        self.date_entry = self.create_combo_entry(4, 5, _("Date"))

        main_align.add(self.main_table)

        # Update song
        if song:
            self.update_song(song)

        save_button = Button(_("Save"))
        save_button.connect("clicked", self.save_taginfo)
        block_box = gtk.EventBox()
        block_box.set_visible_window(False)
        block_box.set_size_request(90, -1)
        button_box = gtk.HBox()
        button_box.pack_start(create_right_align(), True, True)
        button_box.pack_start(save_button, False, False)
        button_box.pack_start(block_box, False, False)
        self.pack_start(main_align, False, True)
        self.pack_start(button_box, False, False)
    def __init__(self):
        """
        init docs
        """
        gtk.VBox.__init__(self)

        self.__background_settings = deepin_gsettings.new("com.deepin.dde.background")

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

        self.wallpaper_box = gtk.VBox()
        self.window_theme_box = gtk.VBox()
        self.wallpaper_view = WallpaperView(padding_x=30, padding_y=ITEM_PADDING_Y)
        self.wallpaper_view_sw = self.wallpaper_view.get_scrolled_window()
        self.wallpaper_view_sw.set_size_request(-1, 426)

        position_group, self.position_combobox = get_combo_group(
            _("Position"), DRAW_COMBO_ITEM, self.on_position_combox_selected
        )
        time_group, self.time_combobox = get_combo_group(_("Duration"), TIME_COMBO_ITEM, self.on_time_combox_selected)

        self.__is_random = True
        if self.__background_settings.get_int("background-duration") == 0:
            self.__is_random = False
        self.unorder_play, self.random_toggle = get_toggle_group(
            _("Random"), self.__on_random_toggled, self.__is_random
        )
        self.button_align = gtk.Alignment()
        self.button_box = gtk.HBox(spacing=5)
        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.button_box.pack_start(self.select_all_button, False, False)
        self.button_box.pack_start(self.delete_button, False, False)
        self.button_align.add(self.button_box)

        self.action_bar = gtk.HBox(spacing=26)
        self.action_bar.pack_start(position_group, False, False)
        self.action_bar.pack_start(time_group, False, False)
        self.action_bar.pack_start(self.unorder_play, False, False)
        self.action_bar.pack_end(self.button_align, False, False)
        action_bar_align = gtk.Alignment()
        action_bar_align.set_size_request(-1, STATUS_HEIGHT)
        action_bar_align.set_padding(5, 5, 50, 20)
        action_bar_align.add(self.action_bar)

        self.wallpaper_box.pack_start(self.wallpaper_view_sw, True, True)
        self.wallpaper_box.pack_start(action_bar_align, False, False)

        self.pack_start(self.wallpaper_box, False, False)

        event_manager.add_callback("select-wallpaper", self.on_wallpaper_select)
        event_manager.add_callback("apply-wallpaper", self.__on_wallpaper_apply)
        event_manager.add_callback("add-wallpapers", self.__on_add_wallpapers)
Ejemplo n.º 18
0
    def __init__(
        self,
        title,
        message,
        default_width=330,
        default_height=145,
        confirm_callback=None,
        cancel_callback=None,
        cancel_first=True,
        message_text_size=9,
    ):
        '''
        Initialize ConfirmDialog class.

        @param title: Title for confirm dialog.
        @param message: Confirm message.
        @param default_width: Dialog width, default is 330 pixel.
        @param default_height: Dialog height, default is 145 pixel.
        @param confirm_callback: Callback when user click confirm button.
        @param cancel_callback: Callback when user click cancel button.
        @param cancel_first: Set as True if to make cancel button before confirm button, default is True.
        @param message_text_size: Text size of message, default is 11.
        '''
        # Init.
        DialogBox.__init__(self,
                           title,
                           default_width,
                           default_height,
                           DIALOG_MASK_SINGLE_PAGE,
                           close_callback=self.hide)
        self.confirm_callback = confirm_callback
        self.cancel_callback = cancel_callback

        self.label_align = gtk.Alignment()
        self.label_align.set(0.5, 0.5, 0, 0)
        self.label_align.set_padding(0, 0, 8, 8)
        self.label = Label(message,
                           text_x_align=ALIGN_MIDDLE,
                           text_size=message_text_size)

        self.confirm_button = Button(_("OK"))
        self.cancel_button = Button(_("Cancel"))

        self.confirm_button.connect("clicked",
                                    lambda w: self.click_confirm_button())
        self.cancel_button.connect("clicked",
                                   lambda w: self.click_cancel_button())

        # Connect widgets.
        self.body_box.pack_start(self.label_align, True, True)
        self.label_align.add(self.label)

        if cancel_first:
            self.right_button_box.set_buttons(
                [self.cancel_button, self.confirm_button])
        else:
            self.right_button_box.set_buttons(
                [self.confirm_button, self.cancel_button])
Ejemplo n.º 19
0
 def __init__(self):
     DialogBox.__init__(
         self, _("Lyrics search"), 460, 300, DIALOG_MASK_MULTIPLE_PAGE, close_callback=self.hide_all, 
         modal=False, window_hint=None, skip_taskbar_hint=False, window_pos=gtk.WIN_POS_CENTER)
     
     self.artist_entry = InputEntry()
     self.artist_entry.set_size(130, 23)
     self.title_entry = InputEntry()
     self.title_entry.set_size(130, 23)
     artist_label = Label(_("Artist:"))
     title_label = Label(_("Title:"))
     right_align = gtk.Alignment()
     right_align.set(0, 0, 0, 1)
     
     self.search_button = Button(_("Search"))
     self.search_button.connect("clicked", self.search_lyric_cb)
     self.process_id = 0
     
     info_box = gtk.HBox(spacing=25)
     
     control_box = gtk.HBox(spacing=5)
     title_box = gtk.HBox(spacing=5)        
     title_box.pack_start(title_label, False, False)
     title_box.pack_start(self.title_entry)
     artist_box = gtk.HBox(spacing=5)
     artist_box.pack_start(artist_label, False, False)
     artist_box.pack_start(self.artist_entry)
     control_box.pack_start(title_box, False, False)
     control_box.pack_start(artist_box, False, False)
     
     info_box.pack_start(control_box, False, False)
     info_box.pack_start(self.search_button, False, False)
     
     sort_items = [ lambda items, reverse : self.sort_by_key(items, reverse, "title"),
                    lambda items, reverse : self.sort_by_key(items, reverse, "artist")]
     self.result_view = TreeView()
     self.result_view.set_expand_column(0)
     self.result_view.connect("double-click-item", self.double_click_cb)
     self.result_view.set_column_titles([_("Title"), _("Artist")], sort_items)
     self.result_view.draw_mask = self.draw_view_mask
     
     self.prompt_label = Label("")
     download_button = Button(_("Download"))
     download_button.connect("clicked", self.download_lyric_cb)
     cancel_button = Button(_("Close"))
     cancel_button.connect("clicked", lambda w: self.hide_all())
     
     info_box_align = gtk.Alignment()
     info_box_align.set_padding(5, 0, 5, 0)
     info_box_align.add(info_box)
     
     self.body_box.set_spacing(5)
     self.body_box.pack_start(info_box_align, False, False)
     self.body_box.pack_start(self.result_view, True, True)
     self.left_button_box.set_buttons([self.prompt_label])
     self.right_button_box.set_buttons([download_button, cancel_button])
     self.lrc_manager = LrcManager()
Ejemplo n.º 20
0
    def __init__(self):
        super(PreferenceDialog, self).__init__(_("Preferences"), 575, 495, 
                                               mask_type=DIALOG_MASK_MULTIPLE_PAGE,
                                               close_callback=self.hide_all)
        
        self.set_position(gtk.WIN_POS_CENTER)
        
        self.main_box = gtk.VBox()
        close_button = Button(_("Close"))
        close_button.connect("clicked", lambda w: self.hide_all())
        
        # Init widget.
        self.general_setting = GeneralSetting()
        self.hotkey_setting = HotKeySetting()
        self.desktop_lyrics_setting = DesktopLyricsSetting()
        self.scroll_lyrics_setting = ScrollLyricsSetting()
        self.plugins_manager = PluginsManager()
        
        # Category bar
        self.category_bar = TreeView(enable_drag_drop=False, enable_multiple_select=False)
        self.category_bar.set_expand_column(0)
        self.category_bar.draw_mask = self.draw_treeview_mask
        self.category_bar.set_size_request(132, 516)
        self.category_bar.connect("single-click-item", self.on_categorybar_single_click)

        # Init catagory bar.
        self.__init_category_bar()
        
        category_box = gtk.VBox()
        background_box = BackgroundBox()
        background_box.set_size_request(132, 11)
        background_box.draw_mask = self.draw_treeview_mask
        category_box.pack_start(background_box, False, False)
        
        category_bar_align = gtk.Alignment()
        category_bar_align.set(0, 0, 1, 1,)
        category_bar_align.set_padding(0, 1, 0, 0)
        category_bar_align.add(self.category_bar)
        category_box.pack_start(category_bar_align, True, True)
        
        # Pack widget.
        left_box = gtk.VBox()
        self.right_box = gtk.VBox()
        left_box.add(category_box)
        self.right_box.add(self.general_setting)
        right_align = gtk.Alignment()
        right_align.set_padding(0, 0, 10, 0)
        right_align.add(self.right_box)

        body_box = gtk.HBox()
        body_box.pack_start(left_box, False, False)
        body_box.pack_start(right_align, False, False)
        self.main_box.add(body_box)
        
        # DialogBox code.
        self.body_box.pack_start(self.main_box, True, True)
        self.right_button_box.set_buttons([close_button])        
Ejemplo n.º 21
0
class SongSearchUI(DialogBox):
    
    def __init__(self):
        DialogBox.__init__(self, _("Search"), 460, 300, DIALOG_MASK_SINGLE_PAGE,
                           modal=False, window_hint=None, close_callback=self.hide_all)
        title_label = Label(_("Title:"))
        self.title_entry = TextEntry("")
        self.title_entry.set_size(300, 25)
        self.search_button = Button(_("Search"))
        self.search_button.connect("clicked", self.search_song)
        
        control_box = gtk.HBox(spacing=5)
        control_box.pack_start(title_label, False, False)
        control_box.pack_start(self.title_entry, False, False)
        control_box.pack_start(self.search_button, False, False)
        
        scrolled_window = ScrolledWindow(0, 0)
        scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.result_view = ListView()
        self.result_view.connect("double-click-item", self.double_click_cb)
        self.result_view.draw_mask = self.get_mask_func(self.result_view)
        self.result_view.add_titles([_("Title"), _("Artist"), _("Album"), _("Type"), _("Size")])
        scrolled_window.add_child(self.result_view)
        
        self.prompt_label = Label("")
        download_button = Button(_("Download"))
        download_button.connect("clicked", self.download_song)
        cancel_button = Button(_("Close"))
        cancel_button.connect("clicked", lambda w: self.hide_all())
        
        self.body_box.set_spacing(5)
        self.body_box.pack_start(control_box, False, False)
        self.body_box.pack_start(scrolled_window, True, True)
        self.left_button_box.set_buttons([self.prompt_label])
        self.right_button_box.set_buttons([download_button, cancel_button])
        
    def search_song(self, widget):    
        self.result_view.clear()
        title = self.title_entry.entry.get_text()
        if not title.strip():
            return 
        self.prompt_label.set_text(_("Now searching"))        
        # widget.set_sensitive(False)
        utils.ThreadRun(multi_ways_query_song, self.render_song_infos, [title]).start()
        
    @post_gui    
    def render_song_infos(self, song_infos):
        if song_infos:
            try:
                items = [QueryInfoItem(song_info) for song_info in song_infos]
            except Exception, e:    
                print e
            else:    
                self.result_view.add_items(items)
        self.prompt_label.set_text(_("Finish!"))        
Ejemplo n.º 22
0
 def create_output_box(self):
     output_label = Label("%s:" % _("Output"))
     self.output_entry = InputEntry(os.path.expanduser("~/"))
     self.output_entry.set_size(210, 24)
     change_button = Button(_("Change"))
     change_button.connect("clicked", self.set_output_directory)
     output_box = gtk.HBox(spacing=5)
     output_box.pack_start(output_label, False, False)
     output_box.pack_start(self.output_entry, False, False)
     output_box.pack_start(change_button, False, False)
     return output_box
Ejemplo n.º 23
0
 def create_output_box(self):
     output_label = Label("%s:" % _("Output"))
     self.output_entry = InputEntry(os.path.expanduser("~/"))
     self.output_entry.set_size(210, 24)
     change_button = Button(_("Change"))
     change_button.connect("clicked", self.set_output_directory)
     output_box = gtk.HBox(spacing=5)
     output_box.pack_start(output_label, False, False)
     output_box.pack_start(self.output_entry, False, False)
     output_box.pack_start(change_button, False, False)
     return output_box
Ejemplo n.º 24
0
    def add_button(self, add_button):
        container_remove_all(self.buttons_align.get_children()[0])

        self.__setup_reset_button()
        button = Button(add_button)
        button.set_size_request(self.button_width, WIDGET_HEIGHT)
        button.connect("clicked", self.__add_button_clicked, add_button)
        self.buttons_list = []
        self.buttons_list.append(button)
        self.buttons_list.append(self.reset_button)
        self.buttons_align = self.__setup_buttons_align(self.buttons_list)        
        self.right_box.pack_start(self.buttons_align)
Ejemplo n.º 25
0
    def __init__(self,
                 default_width=350,
                 default_height=160,
                 confirm_callback=None,
                 cancel_callback=None):
        '''
        Initialize InputDialog class.
        
        @param title: Input dialog title.
        @param init_text: Initialize input text.
        @param default_width: Width of dialog, default is 330 pixel.
        @param default_height: Height of dialog, default is 330 pixel.
        @param confirm_callback: Callback when user click confirm button, this callback accept one argument that return by user input text.
        @param cancel_callback: Callback when user click cancel button, this callback not need argument.
        '''
        # Init.
        DialogBox.__init__(self, _("Autostart app"), default_width,
                           default_height, DIALOG_MASK_SINGLE_PAGE)
        self.confirm_callback = confirm_callback
        self.cancel_callback = cancel_callback
        self.on_click = None

        self.confirm_button = Button(_("OK"))
        self.cancel_button = Button(_("Cancel"))

        self.confirm_button.connect("clicked",
                                    lambda w: self.click_confirm_button())
        self.cancel_button.connect("clicked",
                                   lambda w: self.click_cancel_button())
        self.connect(
            "destroy", self._close_callback
        )  #self.close_callback is None at this moment, so we use _close_callback
        # get system pixbuf
        icon_theme = gtk.IconTheme()
        icon_theme.set_custom_theme("Deepin")
        icon_info = None
        if icon_theme:
            icon_info = icon_theme.lookup_icon("folder-open", 16,
                                               gtk.ICON_LOOKUP_NO_SVG)

        self.icon_pixbuf = None
        if icon_info:
            self.icon_pixbuf = DynamicPixbuf(icon_info.get_filename())
        else:
            self.icon_pixbuf = app_theme.get_pixbuf("navigate/none-small.png")

        table = self.add_new_box()
        self.pack(self.body_box, [table])
        self.right_button_box.set_buttons(
            [self.cancel_button, self.confirm_button])

        self.connect("show", self.focus_input)
Ejemplo n.º 26
0
 def __init__(self):
     DialogBox.__init__(
         self, _("Lyrics search"), 460, 300, DIALOG_MASK_MULTIPLE_PAGE, close_callback=self.hide_all, 
         modal=False, window_hint=None, skip_taskbar_hint=False)
     self.artist_entry = InputEntry()
     self.artist_entry.set_size(130, 23)
     self.title_entry = InputEntry()
     self.title_entry.set_size(130, 23)
     artist_label = Label(_("Artist:"))
     title_label = Label(_("Title:"))
     right_align = gtk.Alignment()
     right_align.set(0, 0, 0, 1)
     
     search_button = Button(_("Search"))
     search_button.connect("clicked", self.search_lyric_cb)
     
     info_box = gtk.HBox(spacing=25)
     
     control_box = gtk.HBox(spacing=5)
     title_box = gtk.HBox(spacing=5)        
     title_box.pack_start(title_label, False, False)
     title_box.pack_start(self.title_entry)
     artist_box = gtk.HBox(spacing=5)
     artist_box.pack_start(artist_label, False, False)
     artist_box.pack_start(self.artist_entry)
     control_box.pack_start(title_box, False, False)
     control_box.pack_start(artist_box, False, False)
     
     info_box.pack_start(control_box, False, False)
     info_box.pack_start(search_button, False, False)
     
     scrolled_window = ScrolledWindow(0, 0)
     scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     sort_items = [(lambda item: item.title, cmp), (lambda item: item.artist, cmp)]
     self.result_view = ListView(sort_items)
     self.result_view.connect("double-click-item", self.double_click_cb)
     self.result_view.add_titles([_("Title"), _("Artist")])
     self.result_view.draw_mask = self.get_mask_func(self.result_view)
     scrolled_window.add_child(self.result_view)
     
     self.prompt_label = Label("")
     download_button = Button(_("Download"))
     download_button.connect("clicked", self.download_lyric_cb)
     cancel_button = Button(_("Close"))
     cancel_button.connect("clicked", lambda w: self.hide_all())
     
     info_box_align = gtk.Alignment()
     info_box_align.set_padding(5, 0, 5, 0)
     info_box_align.add(info_box)
     
     self.body_box.set_spacing(5)
     self.body_box.pack_start(info_box_align, False, False)
     self.body_box.pack_start(scrolled_window, True, True)
     self.left_button_box.set_buttons([self.prompt_label])
     self.right_button_box.set_buttons([download_button, cancel_button])
     self.lrc_manager = LrcManager()
Ejemplo n.º 27
0
    def __init__(self, confirm_callback=None):
        DialogBox.__init__(self, 
                           title=_("Close"),
                           default_width=360,
                           default_height=145,
                           mask_type=DIALOG_MASK_SINGLE_PAGE,
                           )
        
        self.confirm_callback = confirm_callback
        radio_group = gtk.HBox(spacing=50)
        self.minimize_radio = RadioButton(_("Minimize to tray"))
        self.minimize_radio.set_active(True)
        self.quit_radio = RadioButton(_("Quit"))
        
        radio_group.pack_start(self.minimize_radio, False, True)
        radio_group.pack_start(self.quit_radio, False, True)
        self.remembar_button = CheckButton(_("Don't prompt again"))
        self.remembar_button.set_active(True)
        
        radio_group_align = gtk.Alignment()
        radio_group_align.set_padding(30, 0, 10, 0)
        radio_group_align.add(radio_group)
                
        confirm_button = Button(_("OK"))
        confirm_button.connect("clicked", self.on_confirm_button_clicked)

        cancel_button = Button(_("Cancel"))
        cancel_button.connect("clicked", self.on_cancel_button_clicked)        
        
        # Connect widgets.
        self.body_box.pack_start(radio_group_align, False, True)
        self.left_button_box.set_buttons([self.remembar_button,])
        self.right_button_box.set_buttons([confirm_button, cancel_button])
Ejemplo n.º 28
0
def resolve_accel_entry_conflict(origin_entry, conflict_entry, tmp_accel_buf):
    dialog = DialogBox(" ", 620, 150)
    dialog.window_frame.connect("expose-event", draw_widget_background)
    dialog.set_keep_above(True)
    dialog.set_modal(True)
    dialog.body_align.set_padding(15, 10, 10, 10)
    label1 = Label(
        _("The shortcut \"%s\" is already used for \"%s\"") %
        (tmp_accel_buf.get_accel_label(), conflict_entry.settings_description),
        enable_select=False,
        enable_double_click=False)
    label2 = Label(_(
        "If you reassign the shortcut to \"%s\", the \"%s\" shortcut will be disabled."
    ) % (origin_entry.settings_description,
         conflict_entry.settings_description),
                   enable_select=False,
                   enable_double_click=False)
    dialog.body_box.pack_start(label1)
    dialog.body_box.pack_start(label2)
    button_reassign = Button(_("Reassign"))
    button_cancel = Button(_("Cancel"))
    button_cancel.connect("clicked",
                          lambda b: origin_entry.reassign_cancel(dialog))
    button_reassign.connect(
        "clicked",
        lambda b: origin_entry.reassign(tmp_accel_buf, conflict_entry, dialog))
    dialog.right_button_box.set_buttons([button_cancel, button_reassign])
    dialog.show_all()
Ejemplo n.º 29
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)
Ejemplo n.º 30
0
 def create_location_box(self):
     location_align = gtk.Alignment()
     location_align.set(1.0, 1.0, 0.5, 0.5)
     location_box = gtk.HBox(spacing=5)
     location_label = Label(_("Location:"))
     self.location_entry = InputEntry("")
     self.location_entry.set_size(250, 25)
     open_button = Button(_("Open directory"))
     open_button.connect("clicked", self.open_song_location)
     location_box.pack_start(location_label, False, True)
     location_box.pack_start(self.location_entry, False, True)
     location_box.pack_start(open_button, False, True)
     location_align.add(location_box)
     return location_align
Ejemplo n.º 31
0
 def create_location_box(self):
     location_align = gtk.Alignment()
     location_align.set(1.0, 1.0, 0.5, 0.5)
     location_box = gtk.HBox(spacing=5)
     location_label = Label("%s" % _("Location"))
     self.location_entry = InputEntry("")
     self.location_entry.set_size(250, 25)
     open_button = Button(_("Open directory"))
     open_button.connect("clicked", self.open_song_location)
     location_box.pack_start(location_label, False, True)
     location_box.pack_start(self.location_entry, False, True)
     location_box.pack_start(open_button, False, True)
     location_align.add(location_box)
     return location_align
Ejemplo n.º 32
0
 def things_after_scanning():
     container_remove_all(self.under_camera_box)
     self.try_again_button = Button(_("Try Again"))
     self.try_again_button.set_size_request(CAMERA_BOX_SIZE, 25)
     self.try_again_button.connect("clicked",
                                   self.__start_record_clicked)
     start_record_button_align = gtk.Alignment(0.5, 0.5, 0, 0)
     start_record_button_align.add(self.try_again_button)
     if success > 0:
         facepp.train.verify(person_name=get_person_name())
         self.under_camera_box.pack_start(self.success)
     else:
         self.under_camera_box.pack_start(self.fail)
     self.under_camera_box.pack_start(start_record_button_align)
Ejemplo n.º 33
0
 def __init__(self):
     Window.__init__(self, enable_resize=True)
     self.set_position(gtk.WIN_POS_CENTER)
     self.set_default_size(290, 512)
     titlebar = Titlebar(["min", "max", "close"], app_name="Baidu Hi for Linux")
     titlebar.min_button.connect("clicked", lambda w: self.min_window())
     titlebar.max_button.connect("clicked", lambda w: self.toggle_max_window())
     titlebar.close_button.connect("clicked", lambda w: gtk.main_quit())
     self.add_move_event(titlebar.drag_box)
     self.add_toggle_event(titlebar.drag_box)
     
     banner_image = gtk.image_new_from_file(get_banner_image())
     banner_box = set_widget_gravity(banner_image, (0,0,0,0), (10, 0, 0, 0))
     user_box, self.user_entry = self.create_combo_entry("帐号:")
     passwd_box, self.passwd_entry = self.create_combo_entry("密码:")
     self.remember_passwd = CheckButton("记住密码")
     self.automatic_login = CheckButton("自动登录")
     self.status_box, self.status_combo_box = self.create_combo_widget("状态:", 
                                                  [(key, None) for key in "在线 忙碌 离开 隐身".split()],
                                                  0)
     
     check_box = gtk.HBox(spacing=10)
     check_box.pack_start(self.remember_passwd, False, False)
     check_box.pack_start(self.automatic_login, False, False)
     
     body_table = gtk.Table(5, 1)
     body_table.set_row_spacings(10)
     body_table.attach(banner_box, 0, 1, 0, 1, xoptions=gtk.FILL, yoptions=gtk.FILL)
     body_table.attach(user_box, 0, 1, 1, 2, xoptions=gtk.FILL, yoptions=gtk.FILL, xpadding=8)
     body_table.attach(passwd_box, 0, 1, 2, 3, xoptions=gtk.FILL, yoptions=gtk.FILL, xpadding=8)
     # body_table.attach(self.status_box, 0, 1, 3, 4, xoptions=gtk.FILL, yoptions=gtk.FILL, xpadding=8)        
     body_table.attach(check_box, 0, 1, 4, 5, xoptions=gtk.FILL, yoptions=gtk.FILL)
     
     body_box_align = set_widget_gravity(set_widget_center(body_table), 
                                         (1, 1, 0.5, 0.5),
                                         (0, 0, 30, 30))
     
     self.login_button = Button("登录")
     self.login_button.set_size_request(95, 30)
     login_button_align = set_widget_gravity(set_widget_center(self.login_button),
                                             (1, 1, 0.5, 0.5),
                                             (30, 30, 0, 0))
     
     main_box = gtk.VBox()        
     main_box.connect("expose-event", self.draw_border_mask)
     main_box.pack_start(body_box_align, False, True)
     main_box.pack_start(login_button_align, False, True)
     
     self.window_frame.pack_start(titlebar, False, True)
     self.window_frame.pack_start(main_box)
def process_unmodifier_key(tmp_accel_buf):
    dialog = DialogBox(" ", 550, 150)
    dialog.window_frame.connect("expose-event", draw_widget_background)
    dialog.set_keep_above(True)
    dialog.set_modal(True)
    dialog.body_align.set_padding(15, 10, 10, 10)
    label1 = Label(_("The shortcut \"%s\" cannot be used because it will become impossible to type using this key.")% tmp_accel_buf.get_accel_label(), enable_select=False, enable_double_click=False)
    label2 = Label(_("Please try with a key such as Control, Alt or Shift at the same time."), enable_select=False, enable_double_click=False)
    dialog.body_box.pack_start(label1)
    dialog.body_box.pack_start(label2)
    button = Button(_("Cancel"))
    button.connect("clicked", lambda b: dialog.destroy())
    dialog.right_button_box.set_buttons([button])
    dialog.show_all()
class BluetoothProgressDialog(DialogBox):
    DIALOG_MASK_SINGLE_PAGE = 0

    def __init__(self, default_width=300, default_height=160, cancel_cb=None):
        DialogBox.__init__(self, "", default_width, default_height, self.DIALOG_MASK_SINGLE_PAGE)

        self.cancel_cb = cancel_cb

        self.message_align = gtk.Alignment()
        self.message_align.set(0, 0, 0, 0)
        self.message_align.set_padding(0, 0, 10, 0)
        self.message_label = Label("", label_width=300)
        self.message_align.add(self.message_label)
        self.progress_align = gtk.Alignment()
        self.progress_align.set(0, 0, 0, 0)
        self.progress_align.set_padding(20, 0, 10, 10)
        self.progress_bar = ProgressBar()
        self.progress_bar.set_size_request(default_width, -1)
        self.progress_align.add(self.progress_bar)
        self.percentage_align = gtk.Alignment()
        self.percentage_align.set(0, 0, 0, 0)
        self.percentage_align.set_padding(10, 0, 140, 0)
        self.percentage_label = Label("0%", label_width=300)
        self.percentage_label.set_size_request(default_width, -1)
        self.percentage_align.add(self.percentage_label)
        self.cancel_align = gtk.Alignment()
        self.cancel_align.set(0, 0, 0, 0)
        self.cancel_align.set_padding(20, 0, 200, 0)
        self.cancel_button = Button(_("Cancel"))
        self.cancel_button.set_size_request(70, WIDGET_HEIGHT)
        self.cancel_button.connect("clicked", self.__on_cancel_button_clicked)
        self.cancel_align.add(self.cancel_button)

        self.body_box.pack_start(self.message_align, False, False)
        self.body_box.pack_start(self.progress_align, False, False)
        self.body_box.pack_start(self.percentage_align, False, False)
        self.body_box.pack_start(self.cancel_align)

    def set_message(self, message):
        self.message_label.set_text(message)

    def set_progress(self, progress):
        self.progress_bar.set_progress(progress)
        self.percentage_label.set_text(_("Sent %d") % progress + "%")

    def __on_cancel_button_clicked(self, widget):
        if self.cancel_cb:
            self.cancel_cb()
            self.destroy()
Ejemplo n.º 36
0
    def __init__(self, monitor_dir):

        gtk.VBox.__init__(self)
        self.set_spacing(10)
        self.select_view = SelectView(monitor_dir,
                                      filter_dir=["deepin-wallpapers"],
                                      add_system=False)
        self.select_view.connect("items-change", self.select_view_item_changed)
        self.select_view.connect("double-click-item",
                                 self.select_view_double_clicked)
        self.select_view_sw = self.select_view.get_scrolled_window()

        label_box = gtk.VBox()
        no_favorites_label = Label(_("Your Favorites folder is empty."))
        align_up = get_align(align=(0.5, 0.5, 0, 0))
        align_up.add(no_favorites_label)
        go_to_local_action = ActionButton(
            _("Add from Local Pictures"),
            lambda: event_manager.emit("switch-to-local-pictures", self))
        align_down = get_align(align=(0.5, 0.5, 0, 0))
        align_down.add(go_to_local_action)

        label_box.pack_start(align_up, False, False)
        label_box.pack_start(align_down, False, False)
        self.no_favorites_align = gtk.Alignment(0.5, 0.5, 0, 0)
        self.no_favorites_align.add(label_box)

        self.notice_label = Label("")

        set_wallpapper_button = Button(_("Set as wallpaper"))
        set_wallpapper_button.connect("clicked", self.__on_set_as_wallpapper)

        delete_button = Button(_("Delete"))
        delete_button.connect("clicked", self.__on_delete)

        self.button_box = gtk.HBox(spacing=10)
        self.button_box.pack_start(set_wallpapper_button, False, False)
        self.button_box.pack_start(delete_button, False, False)

        self.control_box = gtk.HBox()
        self.control_box.set_size_request(-1, 20)
        self.control_box.pack_start(self.notice_label, False, False)

        self.control_align = gtk.Alignment()
        self.control_align.set(0.5, 0.5, 1, 1)
        self.control_align.set_padding(0, 5, 20, 10)
        self.control_align.add(self.control_box)

        if len(self.select_view.items) == 0:
            self.pack_start(self.no_favorites_align, True, True)
        else:
            self.pack_start(self.select_view_sw, True, True)
        self.pack_end(self.control_align, False, True)

        event_manager.add_callback("select-select-wallpaper",
                                   self.__on_select_select_wallpaper)

        self.timeout_notice_hide_id = None
class CachePage(gtk.VBox):
    def __init__(self, network_interface):
        gtk.VBox.__init__(self)

        self.theme = None

        self.set_spacing(10)

        self.cache_view = CacheView(network_interface, download_dir=get_download_wallpaper_dir())
        self.cache_view_sw = self.cache_view.get_scrolled_window()

        self.nolink_image = ImageBox(app_theme.get_pixbuf("individuation/notlink.png"))

        self.back_button = Button(_("Back"))
        self.back_button.connect("clicked", self.__on_back)
        download_button = Button(_("Download All"))
        download_button.connect("clicked", self.on_download_button_clicked)

        control_box = gtk.HBox(spacing=10)
        control_box.pack_start(self.back_button, False, False)

        self.control_align = gtk.Alignment()
        self.control_align.set(1.0, 0.5, 0, 0)
        self.control_align.set_padding(0, 5, 0, 10)
        self.control_align.add(control_box)

        self.pack_start(self.cache_view_sw, True, True)
        self.pack_start(self.control_align, False, True)

        event_manager.add_callback("fetch-failed", self.__fetch_failed)

    def __fetch_failed(self, name, obj, data):
        self.cache_view_sw.set_size_request(0, 0)
        self.nolink_align = gtk.Alignment()
        self.nolink_align.set(0, 0, 0, 0)
        self.nolink_align.set_padding(0, 0, 160, 0)
        self.nolink_align.add(self.nolink_image)
        self.pack_start(self.nolink_align)
        self.control_align.set_child_visible(False)

    def set_theme(self, theme):
        self.theme = theme

    def __on_back(self, widget):
        event_manager.emit("back-to-detailpage", self.theme)

    def on_download_button_clicked(self, widget):
        self.cache_view.emit_download()
Ejemplo n.º 38
0
    def create_mirror_select_table(self):
        main_table = gtk.Table(3, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)

        mirror_select_title = Label(_("Select mirror"))
        self.select_best_mirror_button = Button(self.select_best_mirror_button_texts["normal"])
        self.select_best_mirror_button.connect("clicked", self.select_best_mirror)

        self.mirrors_dir = os.path.join(get_parent_dir(__file__, 2), 'mirrors')
        self.current_mirror_hostname = utils.get_current_mirror_hostname()
        self.mirror_items = self.get_mirror_items()
        self.mirror_view = TreeView(self.mirror_items,
                                enable_drag_drop=False,
                                enable_multiple_select=False,
                                mask_bound_height=0,
                             )
        self.mirror_view.set_expand_column(1)
        self.mirror_view.set_size_request(-1, 280)
        self.mirror_view.draw_mask = self.mirror_treeview_draw_mask

        main_table.attach(mirror_select_title, 0, 1, 0, 1, yoptions=gtk.FILL)
        main_table.attach(self.select_best_mirror_button, 1, 2, 0, 1, xoptions=gtk.FILL)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, xoptions=gtk.FILL)
        main_table.attach(self.mirror_view, 0, 2, 2, 3, xoptions=gtk.FILL)


        return main_table
    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)
Ejemplo n.º 40
0
 def __init__(self,
              default_width=350,
              default_height=160,
              confirm_callback=None, 
              cancel_callback=None):
     '''
     Initialize InputDialog class.
     
     @param title: Input dialog title.
     @param init_text: Initialize input text.
     @param default_width: Width of dialog, default is 330 pixel.
     @param default_height: Height of dialog, default is 330 pixel.
     @param confirm_callback: Callback when user click confirm button, this callback accept one argument that return by user input text.
     @param cancel_callback: Callback when user click cancel button, this callback not need argument.
     '''
     # Init.
     DialogBox.__init__(self, _("Autostart app"), default_width, default_height, DIALOG_MASK_SINGLE_PAGE)
     self.confirm_callback = confirm_callback
     self.cancel_callback = cancel_callback
     self.on_click = None
     
     self.confirm_button = Button(_("OK"))
     self.cancel_button = Button(_("Cancel"))
     
     self.confirm_button.connect("clicked", lambda w: self.click_confirm_button())
     self.cancel_button.connect("clicked", lambda w: self.click_cancel_button())
     self.connect("destroy", self._close_callback) #self.close_callback is None at this moment, so we use _close_callback
     # get system pixbuf
     icon_theme = gtk.IconTheme()
     icon_theme.set_custom_theme("Deepin")
     icon_info = None
     if icon_theme:
         icon_info = icon_theme.lookup_icon("folder-open", 16, gtk.ICON_LOOKUP_NO_SVG)
     
     
     self.icon_pixbuf = None
     if icon_info:
         self.icon_pixbuf = DynamicPixbuf(icon_info.get_filename())
     else:
         self.icon_pixbuf = app_theme.get_pixbuf("navigate/none-small.png")
     
     table = self.add_new_box() 
     self.pack(self.body_box, [table])
     self.right_button_box.set_buttons([self.cancel_button, self.confirm_button])
     
     self.connect("show", self.focus_input)
Ejemplo n.º 41
0
    def __init__(self):

        gtk.VBox.__init__(self)

        self.set_size_request(727, 337)
        self.connect("expose-event", self.expose_outline)

        self.add(Button("sasfsd"))
Ejemplo n.º 42
0
 def __init__(self, 
              title, 
              message, 
              default_width=330,
              default_height=145,
              confirm_callback=None, 
              cancel_callback=None, 
              cancel_first=True, 
              message_text_size=11,
              window_type=gtk.WINDOW_TOPLEVEL,
              close_callback=None,
              text_wrap_width=330,
              text_x_align=ALIGN_START,
              ):
     DialogBox.__init__(
         self, title, default_width, default_height, DIALOG_MASK_SINGLE_PAGE,
         window_type=window_type,
         close_callback=close_callback,
         )
     self.confirm_callback = confirm_callback
     self.cancel_callback = cancel_callback
     
     self.label_align = gtk.Alignment()
     self.label_align.set(0.5, 0.5, 0, 0)
     self.label_align.set_padding(0, 0, 8, 8)
     self.label = Label(
         message, 
         text_x_align=text_x_align, 
         text_size=message_text_size,
         wrap_width=text_wrap_width,
         )
     
     self.confirm_button = Button(_("OK"))
     
     self.confirm_button.connect("clicked", lambda w: self.click_confirm_button())
     
     # Connect widgets.
     self.label_align.add(self.label)
     self.body_box.pack_start(self.label_align, True, True)
     
     self.right_button_box.set_buttons([self.confirm_button,])
         
     self.keymap = {
         "Return" : self.click_confirm_button,
         "Escape" : self.close,
         }    
 def __init__(self, 
              title, 
              message, 
              default_width=330,
              default_height=145,
              confirm_callback=None, 
              cancel_callback=None, 
              cancel_first=True, 
              message_text_size=9,
              ):
     '''
     Initialize ConfirmDialog class.
     
     @param title: Title for confirm dialog.
     @param message: Confirm message.
     @param default_width: Dialog width, default is 330 pixel.
     @param default_height: Dialog height, default is 145 pixel.
     @param confirm_callback: Callback when user click confirm button.
     @param cancel_callback: Callback when user click cancel button.
     @param cancel_first: Set as True if to make cancel button before confirm button, default is True.
     @param message_text_size: Text size of message, default is 11.
     '''
     # Init.
     DialogBox.__init__(self, title, default_width, default_height, DIALOG_MASK_SINGLE_PAGE, close_callback=self.hide)
     self.confirm_callback = confirm_callback
     self.cancel_callback = cancel_callback
     
     self.label_align = gtk.Alignment()
     self.label_align.set(0.5, 0.5, 0, 0)
     self.label_align.set_padding(0, 0, 8, 8)
     self.label = Label(message, text_x_align=ALIGN_MIDDLE, text_size=message_text_size)
     
     self.confirm_button = Button(_("OK"))
     self.cancel_button = Button(_("Cancel"))
     
     self.confirm_button.connect("clicked", lambda w: self.click_confirm_button())
     self.cancel_button.connect("clicked", lambda w: self.click_cancel_button())
     
     # Connect widgets.
     self.body_box.pack_start(self.label_align, True, True)
     self.label_align.add(self.label)
     
     if cancel_first:
         self.right_button_box.set_buttons([self.cancel_button, self.confirm_button])
     else:
         self.right_button_box.set_buttons([self.confirm_button, self.cancel_button])
    def __init_ui(self):
        #self.check_bar = Imag\cceBox(app_theme.get_pixbuf("network/check_box-2.png"))
        self.ssid_label = Label(_("SSID:"))
        self.ssid_entry = InputEntry("Deepin.org")
        self.ssid_entry.entry.set_size_request(200 ,22)

        self.password_label = Label(_("Password:"******"")
        self.password_entry.entry.set_size_request(200 ,22)

        self.active_btn = Button(_("Active"))
        self.jump_bar = ImageButton(app_theme.get_pixbuf("network/jump_to.png"),
                app_theme.get_pixbuf("network/jump_to.png"),
                app_theme.get_pixbuf("network/jump_to.png"))
                                    
        self.check_bar_align = gtk.Alignment(0, 0, 0, 0)
        self.check_bar_align.set_size_request(36, 30)
        self.check_bar_align.connect("expose-event", self.expose_state)
        #check_bar_align = self.__wrap_align(self.check_bar, (0, 0, 10, 10))
        ssid_label_align = self.__wrap_align(self.ssid_label, (0, 0, 0, 10))
        self.ssid_entry_align = self.__wrap_align(self.ssid_entry)
        password_label_align = self.__wrap_align(self.password_label, (0, 0, 20, 10))
        self.password_entry_align = self.__wrap_align(self.password_entry)
        
        self.active_align = gtk.Alignment(1, 0.5, 0, 0)
        self.active_align.set_padding(0, 0, 0, 10)
        self.active_align.add(self.active_btn)

        self.__pack_begin(self, [self.check_bar_align, ssid_label_align, 
                               self.ssid_entry_align, password_label_align,
                               self.password_entry_align
                               ])
        self.ssid_entry_align.set_size_request(200, 30)
        self.password_entry_align.set_size_request(200, 30)
        self.pack_end(self.active_align, False, True)
        self.show_all()

        self.active_btn.connect("clicked", self.active_btn_callback)
        #self.password_entry.expose_input_entry = self.expose_input_entry
        self.check_out_pixbuf = app_theme.get_pixbuf('network/check_box_out.png')
        self.loading_pixbuf = app_theme.get_pixbuf('network/loading.png')
        self.check_pixbuf = app_theme.get_pixbuf('network/check_box-2.png')
        #self.check_bar = ImageBox(app_theme.get_pixbuf("network/"+pixbufs[state]))

        self.position = 1
        self.net_state = 0
Ejemplo n.º 45
0
    def show_result(self, mirror):
        container_remove_all(self.center_align)
        message = Label(
                _('Test is completed, the fastest mirror source is "%s", switch now?') % mirror.name,
                text_size=10,
                wrap_width=self.dialog_width - 100,
                )
        self.center_align.add(message)

        self.confirm_button = Button(_("OK"))
        self.confirm_button.connect("clicked", self.confirm_button_callback, mirror)
        self.cancel_button = Button(_("Cancel"))
        self.cancel_button.connect("clicked", lambda w: self.hide_all())

        self.right_button_box.set_buttons([self.confirm_button, self.cancel_button])

        self.show_all()
    def __init_widget(self):
        self.manual_table = TableAsm()

        self.manual_radio = self.__row_check(_("Manual"), self.manual_table,
                                             None)
        self.http_entry, self.http_spin = self.__row_entry_spin(
            _("Http Proxy"), self.manual_table, "http")
        self.https_entry, self.https_spin = self.__row_entry_spin(
            _("Https Proxy"), self.manual_table, "https")
        self.ftp_entry, self.ftp_spin = self.__row_entry_spin(
            _("FTP Proxy"), self.manual_table, "ftp")
        self.socks_entry, self.socks_spin = self.__row_entry_spin(
            _("Socks Proxy"), self.manual_table, "socks")

        self.auto_table = TableAsm(left_width=STANDARD_LINE,
                                   right_width=self.ENTRY_WIDTH)
        self.auto_radio = self.__row_check(_("Automatic"), self.auto_table,
                                           self.manual_radio)
        self.conf_entry = self.auto_table.row_input_entry(
            _("Configuration url"))

        auto_align = gtk.Alignment(0, 0, 0, 0)
        auto_align.add(self.auto_table)

        table_box = gtk.VBox(spacing=15)
        table_box.pack_start(self.manual_table, False, False)
        table_box.pack_start(auto_align, False, False)

        align = gtk.Alignment(0, 0, 0, 0)
        align.set_padding(35, 0, 0, 0)
        align.add(table_box)
        self.pack_start(align)

        apply_button = Button(_("Apply"))
        apply_button.connect("clicked", self.save_changes)
        foot_box = FootBox()
        align.connect("expose-event", self.expose_line)
        foot_box.set_buttons([apply_button])
        self.pack_end(foot_box, False, False)
        #self.connect("expose-event", self.expose_event)

        self.manual_radio.connect("toggled", self.manual_radio_selected_cb)
        self.auto_radio.connect("toggled", self.auto_radio_selected_cb)
        self.manual_table.table_build()
        self.auto_table.table_build()
Ejemplo n.º 47
0
 def __init__(self):
     DialogBox.__init__(self, _("Search"), 460, 300, DIALOG_MASK_SINGLE_PAGE,
                        modal=False, window_hint=None, close_callback=self.hide_all)
     title_label = Label(_("Title:"))
     self.title_entry = TextEntry("")
     self.title_entry.set_size(300, 25)
     self.search_button = Button(_("Search"))
     self.search_button.connect("clicked", self.search_song)
     
     control_box = gtk.HBox(spacing=5)
     control_box.pack_start(title_label, False, False)
     control_box.pack_start(self.title_entry, False, False)
     control_box.pack_start(self.search_button, False, False)
     
     scrolled_window = ScrolledWindow(0, 0)
     scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     self.result_view = ListView()
     self.result_view.connect("double-click-item", self.double_click_cb)
     self.result_view.draw_mask = self.get_mask_func(self.result_view)
     self.result_view.add_titles([_("Title"), _("Artist"), _("Album"), _("Type"), _("Size")])
     scrolled_window.add_child(self.result_view)
     
     self.prompt_label = Label("")
     download_button = Button(_("Download"))
     download_button.connect("clicked", self.download_song)
     cancel_button = Button(_("Close"))
     cancel_button.connect("clicked", lambda w: self.hide_all())
     
     self.body_box.set_spacing(5)
     self.body_box.pack_start(control_box, False, False)
     self.body_box.pack_start(scrolled_window, True, True)
     self.left_button_box.set_buttons([self.prompt_label])
     self.right_button_box.set_buttons([download_button, cancel_button])
    def __init_widget(self):
        self.manual_table = TableAsm()

        self.manual_radio = self.__row_check(
            _("Manual"), self.manual_table, None)
        self.http_entry, self.http_spin = self.__row_entry_spin(
            _("Http Proxy"), self.manual_table, "http")
        self.https_entry, self.https_spin = self.__row_entry_spin(
            _("Https Proxy"), self.manual_table, "https")
        self.ftp_entry, self.ftp_spin = self.__row_entry_spin(
            _("FTP Proxy"), self.manual_table, "ftp")
        self.socks_entry, self.socks_spin = self.__row_entry_spin(
            _("Socks Proxy"), self.manual_table, "socks")

        self.auto_table = TableAsm(
            left_width=STANDARD_LINE, right_width=self.ENTRY_WIDTH)
        self.auto_radio = self.__row_check(
            _("Automatic"), self.auto_table, self.manual_radio)
        self.conf_entry = self.auto_table.row_input_entry(
            _("Configuration url"))

        auto_align = gtk.Alignment(0, 0, 0, 0)
        auto_align.add(self.auto_table)

        table_box = gtk.VBox(spacing=15)
        table_box.pack_start(self.manual_table, False, False)
        table_box.pack_start(auto_align, False, False)

        align = gtk.Alignment(0, 0, 0, 0)
        align.set_padding(35, 0, 0, 0)
        align.add(table_box)
        self.pack_start(align)

        apply_button = Button(_("Apply"))
        apply_button.connect("clicked", self.save_changes)
        foot_box = FootBox()
        align.connect("expose-event", self.expose_line)
        foot_box.set_buttons([apply_button])
        self.pack_end(foot_box, False, False)
        #self.connect("expose-event", self.expose_event)

        self.manual_radio.connect("toggled", self.manual_radio_selected_cb)
        self.auto_radio.connect("toggled", self.auto_radio_selected_cb)
        self.manual_table.table_build()
        self.auto_table.table_build()
Ejemplo n.º 49
0
    def __init__(self, session_bus):
        dbus.service.Object.__init__(self, session_bus, DSC_UPDATE_MANAGER_PATH)

        self.in_update_list = False
        self.in_upgrade_packages = False
        self.upgrade_pkg_infos = []

        self.application = Application()
        self.application.set_default_size(400, 250)
        self.application.add_titlebar(
                button_mask=['min', 'close'],
                app_name='Software Update Manager',
                )

        self.application.window.set_title("Software Update Manager")
        self.application.set_icon(get_common_image('update.png'))


        # Init page box.
        self.page_box = gtk.VBox()
        
        # Init page align.
        self.page_align = gtk.Alignment()
        self.page_align.set(0.5, 0.5, 1, 1)
        self.page_align.set_padding(0, 0, 2, 2)
        
        self.page_align.add(self.page_box)
        self.application.main_box.pack_start(self.page_align, True, True)
        
        # Init status bar.
        self.statusbar = Statusbar(28)
        status_box = gtk.HBox()

        self.statusbar.status_box.pack_start(status_box, True, True)
        self.application.main_box.pack_start(self.statusbar, False, False)

        self.background = BackgroundBox()
        self.background.draw_mask = self.draw_mask
        self.page_box.pack_start(self.background)

        self.upgrade_button = Button('更新软件')
        self.upgrade_button.set_sensitive(False)

        button_box = gtk.HBox()
        button_box.pack_start(self.upgrade_button, False, False)

        button_box_align = gtk.Alignment(0.5, 0.5, 0, 0)
        button_box_align.set_padding(3, 8, 4, 4)
        button_box_align.add(button_box)

        self.statusbar.status_item_box.pack_start(button_box_align)

        self.update_info_label = Label("初始化...")
        self.update_info_label_align = create_align((0.5, 0.5, 0, 0))
        self.update_info_label_align.add(self.update_info_label)
        
        self.upgrade_button.connect('clicked', self.upgrade_packages)
class Sections(gtk.Alignment):
    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)

    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 __init__(self, monitor_dir):

        gtk.VBox.__init__(self)
        self.set_spacing(10)
        self.select_view = SelectView(monitor_dir, filter_dir=["deepin-wallpapers"], add_system=True)
        self.select_view.connect("items-change", self.select_view_item_changed)
        self.select_view.connect("double-click-item", self.select_view_double_clicked)
        self.select_view_sw = self.select_view.get_scrolled_window()               

        no_favorites_label = Label(_("Your Local Pictures folder is empty"))
        self.no_favorites_align = gtk.Alignment(0.5, 0.5, 0, 0)
        self.no_favorites_align.add(no_favorites_label)

        self.notice_label = Label("")

        set_wallpapper_button = Button(_("Set as wallpaper"))
        set_wallpapper_button.connect("clicked", self.__on_set_as_wallpapper)

        favorite_button = Button(_("Add to Favorites"))
        favorite_button.connect("clicked", self.__on_add_favorites)

        delete_button = Button(_("Delete"))
        delete_button.connect("clicked", self.__on_delete)

        self.button_box = gtk.HBox(spacing=10)
        self.button_box.pack_start(set_wallpapper_button, False, False)
        self.button_box.pack_start(favorite_button, False, False)
        self.button_box.pack_start(delete_button, False, False)
                                                                                   
        self.control_box = gtk.HBox()
        self.control_box.set_size_request(-1, 20)
        self.control_box.pack_start(self.notice_label, False, False)
                                                                                
        self.control_align = gtk.Alignment()                                         
        self.control_align.set(0.5, 0.5, 1, 1)
        self.control_align.set_padding(0, 5, 20, 10)
        self.control_align.add(self.control_box)

        if len(self.select_view.items) == 0:
            self.pack_start(self.no_favorites_align, True, True)
        else:
            self.pack_start(self.select_view_sw, True, True)
        self.pack_start(self.control_align, False, True)
  
        event_manager.add_callback("select-select-wallpaper", self.__on_select_select_wallpaper)

        self.timeout_notice_hide_id = None
Ejemplo n.º 52
0
 def __init__(self):
     DialogBox.__init__(self, _("Open Url"),
             mask_type=DIALOG_MASK_MULTIPLE_PAGE,
             window_pos=gtk.WIN_POS_CENTER
             )
     self.hbox_ali = gtk.Alignment(0, 0, 1, 1)
     self.hbox_ali.set_padding(5, 5, 5, 5)
     self.hbox = gtk.HBox()
     self.hbox_ali.add(self.hbox)
     self.url_text = InputEntry()
     self.ok_btn = Button(_("Ok"))
     self.cancel_btn = Button(_("Cancel"))
     self.url_text.set_size(280, 25)
     self.hbox.pack_start(self.url_text, True, True)
     #self.hbox.pack_start(self.ok_btn, True, True, 5)
     self.right_button_box.set_buttons([self.ok_btn, self.cancel_btn])
     #
     self.body_box.pack_start(self.hbox_ali, True, True)
     #
     self.cancel_btn.connect("clicked", self.__cancel_btn_clicked_event)
Ejemplo n.º 53
0
    def show_result(self, mirror):
        container_remove_all(self.center_align)
        message = Label(
            _('Test is completed, the fastest mirror source is "%s", switch now?'
              ) % mirror.name,
            text_size=10,
            wrap_width=self.dialog_width - 100,
        )
        self.center_align.add(message)

        self.confirm_button = Button(_("OK"))
        self.confirm_button.connect("clicked", self.confirm_button_callback,
                                    mirror)
        self.cancel_button = Button(_("Cancel"))
        self.cancel_button.connect("clicked", self.cancel_button_callback)

        self.right_button_box.set_buttons(
            [self.confirm_button, self.cancel_button])

        self.show_all()
    def init_ui(self):
        self.tip_align = gtk.Alignment(0, 0.5, 0, 1)
        self.tip = Label("", text_x_align=pango.ALIGN_CENTER, label_width=500)
        self.tip_align.set_padding(5, 5, 20, 0)
        self.tip_align.add(self.tip)

        self.btn_delete = Button(_("Delete"))
        self.btn_delete.connect("clicked", self.delete_click)
        self.btn_delete.set_no_show_all(True)
        self.btn_save = Button()
        self.btn_save.connect("clicked", self.button_click)

        button_box = gtk.HBox(spacing=10)
        button_box.pack_start(self.btn_delete)
        button_box.pack_start(self.btn_save)

        self.buttons_align = gtk.Alignment(1, 0.5, 0, 0)
        self.buttons_align.set_padding(0, 0, 0, 10)
        self.buttons_align.add(button_box)
        self.pack(self, [self.tip_align], True, True)
        self.pack_end(self.buttons_align, False, False)