Пример #1
0
    def __init__(self):
        Gtk.CellRenderer.__init__(self)
        # self.__gobject_init__()

        self.set_property('mode', Gtk.CellRendererMode.ACTIVATABLE)

        self.statuses = {
            DownloadStatus.RUNNING:
            GdkPixbuf.Pixbuf.new_from_file(
                path.getdatapath('media', 'download_start.png')),
            DownloadStatus.STOPPED:
            GdkPixbuf.Pixbuf.new_from_file(
                path.getdatapath('media', 'download_stop.png')),
            DownloadStatus.ERROR:
            GdkPixbuf.Pixbuf.new_from_file(
                path.getdatapath('media', 'error.png')),
            DownloadStatus.FINISHED:
            GdkPixbuf.Pixbuf.new_from_file(
                path.getdatapath('media', 'finished.png')),
            DownloadStatus.SEEDING:
            GdkPixbuf.Pixbuf.new_from_file(
                path.getdatapath('media', 'finished.png'))
        }

        self.types = {
            DownloadTypes.TORRENT: 'Torrent-Download',
            DownloadTypes.BASIC: 'Normaler Download',
            DownloadTypes.OTR_DECODE: 'OTR-Download mit Dekodieren',
            DownloadTypes.OTR_CUT: 'OTR-Download mit Schneiden'
        }

        self.cellrenderer_pixbuf = Gtk.CellRendererPixbuf()
        self.cellrenderer_filename = Gtk.CellRendererText()
        self.cellrenderer_info = Gtk.CellRendererText()
        self.cellrenderer_progress = Gtk.CellRendererProgress()
Пример #2
0
def NewMainWindow(app, gui):
    glade_filename = path.getdatapath('ui', 'MainWindow.glade')
    version = open(path.getdatapath("VERSION"), 'r').read().strip()
    logging.info("Version: " + version)


    builder = gtk.Builder()   
    builder.add_from_file(glade_filename)
    window = builder.get_object("main_window")
    window.app = app
    window.gui = gui
    return window      
Пример #3
0
def NewMainWindow(app, gui):
    glade_filename = path.getdatapath('ui', 'MainWindow.glade')
    version = open(path.getdatapath("VERSION"), 'r').read().strip()
    logging.info("Version: " + version)

    builder = Gtk.Builder()
    builder.add_from_file(glade_filename)
    window = builder.get_object("main_window")

    window.app = app
    window.gui = gui
    return window
Пример #4
0
def NewDownloadPropertiesDialog():
    glade_filename = path.getdatapath('ui', 'DownloadPropertiesDialog.glade')

    builder = Gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("download_properties_dialog")
    return dialog
Пример #5
0
    def _on_menuHelpAbout_activate(self, widget, data=None):
        def open_website(dialog, url, data=None):
            webbrowser.open(url)

        # Gtk.about_dialog_set_url_hook(open_website)
        about_dialog = Gtk.AboutDialog()
        about_dialog.set_transient_for(self.gui.main_window)
        about_dialog.set_destroy_with_parent(True)
        about_dialog.set_name(self.app.app_name)
        about_dialog.set_logo(
            GdkPixbuf.Pixbuf.new_from_file(path.get_image_path('icon.png')))

        version = open(path.getdatapath("VERSION"), 'r').read().strip()
        about_dialog.set_version(version)
        about_dialog.set_website("http://elbersb.de/otrverwaltung")
        about_dialog.set_comments(
            "Zum Verwalten von Dateien von onlinetvrecorder.com.")
        about_dialog.set_copyright(
            "Copyright \xc2\xa9 2010 Benjamin Elbers and others")
        about_dialog.set_authors([
            "Benjamin Elbers", "JanS", "monarc99", "EinApfelbaum", "Timo08",
            "gCurse"
        ])
        about_dialog.run()
        about_dialog.destroy()
def NewDownloadPropertiesDialog():
    glade_filename = path.getdatapath('ui', 'DownloadPropertiesDialog.glade')

    builder = gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("download_properties_dialog")
    return dialog
Пример #7
0
def NewCutinterfaceDialog():
    glade_filename = path.getdatapath('ui', 'CutinterfaceDialog.glade')
    
    builder = gtk.Builder()   
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("cutinterface_dialog")
    return dialog
Пример #8
0
    def _on_menuHelpAbout_activate(self, widget, data=None):

        version = open(path.getdatapath("VERSION"), 'r').read().strip()
        # TODO: script_root_dir won't work when program is installed?
        script_root_dir = os.path.abspath(
            os.path.realpath(sys.argv[0]) + '/../..')
        with open(os.path.join(script_root_dir, 'AUTHORS'), 'r') as f:
            authors = f.readlines()
        authors = [x.strip() for x in authors]

        with open(os.path.join(script_root_dir, 'LICENSE'), 'r') as f:
            license = f.read()

        about_dialog = Gtk.AboutDialog(
            parent=self.gui.main_window,
            program_name=self.app.app_name,
            version=version,
            copyright='\xa9 2010 - ' + str(datetime.datetime.now().year) +
            ' B. Elbers and others',
            license=license,
            website='https://github.com/EinApfelBaum/otr-verwaltung3p/wiki',
            comments='Zum Verwalten von Dateien von onlinetvrecorder.com',
            authors=authors,
            logo=GdkPixbuf.Pixbuf.new_from_file(
                path.get_image_path('icon.png')))
        # ~ title='About {}'.format(self.app.app_name))

        about_dialog.set_destroy_with_parent(True)
        about_dialog.set_size_request(500, 300)
        about_dialog.run()
        about_dialog.destroy()
Пример #9
0
def NewCutinterfaceDialog():
    glade_filename = path.getdatapath('ui', 'CutinterfaceDialog.glade')

    builder = gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("cutinterface_dialog")
    return dialog
Пример #10
0
def NewArchiveDialog():
    glade_filename = path.getdatapath('ui', 'ArchiveDialog.glade')
    
    builder = gtk.Builder()   
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("archive_dialog")
        
    return dialog
Пример #11
0
def NewRenameDialog():
    glade_filename = path.getdatapath('ui', 'RenameDialog.glade')

    builder = Gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("rename_dialog")

    return dialog
Пример #12
0
def NewArchiveDialog():
    glade_filename = path.getdatapath('ui', 'ArchiveDialog.glade')

    builder = gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("archive_dialog")

    return dialog
Пример #13
0
def NewEmailPasswordDialog():
    glade_filename = path.getdatapath('ui', 'EmailPasswordDialog.glade')

    builder = gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("email_password_dialog")

    return dialog
Пример #14
0
    def _on_menu_check_update_activate(self, widget, data=None):
        current_version = open(path.getdatapath("VERSION"), 'r').read().strip()

        try:
            svn_version = urlopen(
                self.svn_version_url).read().strip().decode('utf-8')
        except IOError:
            self.gui.message_error_box(
                "Konnte keine Verbindung mit dem Internet herstellen!")
            return

        if current_version in svn_version:
            self.gui.message_info_box("Ihre Version ist:\n%s\n\nAktuelle Version ist:\n%s" % \
                                                                    (current_version, svn_version))
        else:
            if self.gui.question_box(
                    "Ihre Version ist:\n%s\n\nAktuelle Version ist:\n%s\n\n\
                                        Automatisch updaten?\n" %
                (current_version, svn_version)):
                # TODO: script_root_dir won't work when program is installed?
                #get new version from git
                script_root_dir = os.path.abspath(
                    os.path.realpath(sys.argv[0]) + '/../..')
                file = open(script_root_dir + "/.git/config", "r")
                filelist = file.read()
                # check if program is in right repo
                if 'url = https://github.com/EinApfelBaum/otr-verwaltung3p.git' in filelist:
                    g = git.cmd.Git(script_root_dir + '/')
                    self.log.debug(g.checkout('master'))
                    git_pull_output = g.pull()
                    self.log.debug(git_pull_output)
                    if "Already up-to-date" in git_pull_output:
                        self.gui.message_error_box(
                            "Es konnten keine Updates gefunden werden.\n\
                                    Bitte starte das Programm neu, damit ein bereits eingespieltes \
                                    Update angewendet werden kann!\n")
                    else:
                        if self.gui.question_box(
                                "Die Version wurde auf %s geupdated.\n\nBestätige \
                                    mit 'Ja', damit das Programm neu gestartet wird und das Update \
                                    direkt angewendet werden kann!\n" %
                            (open(path.getdatapath("VERSION"),
                                  'r').read().strip())):
                            os.execv(sys.executable, ['python'] + sys.argv)
                            sys.exit()
Пример #15
0
def NewPlanningDialog(gui):
    glade_filename = path.getdatapath('ui', 'PlanningDialog.glade')

    builder = gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("planning_dialog")
    dialog.gui = gui

    return dialog
Пример #16
0
def NewPlanningDialog(gui):
    glade_filename = path.getdatapath('ui', 'PlanningDialog.glade')
    
    builder = gtk.Builder()   
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("planning_dialog")
    dialog.gui = gui
        
    return dialog
Пример #17
0
def NewMainWindow(app, gui):
    glade_filename = path.getdatapath('ui', 'MainWindow.glade')

    builder = gtk.Builder()   
    builder.add_from_file(glade_filename)
    window = builder.get_object("main_window")
    window.app = app
    window.gui = gui
    return window      
def NewPreferencesWindow(app, gui):
    glade_filename = path.getdatapath('ui', 'PreferencesWindow.glade')

    builder = gtk.Builder()   
    builder.add_from_file(glade_filename)
    window = builder.get_object("preferences_window")
    window.app = app
    window.gui = gui
    return window
Пример #19
0
def NewPreferencesWindow(app, gui):
    glade_filename = path.getdatapath('ui', 'PreferencesWindow.glade')

    builder = gtk.Builder()
    builder.add_from_file(glade_filename)
    window = builder.get_object("preferences_window")
    window.app = app
    window.gui = gui
    return window
Пример #20
0
 def _on_menu_check_update_activate(self, widget, data=None):
     current_version = open(path.getdatapath("VERSION"), 'r').read().strip()
         
     try:
        svn_version = urllib.urlopen('http://github.com/elbersb/otr-verwaltung/raw/master/data/VERSION').read().strip()
     except IOError:
         self.gui.message_error_box("Konnte keine Verbindung mit dem Internet herstellen!")
         return
     
     self.gui.message_info_box("Ihre Version ist:\n%s\n\nAktuelle Version ist:\n%s" % (current_version, svn_version))            
Пример #21
0
def NewLoadCutDialog(app, gui):
    glade_filename = path.getdatapath('ui', 'LoadCutDialog.glade')

    builder = gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("load_cut_dialog")
    dialog.app = app
    dialog.gui = gui

    return dialog
Пример #22
0
def NewConclusionDialog(app, gui):
    glade_filename = path.getdatapath('ui', 'ConclusionDialog.glade')

    builder = Gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("conclusion_dialog")
    dialog.app = app
    dialog.gui = gui

    return dialog
Пример #23
0
def NewLoadCutDialog(app, gui):
    glade_filename = path.getdatapath('ui', 'LoadCutDialog.glade')
    
    builder = gtk.Builder()   
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("load_cut_dialog")
    dialog.app = app
    dialog.gui = gui
        
    return dialog
Пример #24
0
 def _on_menu_check_update_activate(self, widget, data=None):
     current_version = open(path.getdatapath("VERSION"), 'r').read().strip()
         
     try:
        svn_version = urllib.urlopen('http://github.com/monarc99/otr-verwaltung/raw/master/data/VERSION').read().strip()
     except IOError:
         self.gui.message_error_box("Konnte keine Verbindung mit dem Internet herstellen!")
         return
     
     self.gui.message_info_box("Ihre Version ist:\n%s\n\nAktuelle Version ist:\n%s" % (current_version, svn_version))            
Пример #25
0
def NewAddDownloadDialog(gui, config, via_link, link=None):
    glade_filename = path.getdatapath('ui', 'AddDownloadDialog.glade')

    builder = gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("add_download_dialog")
    dialog.gui = gui
    dialog.config = config
    if via_link:
        dialog.forward(link=link)
    return dialog
Пример #26
0
def NewAddDownloadDialog(gui, config, via_link, link=None):
    glade_filename = path.getdatapath("ui", "AddDownloadDialog.glade")

    builder = gtk.Builder()
    builder.add_from_file(glade_filename)
    dialog = builder.get_object("add_download_dialog")
    dialog.gui = gui
    dialog.config = config
    if via_link:
        dialog.forward(link=link)
    return dialog
Пример #27
0
 def post_init(self):       
     self.__setup_toolbar()
     self.__setup_treeview_planning()
     self.__setup_treeview_download()
     self.__setup_treeview_files()
     self.__setup_widgets()
     # set title
     current_version = open(path.getdatapath("VERSION"), 'r').read().strip()
         
     try:
        svn_version = urllib.urlopen('http://github.com/monarc99/otr-verwaltung/raw/master/data/VERSION').read().strip()
     except IOError:
         self.set_title('OTR-Verwaltung++' + ' ' + current_version)
     else:
         self.set_title('OTR-Verwaltung++' + ' ' + current_version + '  -  aktuelle Version: ' + svn_version)
Пример #28
0
 def post_init(self):       
     self.__setup_toolbar()
     self.__setup_treeview_planning()
     self.__setup_treeview_download()
     self.__setup_treeview_files()
     self.__setup_widgets()
     # set title
     current_version = open(path.getdatapath("VERSION"), 'r').read().strip()
         
     try:
        svn_version = urllib.urlopen('http://github.com/monarc99/otr-verwaltung/raw/master/data/VERSION').read().strip()
     except IOError:
         self.set_title('OTR-Verwaltung++' + ' ' + current_version)
     else:
         self.set_title('OTR-Verwaltung++' + ' ' + current_version + '  -  aktuelle Version: ' + svn_version)
Пример #29
0
    def __init__(self):
        self.__gobject_init__()

        self.set_property('mode', gtk.CELL_RENDERER_MODE_ACTIVATABLE)

        self.statuses = {
            DownloadStatus.RUNNING : gtk.gdk.pixbuf_new_from_file(path.getdatapath('media', 'download_start.png')),
            DownloadStatus.STOPPED : gtk.gdk.pixbuf_new_from_file(path.getdatapath('media', 'download_stop.png')),
            DownloadStatus.ERROR : gtk.gdk.pixbuf_new_from_file(path.getdatapath('media', 'error.png')),
            DownloadStatus.FINISHED : gtk.gdk.pixbuf_new_from_file(path.getdatapath('media', 'finished.png')),
            DownloadStatus.SEEDING : gtk.gdk.pixbuf_new_from_file(path.getdatapath('media', 'finished.png'))
        }
        
        self.types = {
            DownloadTypes.TORRENT : 'Torrent-Download',
            DownloadTypes.BASIC : 'Normaler Download',
            DownloadTypes.OTR_DECODE : 'OTR-Download mit Dekodieren',
            DownloadTypes.OTR_CUT : 'OTR-Download mit Schneiden'
        }

        self.cellrenderer_pixbuf = gtk.CellRendererPixbuf()        
        self.cellrenderer_filename = gtk.CellRendererText()
        self.cellrenderer_info = gtk.CellRendererText()
        self.cellrenderer_progress = gtk.CellRendererProgress()
Пример #30
0
    def _on_menuHelpAbout_activate(self, widget, data=None):

        def open_website(dialog, url, data=None):
            webbrowser.open(url)

        gtk.about_dialog_set_url_hook(open_website)

        about_dialog = gtk.AboutDialog()        
        about_dialog.set_transient_for(self.gui.main_window)
        about_dialog.set_destroy_with_parent(True)
        about_dialog.set_name("OTR-Verwaltung")
        about_dialog.set_logo(gtk.gdk.pixbuf_new_from_file(path.get_image_path('icon3.png')))
        
        version = open(path.getdatapath("VERSION"), 'r').read().strip()
        about_dialog.set_version(version)
        about_dialog.set_website("http://elbersb.de/otrverwaltung")
        about_dialog.set_comments("Zum Verwalten von Dateien von onlinetvrecorder.com.")
        about_dialog.set_copyright("Copyright \xc2\xa9 2010 Benjamin Elbers")
        about_dialog.set_authors(["Benjamin Elbers <*****@*****.**>"])
        about_dialog.run()
        about_dialog.destroy()
Пример #31
0
    def post_init(self):
        self.__setup_toolbar()
        self.__setup_treeview_planning()
        self.__setup_treeview_download()
        self.__setup_treeview_files()
        self.__setup_widgets()

        # set window title
        current_version = open(path.getdatapath("VERSION"), 'r').read().strip()
        self.svn_version_url = "https://raw.githubusercontent.com/einapfelbaum/otr-verwaltung3p/master/data/VERSION"

        try:
            svn_version = urlopen(
                self.svn_version_url).read().strip().decode('utf-8')
        except IOError:
            self.set_title('OTR-Verwaltung3p' + ' ' + current_version)
        else:
            if current_version in str(svn_version):
                self.set_title('OTR-Verwaltung3p' + ' ' + current_version +
                               '  -  Aktuell!')
            else:
                self.set_title('OTR-Verwaltung3p' + ' ' + current_version +
                               '  -  aktuelle Version: ' + str(svn_version))
                self._on_menu_check_update_activate(self)