Beispiel #1
0
    def __init__(self, parent):
        super(NewDownloadDialog, self).__init__("新建下载", parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
        self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)

        self.add_button("下载", gtk.RESPONSE_OK)
        self.add_button("取消", gtk.RESPONSE_CANCEL)

        self.set_size_request(400, 120)

        vbox = self.get_content_area()

        table = gtk.Table(3, 3)

        address_label = gtk.Label("下载地址:")
        address_label.set_width_chars(10)
        self.address_entry = gtk.Entry()
        table.attach(address_label, 0, 1, 0, 1, xoptions=gtk.SHRINK)
        table.attach(self.address_entry, 1, 3, 0, 1)

        folder_label = gtk.Label("下载到:")
        folder_label.set_width_chars(10)
        self.folder_entry = gtk.Entry()
        self.folder_entry.set_text(utils.get_default_save_dir())
        self.choose_folder_button = gtk.Button("浏览")
        self.choose_folder_button.connect("clicked", self.display_folder_chooser_dialog)
        table.attach(folder_label, 0, 1, 1, 2, xoptions=gtk.SHRINK)
        table.attach(self.folder_entry, 1, 2, 1, 2)
        table.attach(self.choose_folder_button, 2, 3, 1, 2, yoptions=gtk.SHRINK)
        
        vbox.pack_start(table)
        self.show_all()
Beispiel #2
0
 def addUri_test(self, widget):
     args = ["addUri", 
         {'uris': ['http://127.0.0.1/f/bubu_1.mp4'],
         'options': {"dir":utils.get_default_save_dir()},
         }]
     u = UpdateStatus(args, self.task_data, self.task_list_store)
     u.start()
Beispiel #3
0
 def display_folder_chooser_dialog (self, widget):
     dialog = gtk.FileChooserDialog(
             "选择目录", 
             self, 
             gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, 
             (gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
         )
     dialog.set_current_folder(utils.get_default_save_dir())
     dialog.set_position(gtk.WIN_POS_CENTER)
     response = dialog.run()
     if response == gtk.RESPONSE_OK:
         self.folder_entry.set_text(dialog.get_filename())
     dialog.destroy()