Ejemplo n.º 1
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)
    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.º 3
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.º 4
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])
    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.º 6
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
Ejemplo n.º 7
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.º 8
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.º 9
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.º 10
0
    def __init__(self, songs, init_index=0):
        super(SongEditor, self).__init__(_("Properties"),
                                         500,
                                         400,
                                         mask_type=DIALOG_MASK_TAB_PAGE)
        self.set_position(gtk.WIN_POS_CENTER)

        close_button = Button(_("Close"))
        close_button.connect("clicked", self.click_close_button)

        previous_button = Button(_("Previous"))
        previous_button.connect("clicked",
                                lambda w: self.update_previous_song())
        next_button = Button(_("Next"))
        next_button.connect("clicked", lambda w: self.update_next_song())

        self.record_label = Label("0/0")

        action_box = gtk.HBox(spacing=5)
        action_box.pack_start(previous_button, False, False)
        action_box.pack_start(self.record_label, False, False)
        action_box.pack_start(next_button, False, False)

        MediaDB.connect("simple-changed", self.db_simple_changed)

        # action_box.
        if len(songs) <= 1:
            action_box.set_no_show_all(True)
        else:
            self.record_label.set_text("%d/%d" % (init_index + 1, len(songs)))

        # tabs
        self.song_info = SongInfo(songs[init_index])
        self.info_setting = InfoSetting(songs[init_index])
        self.cover_setting = CoverSetting(songs[init_index])

        self.tab_box = TabBox()
        self.tab_box.add_items([(_("Track Infomation"), self.song_info),
                                (_("Tag Settings"), self.info_setting),
                                (_("Cover Settings"), self.cover_setting)])

        # DialogBox code, simple, ah? :)
        self.left_button_box.set_buttons([action_box])
        self.right_button_box.set_buttons([close_button])
        self.body_box.pack_start(self.tab_box, True, True)

        # Constants.
        self.current_index = init_index
        self.songs = songs
Ejemplo n.º 11
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)
Ejemplo n.º 12
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
Ejemplo n.º 13
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, 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.º 15
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, 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 __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.º 18
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.º 19
0
 def __init__(self, songs=None):
     DialogBox.__init__(self, _("Convert"), 385, 200, DIALOG_MASK_SINGLE_PAGE,
                        modal=True)
     
     self.songs = songs or [Player.song]
     default_format = "MP3 (CBR)"
     default_index = FORMATS.keys().index(default_format)
     format_box, self.format_combo_box = self.create_combo_widget(_("Format"),
                                                             [(key, None) for key in FORMATS.keys()],
                                                             default_index)
     quality_box, self.quality_combo_box = self.create_combo_widget(_("Quality"),
                                                                    self.get_quality_items(default_format),
                                                                    self.get_quality_index(default_format),
                                                                    65)
     format_quality_box = gtk.HBox(spacing=68)
     format_quality_box.pack_start(format_box, False, False)
     format_quality_box.pack_start(quality_box, False, False)
     
     exists_box, self.exists_combo_box = self.create_combo_widget(_("Target file already exists"),
                                                             [(_("Ask"), True), (_("Cover"), False)],
                                                             0)
     
     start_button = Button(_("Start"))
     close_button = Button(_("Close"))
     self.add_check_button = CheckButton(_("Add to Playlist when finished"), padding_x=2)
     
     main_table = gtk.Table()
     main_table.set_row_spacings(10)
     main_table.attach(format_quality_box, 0, 2, 0, 1, yoptions=gtk.FILL)
     main_table.attach(set_widget_left(exists_box), 0, 2, 1, 2, yoptions=gtk.FILL)
     main_table.attach(self.create_output_box(), 0, 2, 2, 3, yoptions=gtk.FILL)
     main_table.attach(set_widget_left(self.add_check_button), 0, 2, 3, 4, yoptions=gtk.FILL)
     
     main_align = gtk.Alignment()
     main_align.set_padding(10, 10, 15, 10)
     main_align.add(main_table)
     
     # Connect signals.
     self.format_combo_box.connect("item-selected", self.reset_quality_items)
     start_button.connect("clicked", self.add_and_close)
     close_button.connect("clicked", lambda w: self.destroy())
     
     self.body_box.pack_start(main_align, False, True)
     self.right_button_box.set_buttons([start_button, close_button])
    def __init__(self):
        gtk.VBox.__init__(self)
        self.open_dialog = False
        self.tmp_editing_session = None

        # UI style
        style.draw_background_color(self)
        self.tree = TreeView(
            [],
            enable_drag_drop=False,
            enable_hover=True,
            enable_multiple_select=False,
        )
        self.tree.set_expand_column(3)
        self.tree.set_column_titles(
            (_("Active"), _("Application"), _("Description"), _("Exec")), )

        self.tree.set_size_request(800, -1)
        self.tree.connect("right-press-items", self.right_press_item)

        self.tree.draw_mask = self.draw_mask
        self.tree.add_items(self.get_list())
        align = gtk.Alignment(0, 0, 0, 1)
        align.set_padding(15, 0, 20, 20)
        align.add(self.tree)
        align.connect("expose-event", self.expose_line)

        add_button = Button(_("New"))
        self.delete_button = Button(_("Delete"))
        add_button.connect("clicked", self.add_autostart)
        self.delete_button.connect("clicked", self.delete_autostart)
        self.delete_button.set_sensitive(False)

        foot_box = FootBox(adjustment=15)
        foot_box.set_buttons([add_button, self.delete_button])
        self.pack_start(align, True, True)

        self.pack_end(foot_box, False, False)
        #self.pack_end(self.new_box, False, False)

        self.show_all()

        self._init_monitor()
Ejemplo n.º 21
0
 def __init__(self, song=None):
     super(CoverSetting, self).__init__()
     
     cover_box = gtk.VBox()
     cover_image_align =  gtk.Alignment()
     cover_image_align.set(0.5, 0.5, 0.5, 0.5)
     self.cover_image = gtk.Image()
     self.cover_image.set_size_request(300, 180)
     
     
     cover_image_align.add(self.cover_image)
     cover_box.add(cover_image_align)
     cover_box.set_size_request(400, 220)
     
     cover_box_align = gtk.Alignment()
     cover_box_align.set_padding(20, 20, 10, 10)
     cover_box_align.set(0.5, 0.5, 0.5, 0.5)
     cover_box_align.add(cover_box)
     
     button_box = gtk.HBox(spacing=10)
     button_box_align = gtk.Alignment()
     button_box_align.set_padding(0, 0, 0, 30)
     button_box_align.set(0, 0, 1.0, 1.0)
     button_box_align.add(button_box)
     change_button = Button(_("Change"))
     change_button.connect("clicked", self.change_cover_image)
     
     fetch_button = Button(_("Retrieve from the Internet"))
     fetch_button.connect("clicked", self.fetch_cover_image)
     
     delete_button = Button(_("Reset"))
     delete_button.connect("clicked", self.delete_cover_image)
     button_box.pack_start(create_right_align(), True, True)
     button_box.pack_start(change_button, False, False)
     button_box.pack_start(delete_button, False, False)
     button_box.pack_start(fetch_button, False, False)        
     
     self.pack_start(cover_box_align, False, True)
     self.pack_start(button_box_align, False, True)
     
     if song:
         self.update_song(song)
Ejemplo n.º 22
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.º 23
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()
Ejemplo n.º 24
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
    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)
    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)
Ejemplo n.º 27
0
 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())
Ejemplo n.º 28
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.º 29
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.º 30
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)