Esempio n. 1
0
def message_on_save(absolute=True):
    dialog = gtk.Dialog(buttons=("Yes", gtk.RESPONSE_OK, "No",
                                 gtk.RESPONSE_REJECT))
    dialog.set_title(_("Choose window"))
    dialog.set_border_width(5)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    label = gtk.Label()
    label.set_markup(
        _("""<big><b>\t\t\t\t\t\t\t\tAttention!\n</b></big>\t\
The relative location of the \
playlist and music files allows you to save a relative
paths to the files in your playlist. This will allow to carry along the playlist with the
files (only together) at any place of the computer or even at another computer.
Also, it will make library compatible with OS Windows. However, in this case you can't
change the relative location of the playlist file  and music files.
\tAbsolute file paths make it impossible to transfer a playlist on other computer
or use it in OS Windows, but it will put the library anywhere in the file system sepa-
rate from the music files (the library will be working).\n
\tDo you want to save the playlist with relative paths?\n"""))
    label.show()
    dialog.vbox.pack_start(label, False, False)
    dialog.vbox.show()
    dialog.show_all()
    response = dialog.run()
    if response == gtk.RESPONSE_OK:
        dialog.destroy()
        return False
    else:
        dialog.destroy()
        return True
Esempio n. 2
0
    def __init__(self):
        gtk.AboutDialog.__init__(self)

        self.set_program_name("Foobnix")
        self.set_version(FOOBNIX_VERSION)
        self.set_copyright("(c) Ivan Ivanenko <*****@*****.**>")
        self.set_comments(_("Simple and Powerful player"))
        self.set_website("http://www.foobnix.com")
        self.set_authors([
            "Dmitry Kozhura (zavlab1) <*****@*****.**>",
            "Pietro Campagnano <fain182@gmailcom>"
        ])

        self.set_translator_credits("""Bernardo Miguel Savone
Sérgio Marques
XsLiDian
KamilSPL
north
Alex Serada
Ivan Ivanenko
Dmitry-Kogura
Fitoschido
zeugma
Schaffino
Oleg «Eleidan» Kulik
Sergey Zigachev
Martino Barbon
Florian Heissenberger
Aldo Mann""")

        self.set_logo(
            gtk.gdk.pixbuf_new_from_file(
                get_foobnix_resourse_path_by_name(
                    ICON_FOOBNIX)))  #@UndefinedVariable
Esempio n. 3
0
def copy_move_files_dialog(files, dest_folder, copy=None):
    if copy == gtk.gdk.ACTION_COPY: action = _("Copy")  #@UndefinedVariable
    else: action = _("Replace")

    dialog = gtk.Dialog(_('%s file(s) / folder(s)') % action)

    ok_button = dialog.add_button(action, gtk.RESPONSE_OK)
    cancel_button = dialog.add_button(gtk.STOCK_CANCEL,
                                      gtk.RESPONSE_CANCEL)  #@UnusedVariable

    ok_button.grab_default()
    label = gtk.Label('\n' +
                      _("Are you really want to %s this item(s) to %s ?") %
                      (action, dest_folder))
    area = ScrolledText()
    area.text.set_editable(False)
    area.text.set_cursor_visible(False)
    area.buffer.set_text("\n".join([os.path.basename(path) for path in files]))
    dialog.vbox.pack_start(area.scroll)
    dialog.set_border_width(5)
    dialog.vbox.pack_start(label)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    dialog.set_default_size(400, 150)
    dialog.show_all()
    if dialog.run() == gtk.RESPONSE_OK:
        dialog.destroy()
        return True
    dialog.destroy()
    return False
Esempio n. 4
0
 def __init__(self, title, file_list, width=None, hight=None):
     gtk.Dialog.__init__(self, title)
     if width and hight:
         self.set_default_size(width, hight)
     
     self.set_icon_from_file (get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
     self.set_resizable(True)
     self.set_border_width(5)
     self.total_size = get_full_size(file_list)
     
     self.label_from = gtk.Label()
     self.label_to = gtk.Label()
     self.pr_label = gtk.Label(_("Total progress"))
     
     self.pr_bar = gtk.ProgressBar()
     self.total_pr_bar = gtk.ProgressBar()
     
     self.add_button(_("Stop"), gtk.RESPONSE_REJECT)
     
     self.vbox.pack_start(self.label_from, False)
     self.vbox.pack_start(self.label_to, False)
     self.vbox.pack_start(self.pr_bar, False)
     self.vbox.pack_start(self.pr_label, False)
     self.vbox.pack_start(self.total_pr_bar, False)
     self.exit = False        
     self.show_all()
Esempio n. 5
0
def delete_files_from_disk(row_refs, paths, get_iter_from_row_reference):            
    title = _('Delete file(s) / folder(s)')
    label = gtk.Label(_('Do you really want to delete item(s) from disk?'))
    dialog = gtk.Dialog(title, buttons=("Delete", gtk.RESPONSE_ACCEPT, "Cancel", gtk.RESPONSE_REJECT))
    dialog.set_default_size(500, 200)
    dialog.set_border_width(5)
    dialog.vbox.pack_start(label)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    buffer = gtk.TextBuffer()
    text = gtk.TextView(buffer)
    text.set_editable(False)
    text.set_cursor_visible(False)
    scrolled_window = gtk.ScrolledWindow()
    scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    scrolled_window.add(text)
    dialog.vbox.pack_start(scrolled_window)
    for path in paths:
        name = os.path.basename(path)
        buffer.insert_at_cursor('\t' + name + '\n')
    
    dialog.show_all()    
    if dialog.run() == gtk.RESPONSE_ACCEPT:
        model = row_refs[0].get_model()
        try:
            for row_ref, path in zip(row_refs, paths):
                if os.path.isfile(path):
                    os.remove(path)
                else:
                    del_dir(path)
                model.remove(get_iter_from_row_reference(row_ref))
        except IOError, e:
            logging.error(e)
        dialog.destroy()
        return True
Esempio n. 6
0
def message_on_save(absolute=True):
    dialog = gtk.Dialog(buttons=("Yes", gtk.RESPONSE_OK, "No", gtk.RESPONSE_REJECT))
    dialog.set_title(_("Choose window"))
    dialog.set_border_width(5)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    label = gtk.Label()
    label.set_markup(_("""<big><b>\t\t\t\t\t\t\t\tAttention!\n</b></big>\t\
The relative location of the \
playlist and music files allows you to save a relative
paths to the files in your playlist. This will allow to carry along the playlist with the
files (only together) at any place of the computer or even at another computer.
Also, it will make library compatible with OS Windows. However, in this case you can't
change the relative location of the playlist file  and music files.
\tAbsolute file paths make it impossible to transfer a playlist on other computer
or use it in OS Windows, but it will put the library anywhere in the file system sepa-
rate from the music files (the library will be working).\n
\tDo you want to save the playlist with relative paths?\n"""))
    label.show()
    dialog.vbox.pack_start(label, False, False)
    dialog.vbox.show()
    dialog.show_all()
    response = dialog.run()
    if response == gtk.RESPONSE_OK: 
        dialog.destroy()
        return False
    else:
        dialog.destroy()
        return True
Esempio n. 7
0
    def __init__(self):
        gtk.AboutDialog.__init__(self)
        
        self.set_program_name("Foobnix")
        self.set_version(FOOBNIX_VERSION)
        self.set_copyright("(c) Ivan Ivanenko <*****@*****.**>")
        self.set_comments(_("Simple and Powerful player"))
        self.set_website("http://www.foobnix.com")
        self.set_authors(["Dmitry Kozhura (zavlab1) <*****@*****.**>", "Pietro Campagnano <fain182@gmailcom>"])
        
        self.set_translator_credits("""Bernardo Miguel Savone
Sérgio Marques
XsLiDian
KamilSPL
north
Alex Serada
Ivan Ivanenko
Dmitry-Kogura
Fitoschido
zeugma
Schaffino
Oleg «Eleidan» Kulik
Sergey Zigachev
Martino Barbon
Florian Heissenberger
Aldo Mann""")
        
        
        self.set_logo(gtk.gdk.pixbuf_new_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))) #@UndefinedVariable
Esempio n. 8
0
    def __init__(self,
                 title,
                 func,
                 args=None,
                 current_folder=None,
                 current_name=None):
        gtk.FileChooserDialog.__init__(self,
                                       title,
                                       action=gtk.FILE_CHOOSER_ACTION_SAVE,
                                       buttons=(gtk.STOCK_SAVE,
                                                gtk.RESPONSE_OK))
        self.set_default_response(gtk.RESPONSE_OK)
        self.set_select_multiple(False)
        self.set_do_overwrite_confirmation(True)
        self.set_icon_from_file(
            get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
        if current_folder:
            self.set_current_folder(current_folder)
        if current_name:
            self.set_current_name(current_name)

        response = self.run()
        if response == gtk.RESPONSE_OK:
            filename = self.get_filename()
            folder = self.get_current_folder()
            if func:
                try:
                    if args: func(filename, folder, args)
                    else: func(filename, folder)
                except IOError, e:
                    logging.error(e)
Esempio n. 9
0
def show_login_password_error_dialog(title, description, login, password):
    dialog = gtk.MessageDialog(
        None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
        gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, title)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    dialog.set_markup(str(title))
    dialog.format_secondary_markup(description)

    login_entry = gtk.Entry()
    login_entry.set_text(login)
    login_entry.show()

    password_entry = gtk.Entry()
    password_entry.set_text(password)
    password_entry.set_visibility(False)
    password_entry.set_invisible_char("*")
    password_entry.show()

    hbox = gtk.VBox()
    hbox.pack_start(login_entry, False, False, 0)
    hbox.pack_start(password_entry, False, False, 0)
    dialog.vbox.pack_start(hbox, True, True, 0)
    dialog.show_all()
    dialog.run()
    login_text = login_entry.get_text()
    password_text = password_entry.get_text()
    dialog.destroy()
    return [login_text, password_text]
Esempio n. 10
0
def show_login_password_error_dialog(title, description, login, password):
        dialog = gtk.MessageDialog(
            None,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_ERROR,
            gtk.BUTTONS_OK,
            title)
        dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
        dialog.set_markup(str(title))
        dialog.format_secondary_markup(description)
        
        login_entry = gtk.Entry()
        login_entry.set_text(login)
        login_entry.show()
        
        password_entry = gtk.Entry()
        password_entry.set_text(password)
        password_entry.set_visibility(False)
        password_entry.set_invisible_char("*")
        password_entry.show()
        
        hbox = gtk.VBox()
        hbox.pack_start(login_entry, False, False, 0)
        hbox.pack_start(password_entry, False, False, 0)
        dialog.vbox.pack_start(hbox, True, True, 0)
        dialog.show_all()
        dialog.run()
        login_text = login_entry.get_text()
        password_text = password_entry.get_text()
        dialog.destroy()
        return [login_text, password_text]    
Esempio n. 11
0
def one_line_dialog(dialog_title, parent=None, entry_text=None, message_text1=None, message_text2=None):
        dialog = gtk.MessageDialog(
            parent,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_INFO,
            gtk.BUTTONS_OK,
            None)
        dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
        dialog.set_title(dialog_title)
        if message_text1:
            dialog.set_markup(message_text1)
        if message_text2:
            dialog.format_secondary_markup(message_text2)     
        
        
        entry = gtk.Entry()
        
        '''set last widget in action area as default widget (button OK)'''
        dialog.set_default_response(gtk.RESPONSE_OK) 
        
        '''activate default widget after Enter pressed in entry'''
        entry.set_activates_default(True)
        
        if entry_text:
            entry.set_text(entry_text)
        dialog.vbox.pack_start(entry, True, True, 0)
        dialog.show_all()
        
        dialog.run()
        text = entry.get_text()
        
        dialog.destroy()    
        return text if text else None
Esempio n. 12
0
def copy_move_files_dialog(files, dest_folder, copy=None):
    if copy == gtk.gdk.ACTION_COPY: action = _("Copy") #@UndefinedVariable
    else: action = _("Replace") 
    
    dialog = gtk.Dialog(_('%s file(s) / folder(s)') % action)
    
    ok_button = dialog.add_button(action, gtk.RESPONSE_OK)
    cancel_button = dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) #@UnusedVariable
    
    ok_button.grab_default()
    label = gtk.Label('\n' + _("Are you really want to %s this item(s) to %s ?") % (action, dest_folder))      
    area = ScrolledText()
    area.text.set_editable(False)
    area.text.set_cursor_visible(False)
    area.buffer.set_text("\n".join([os.path.basename(path) for path in files]))
    dialog.vbox.pack_start(area.scroll)
    dialog.set_border_width(5)
    dialog.vbox.pack_start(label)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    dialog.set_default_size(400, 150)
    dialog.show_all()
    if dialog.run() == gtk.RESPONSE_OK:
        dialog.destroy()
        return True
    dialog.destroy()
    return False
Esempio n. 13
0
 def check_active_dynamic_icon(self, icon_object):
     icon_name = icon_object.entry.get_text()
     try:
         path = get_foobnix_resourse_path_by_name(icon_name)
         self.controls.trayicon.set_image_from_path(path)
     except TypeError:
         pass
Esempio n. 14
0
 def check_active_dynamic_icon(self, icon_object):
     icon_name = icon_object.entry.get_text()
     try:
         path = get_foobnix_resourse_path_by_name(icon_name)
         self.controls.trayicon.set_image_from_path(path)
     except TypeError:
         pass
Esempio n. 15
0
def info_dialog(title, message):
    dialog = gtk.MessageDialog(
        None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
        gtk.MESSAGE_INFO, gtk.BUTTONS_OK, None)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    dialog.set_title(title)
    dialog.set_markup(title)
    dialog.format_secondary_markup(message)
    dialog.show_all()
    dialog.run()
    dialog.destroy()
Esempio n. 16
0
def file_saving_dialog(title, current_folder=None):
    chooser = gtk.FileChooserDialog(title, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_SAVE, gtk.RESPONSE_OK))
    chooser.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    chooser.set_default_response(gtk.RESPONSE_OK)
    chooser.set_select_multiple(False)
    if current_folder:
        chooser.set_current_folder(current_folder)
    response = chooser.run()
    if response == gtk.RESPONSE_OK:
        paths = chooser.get_filenames()
    elif response == gtk.RESPONSE_CANCEL:
        logging.info('Closed, no files selected')
    chooser.destroy()
Esempio n. 17
0
def info_dialog_with_link(title, version, link):
    dialog = gtk.MessageDialog(
        None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
        gtk.MESSAGE_INFO, gtk.BUTTONS_OK, None)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    dialog.set_title(title)
    dialog.set_markup(title)
    dialog.format_secondary_markup("<b>" + version + "</b>")
    link = gtk.LinkButton(link, link)
    link.show()
    dialog.vbox.pack_end(link, True, True, 0)
    dialog.show_all()
    dialog.run()
    dialog.destroy()
Esempio n. 18
0
 def change_backgound(self):
     win = self.main_window
     win.show()
     if FC().background_image:
         img = get_foobnix_resourse_path_by_name(FC().background_image)
         if not img:
             return None
         pixbuf = gtk.gdk.pixbuf_new_from_file(img) #@UndefinedVariable
         pixmap, mask = pixbuf.render_pixmap_and_mask() #@UnusedVariable
         win.set_app_paintable(True)            
         win.window.set_back_pixmap(pixmap, False)        
     else:
         win.set_app_paintable(False)
         win.window.set_back_pixmap(None, False)
Esempio n. 19
0
def info_dialog(title, message):
        dialog = gtk.MessageDialog(
            None,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_INFO,
            gtk.BUTTONS_OK,
            None)
        dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
        dialog.set_title(title)
        dialog.set_markup(title)
        dialog.format_secondary_markup(message)        
        dialog.show_all()
        dialog.run()
        dialog.destroy()      
Esempio n. 20
0
 def change_backgound(self):
     win = self.main_window
     win.show()
     if FC().background_image:
         img = get_foobnix_resourse_path_by_name(FC().background_image)
         if not img:
             return None
         pixbuf = gtk.gdk.pixbuf_new_from_file(img)  #@UndefinedVariable
         pixmap, mask = pixbuf.render_pixmap_and_mask()  #@UnusedVariable
         win.set_app_paintable(True)
         win.window.set_back_pixmap(pixmap, False)
     else:
         win.set_app_paintable(False)
         win.window.set_back_pixmap(None, False)
Esempio n. 21
0
def file_saving_dialog(title, current_folder=None):
    chooser = gtk.FileChooserDialog(title,
                                    action=gtk.FILE_CHOOSER_ACTION_SAVE,
                                    buttons=(gtk.STOCK_SAVE, gtk.RESPONSE_OK))
    chooser.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    chooser.set_default_response(gtk.RESPONSE_OK)
    chooser.set_select_multiple(False)
    if current_folder:
        chooser.set_current_folder(current_folder)
    response = chooser.run()
    if response == gtk.RESPONSE_OK:
        paths = chooser.get_filenames()
    elif response == gtk.RESPONSE_CANCEL:
        logging.info('Closed, no files selected')
    chooser.destroy()
Esempio n. 22
0
def info_dialog_with_link(title, version, link):
        dialog = gtk.MessageDialog(
            None,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_INFO,
            gtk.BUTTONS_OK,
            None)
        dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
        dialog.set_title(title)
        dialog.set_markup(title)
        dialog.format_secondary_markup("<b>" + version + "</b>")
        link = gtk.LinkButton(link, link)
        link.show()
        dialog.vbox.pack_end(link, True, True, 0)
        dialog.show_all()
        dialog.run()
        dialog.destroy()      
Esempio n. 23
0
def show_entry_dialog(title, description):
    dialog = gtk.MessageDialog(
        None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
        gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK, None)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    dialog.set_markup(title)
    entry = gtk.Entry()
    entry.connect("activate", responseToDialog, dialog, gtk.RESPONSE_OK)
    hbox = gtk.HBox()
    hbox.pack_start(gtk.Label("Value:"), False, 5, 5)
    hbox.pack_end(entry)
    dialog.format_secondary_markup(description)
    dialog.vbox.pack_end(hbox, True, True, 0)
    dialog.show_all()
    dialog.run()
    text = entry.get_text()
    dialog.destroy()
    return text
Esempio n. 24
0
 def change_backgound(self):
     win = self.main_window
     if FC().background_image:
         img = get_foobnix_resourse_path_by_name(FC().background_image)
         if not img:
             return None
         pixbuf = gtk.gdk.pixbuf_new_from_file(img)
         pixmap, mask = pixbuf.render_pixmap_and_mask()
         win.set_app_paintable(True)
         #win.realize()
         win.window.set_back_pixmap(pixmap, False)
     else:
         win.set_app_paintable(False)
         win.realize()
         win.window.set_back_pixmap(None, False)
     win.hide()
     #time.sleep(0.5)
     win.show()            
Esempio n. 25
0
def two_line_dialog(dialog_title, parent=None, message_text1=None,
                    message_text2=None, entry_text1="", entry_text2=""):
        dialog = gtk.MessageDialog(
            parent,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_QUESTION,
            gtk.BUTTONS_OK,
            None)
        dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
        dialog.set_title(dialog_title)
        if message_text1:
            dialog.set_markup(message_text1)
        if message_text2:
            dialog.format_secondary_markup(message_text2)
        
        login_entry = gtk.Entry()
        if entry_text1:
            login_entry.set_text(entry_text1)
        login_entry.show()
        
        password_entry = gtk.Entry()
        if entry_text2:
            password_entry.set_text(entry_text2)
        password_entry.show()
        
        hbox = gtk.VBox()
        hbox.pack_start(login_entry, False, False, 0)
        hbox.pack_start(password_entry, False, False, 0)
        dialog.vbox.pack_start(hbox, True, True, 0)
        dialog.show_all()
        
        '''set last widget in action area as default widget (button OK)'''
        dialog.set_default_response(gtk.RESPONSE_OK) 
        
        '''activate default widget after Enter pressed in entry'''
        login_entry.set_activates_default(True)
        password_entry.set_activates_default(True)
        
        dialog.run()
        login_text = login_entry.get_text()
        password_text = password_entry.get_text()
        dialog.destroy()
        return [login_text, password_text] if (login_text and password_text) else [None,None]     
Esempio n. 26
0
def delete_files_from_disk(row_refs, paths, get_iter_from_row_reference):
    for path in paths[:]:
        if os.path.isdir(path):
            for row_ref, _path in zip(row_refs[:], paths[:]):
                if path != _path and _path.startswith(path):
                    paths.remove(_path)
                    row_refs.remove(row_ref)

    title = _('Delete file(s) / folder(s)')
    label = gtk.Label(_('Do you really want to delete item(s) from disk?'))
    dialog = gtk.Dialog(title,
                        buttons=("Delete", gtk.RESPONSE_ACCEPT, "Cancel",
                                 gtk.RESPONSE_REJECT))
    dialog.set_default_size(500, 200)
    dialog.set_border_width(5)
    dialog.vbox.pack_start(label)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    buffer = gtk.TextBuffer()
    text = gtk.TextView(buffer)
    text.set_editable(False)
    text.set_cursor_visible(False)
    scrolled_window = gtk.ScrolledWindow()
    scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    scrolled_window.add(text)
    dialog.vbox.pack_start(scrolled_window)
    for path in paths:
        name = os.path.basename(path)
        buffer.insert_at_cursor('\t' + name + '\n')

    dialog.show_all()
    if dialog.run() == gtk.RESPONSE_ACCEPT:
        model = row_refs[0].get_model()
        try:
            for row_ref, path in zip(row_refs, paths):
                if os.path.isfile(path):
                    os.remove(path)
                else:
                    del_dir(path)
                model.remove(get_iter_from_row_reference(row_ref))
        except IOError, e:
            logging.error(e)
        dialog.destroy()
        return True
Esempio n. 27
0
def info_dialog_with_link_and_donate(version):
    dialog = gtk.MessageDialog(
        None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
        gtk.MESSAGE_INFO, gtk.BUTTONS_OK, None)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    dialog.set_title(_("New foobnix release avaliable"))
    dialog.set_markup(_("New foobnix release avaliable"))
    dialog.format_secondary_markup("<b>" + version + "</b>")

    card = gtk.LinkButton(
        "http://www.foobnix.com/support?lang=%s" % SITE_LOCALE,
        _("Download and Donate"))
    #terminal = gtk.LinkButton("http://www.foobnix.com/donate/eng#terminal", _("Download and Donate by Webmoney or Payment Terminal"))
    link = gtk.LinkButton(
        "http://www.foobnix.com/support?lang=%s" % SITE_LOCALE, _("Download"))

    frame = gtk.Frame("Please donate and download")
    vbox = gtk.VBox(True, 0)
    vbox.pack_start(card, True, True)
    #vbox.pack_start(terminal, True, True)
    vbox.pack_start(link, True, True)
    frame.add(vbox)

    image = ImageBase("foobnix-slogan.jpg")

    dialog.vbox.pack_start(image, True, True)
    dialog.vbox.pack_start(frame, True, True)
    dialog.vbox.pack_start(
        gtk.Label(
            _("We hope you like the player. We will make it even better.")),
        True, True)
    version_check = gtk.CheckButton(
        _("Check for new foobnix release on start"))
    version_check.set_active(FC().check_new_version)
    dialog.vbox.pack_start(version_check, True, True)

    dialog.show_all()
    dialog.run()

    FC().check_new_version = version_check.get_active()
    FC().save()
    dialog.destroy()
Esempio n. 28
0
def show_entry_dialog(title, description):
        dialog = gtk.MessageDialog(
            None,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_QUESTION,
            gtk.BUTTONS_OK,
            None)
        dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
        dialog.set_markup(title)
        entry = gtk.Entry()
        entry.connect("activate", responseToDialog, dialog, gtk.RESPONSE_OK)
        hbox = gtk.HBox()
        hbox.pack_start(gtk.Label("Value:"), False, 5, 5)
        hbox.pack_end(entry)
        dialog.format_secondary_markup(description)
        dialog.vbox.pack_end(hbox, True, True, 0)
        dialog.show_all()
        dialog.run()
        text = entry.get_text()
        dialog.destroy()
        return text
Esempio n. 29
0
 def __init__(self, title, func, args = None, current_folder=None, current_name=None):
     gtk.FileChooserDialog.__init__(self, title, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_SAVE, gtk.RESPONSE_OK))
     self.set_default_response(gtk.RESPONSE_OK)
     self.set_select_multiple(False)
     self.set_do_overwrite_confirmation(True)
     self.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
     if current_folder:
         self.set_current_folder(current_folder)
     if current_name:
         self.set_current_name(current_name)
     
     response = self.run()
     if response == gtk.RESPONSE_OK:
         filename = self.get_filename()
         folder = self.get_current_folder()
         if func:
             try:
                 if args: func(filename, folder, args)
                 else: func(filename, folder)
             except IOError, e:
                     logging.error(e)
Esempio n. 30
0
def rename_file_on_disk(row, index_path, index_text):
    path = row[index_path]
    name = os.path.basename(path)
    entry = gtk.Entry()
    entry.set_width_chars(64)
    hbox = gtk.HBox()
    if os.path.isdir(path):
        entry.set_text(name)
        hbox.pack_start(entry)
        title = _('Rename folder')
    else:
        name_tuple = os.path.splitext(name)
        entry.set_text(name_tuple[0])
        entry_ext = gtk.Entry()
        entry_ext.set_width_chars(7)
        entry_ext.set_text(name_tuple[1][1:])
        hbox.pack_start(entry)
        hbox.pack_start(entry_ext)
        title = _('Rename file')
    dialog = gtk.Dialog(title,
                        buttons=("Rename", gtk.RESPONSE_ACCEPT, "Cancel",
                                 gtk.RESPONSE_REJECT))
    dialog.vbox.pack_start(hbox)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    dialog.show_all()
    if dialog.run() == gtk.RESPONSE_ACCEPT:
        if os.path.isdir(path) or not entry_ext.get_text():
            new_path = os.path.join(os.path.dirname(path), entry.get_text())
        else:
            new_path = os.path.join(
                os.path.dirname(path),
                entry.get_text() + '.' + entry_ext.get_text())
        try:
            os.rename(path, new_path)
            row[index_path] = new_path
            row[index_text] = os.path.basename(new_path)
        except IOError, e:
            logging.error(e)
        dialog.destroy()
        return True
Esempio n. 31
0
def info_dialog_with_link_and_donate(version):
        dialog = gtk.MessageDialog(
            None,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_INFO,
            gtk.BUTTONS_OK,
            None)
        dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
        dialog.set_title(_("New foobnix release avaliable"))
        dialog.set_markup(_("New foobnix release avaliable"))
        dialog.format_secondary_markup("<b>" + version + "</b>")
        
        
        
        card = gtk.LinkButton("http://www.foobnix.com/support?lang=%s"%SITE_LOCALE, _("Download and Donate"))
        #terminal = gtk.LinkButton("http://www.foobnix.com/donate/eng#terminal", _("Download and Donate by Webmoney or Payment Terminal"))
        link = gtk.LinkButton("http://www.foobnix.com/support?lang=%s"%SITE_LOCALE, _("Download"))
        
        frame = gtk.Frame("Please donate and download")
        vbox = gtk.VBox(True, 0)
        vbox.pack_start(card, True, True)
        #vbox.pack_start(terminal, True, True)
        vbox.pack_start(link, True, True)
        frame.add(vbox)
        
        image = ImageBase("foobnix-slogan.jpg")
        
        dialog.vbox.pack_start(image, True, True)
        dialog.vbox.pack_start(frame, True, True)
        dialog.vbox.pack_start(gtk.Label(_("We hope you like the player. We will make it even better.")), True, True)
        version_check = gtk.CheckButton(_("Check for new foobnix release on start"))
        version_check.set_active(FC().check_new_version)
        dialog.vbox.pack_start(version_check, True, True)
        
        dialog.show_all()
        dialog.run()
        
        FC().check_new_version = version_check.get_active()
        FC().save()
        dialog.destroy()           
Esempio n. 32
0
def rename_file_on_disk(row, index_path, index_text):
    path = row[index_path]
    name = os.path.basename(path)
    entry = gtk.Entry()
    entry.set_width_chars(64)
    hbox = gtk.HBox()
    if os.path.isdir(path):
        entry.set_text(name)
        hbox.pack_start(entry)
        title = _('Rename folder')
    else:
        name_tuple = os.path.splitext(name)
        entry.set_text(name_tuple[0])
        entry_ext = gtk.Entry()
        entry_ext.set_width_chars(7)
        entry_ext.set_text(name_tuple[1][1:])
        hbox.pack_start(entry)
        hbox.pack_start(entry_ext)
        title = _('Rename file')
    dialog = gtk.Dialog(title, buttons=("Rename", gtk.RESPONSE_ACCEPT, "Cancel", gtk.RESPONSE_REJECT))
    dialog.vbox.pack_start(hbox)
    dialog.set_icon_from_file(get_foobnix_resourse_path_by_name(ICON_FOOBNIX))
    dialog.show_all()    
    if dialog.run() == gtk.RESPONSE_ACCEPT:
        if os.path.isdir(path) or not entry_ext.get_text():
            new_path = os.path.join(os.path.dirname(path), entry.get_text())
        else:
            new_path = os.path.join(os.path.dirname(path), entry.get_text() + '.' + entry_ext.get_text()) 
        try:
            os.rename(path, new_path)
            row[index_path] = new_path
            row[index_text] = os.path.basename(new_path)
        except IOError, e:
            logging.error(e)
        dialog.destroy()
        return True
Esempio n. 33
0
 def get_fobnix_logo(self):
     return get_foobnix_resourse_path_by_name(ICON_FOOBNIX)
Esempio n. 34
0
    def __init__(self):
        """init About window"""
        BaseParentWindow.__init__(self, _("About Window"))

        self.set_size_request(295, 210)

        """Content Begin"""
        table = gtk.Table(3, 4, False)
        try:
            pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(self.get_fobnix_logo(), 100, 100)  # @UndefinedVariable
            image = gtk.image_new_from_pixbuf(pixbuf)
            # image = gtk.image_new_from_file(self.get_fobnix_logo())
            # image.set_pixel_size(10)
        except TypeError:
            image = gtk.image_new_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_INVALID)
        table.attach(image, 0, 3, 0, 1)
        url_label = gtk.LinkButton("http://www.foobnix.com", "www.foobnix.com")
        url_label.set_relief(gtk.RELIEF_NONE)
        label = gtk.Label()
        label.set_markup("\nFoobnix %s" % FOOBNIX_VERSION)

        label.set_justify(gtk.JUSTIFY_CENTER)
        table.attach(label, 0, 3, 1, 2)

        table.attach(url_label, 0, 3, 2, 3)

        label = gtk.Label("Credits")
        image = gtk.image_new_from_stock(gtk.STOCK_INFO, gtk.ICON_SIZE_MENU)

        button_credits = self.create_button_with_label_and_icon(image, label)
        button_credits.set_border_width(9)
        table.attach(button_credits, 0, 1, 3, 4)

        label = gtk.Label(_("Close"))
        image = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)

        button_close = self.create_button_with_label_and_icon(image, label)
        button_close.connect("clicked", self.hide_window)
        button_close.set_border_width(9)
        table.attach(button_close, 2, 3, 3, 4)

        label = gtk.Label(_("Changelog"))
        image = gtk.image_new_from_stock(gtk.STOCK_DND, gtk.ICON_SIZE_MENU)

        button_changelog = self.create_button_with_label_and_icon(image, label)
        button_changelog.set_border_width(9)
        table.attach(button_changelog, 1, 2, 3, 4)

        creaditsWindow = WindowWithBuffer(_("Credential"))

        text = """\t\t\tDevelopers:
    Ivan Ivanenko <*****@*****.**>
    Dmitry Kozhura (zavlab1) <*****@*****.**>"""

        creaditsWindow.set_text(text)

        changeLog = WindowWithBuffer("Change LOG")

        try:
            changelog_text = open(get_foobnix_resourse_path_by_name("CHANGELOG"), "r").read()
            changeLog.set_text(changelog_text)
        except TypeError, error_message:
            logging.error(str(error_message))
Esempio n. 35
0
import thread
import gobject
import logging

from subprocess import Popen, PIPE
from foobnix.fc.fc_helper import CONFIG_DIR
from foobnix.util.const import ICON_FOOBNIX
from foobnix.util.file_utils import open_in_filemanager
from foobnix.util.localization import foobnix_localization
from foobnix.helpers.textarea import ScrolledText
from foobnix.helpers.window import ChildTopWindow
from foobnix.regui.service.path_service import get_foobnix_resourse_path_by_name

foobnix_localization()

LOGO = get_foobnix_resourse_path_by_name(ICON_FOOBNIX)
FFMPEG_NAME = "ffmpeg_foobnix"
#fix win
if os.name == 'posix':
    if os.uname()[4] == 'x86_64':
        FFMPEG_NAME += "_x64"
    
class Converter(ChildTopWindow):
    def __init__(self):
        ChildTopWindow.__init__(self, title="Audio Converter", width=500, height=300)
        
        self.area = ScrolledText()
        vbox = gtk.VBox(False, 10)
        vbox.pack_start(self.area.scroll)
        vbox.show()
        format_label = gtk.Label(_('Format'))
Esempio n. 36
0
import thread
import gobject
import logging

from subprocess import Popen, PIPE
from foobnix.fc.fc_helper import CONFIG_DIR
from foobnix.util.const import ICON_FOOBNIX
from foobnix.util.file_utils import open_in_filemanager
from foobnix.util.localization import foobnix_localization
from foobnix.helpers.textarea import ScrolledText
from foobnix.helpers.window import ChildTopWindow
from foobnix.regui.service.path_service import get_foobnix_resourse_path_by_name

foobnix_localization()

LOGO = get_foobnix_resourse_path_by_name(ICON_FOOBNIX)
FFMPEG_NAME = "ffmpeg_foobnix"
#fix win
if os.name == 'posix':
    if os.uname()[4] == 'x86_64':
        FFMPEG_NAME += "_x64"


class Converter(ChildTopWindow):
    def __init__(self):
        ChildTopWindow.__init__(self,
                                title="Audio Converter",
                                width=500,
                                height=300)

        self.area = ScrolledText()
Esempio n. 37
0
def create_pixbuf_from_resource(name, size=None):
    path = get_foobnix_resourse_path_by_name(name);
    return create_pixbuf_from_path(path, size)
Esempio n. 38
0
 def get_fobnix_logo(self):
     return get_foobnix_resourse_path_by_name(ICON_FOOBNIX)