Beispiel #1
0
    def __init__(self):
        UITricks.__init__(self, 'ui/webilder.glade', 'DonateDialog')
        text = _('''
Webilder is trying hard to make your desktop the coolest in town.

Since you installed it on %(inst_date)s, it downloaded <b>%(downloads)d photos</b>
for you and changed your wallpaper <b>%(rotations)d times</b>.

It takes a lot of time and hard work to develop and maintain Webilder.

If you'd like to see Webilder becomes even better, you can help us
a lot by making a small donation.

Any donation will be GREATLY appreciated. You can even donate $5.

After clicking on the <i>Yes</i> button below you'll be taken to
the donation page. If the page does not appear, please visit:
%(url)s

Would you like to donate to Webilder?
''')

        stats = config.get('webilder.stats')
        self.url = 'http://www.webilder.org/donate.html'
        context = dict(downloads=stats['downloads'],
                       rotations=stats['rotations'],
                       inst_date=time.strftime('%B %Y'),
                       url=self.url)

        self.donate_copy.set_markup(text % context)
Beispiel #2
0
    def __init__(self):
        UITricks.__init__(self, 'ui/webilder_desktop.glade',
            'WebilderDesktopWindow')
        self.sort_combo.set_active(1)       # date
        renderer = gtk.CellRendererText()
        self.tree.append_column(
            column=gtk.TreeViewColumn("Album", renderer, markup=0))
        self.tree.columns_autosize()
        self.load_collection_tree(config.get('collection.dir'))
        self.iconview.set_pixbuf_column(IV_PIXBUF_COLUMN)
        self.iconview.set_markup_column(IV_TEXT_COLUMN)
        self.on_iconview_handle_selection_changed(self.iconview)
        self.collection_monitor = dict(monitor=None, dir=None)
        self.image_popup = ImagePopup(self)
        self.download_dialog = None

        if gnomevfs:
            self.tree_monitor = gnomevfs.monitor_add(
                config.get('collection.dir'),
                gnomevfs.MONITOR_DIRECTORY,
                self.collection_tree_changed)

        self.restore_window_state()
        self.top_widget.show_all()

        self.hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
Beispiel #3
0
    def __init__(self):
        UITricks.__init__(self, 'ui/webilder.glade', 'DonateDialog')
        text = _('''
Webilder is trying hard to make your desktop the coolest in town.

Since you installed it on %(inst_date)s, it downloaded <b>%(downloads)d photos</b>
for you and changed your wallpaper <b>%(rotations)d times</b>.

It takes a lot of time and hard work to develop and maintain Webilder.

If you'd like to see Webilder becomes even better, you can help us
a lot by making a small donation.

Any donation will be GREATLY appreciated. You can even donate $5.

After clicking on the <i>Yes</i> button below you'll be taken to
the donation page. If the page does not appear, please visit:
%(url)s

Would you like to donate to Webilder?
''')

        stats = config.get('webilder.stats')
        self.url = 'http://www.webilder.org/donate.html'
        context = dict(
                downloads = stats['downloads'],
                rotations = stats['rotations'],
                inst_date = time.strftime('%B %Y'),
                url = self.url
                )

        self.donate_copy.set_markup(text % context)
Beispiel #4
0
    def __init__(self):
        UITricks.__init__(self, 'ui/webilder_desktop.glade',
                          'WebilderDesktopWindow')
        self.sort_combo.set_active(1)  # date
        renderer = gtk.CellRendererText()
        self.tree.append_column(
            column=gtk.TreeViewColumn("Album", renderer, markup=0))
        self.tree.columns_autosize()
        self.load_collection_tree(config.get('collection.dir'))
        self.iconview.set_pixbuf_column(IV_PIXBUF_COLUMN)
        self.iconview.set_markup_column(IV_TEXT_COLUMN)
        self.on_iconview_handle_selection_changed(self.iconview)
        self.collection_monitor = dict(monitor=None, dir=None)
        self.image_popup = ImagePopup(self)
        self.download_dialog = None

        if gnomevfs:
            self.tree_monitor = gnomevfs.monitor_add(
                config.get('collection.dir'), gnomevfs.MONITOR_DIRECTORY,
                self.collection_tree_changed)

        self.restore_window_state()
        self.top_widget.show_all()

        self.hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
Beispiel #5
0
 def __init__(self, main_window):
     self.main_window = main_window
     self.on_view_full_screen_handle_activate = (
         main_window.on_view_fullscreen_handle_activate)
     self.on_set_as_wallpaper_handle_activate = (
         main_window.on_set_as_wallpaper_handle_activate)
     self.on_photo_properties_handle_activate = (
         main_window.on_photo_properties_handle_activate)
     UITricks.__init__(self, 'ui/webilder_desktop.glade',
                       'WebilderImagePopup')
Beispiel #6
0
 def __init__(self, main_window):
     self.main_window = main_window
     self.on_view_full_screen_handle_activate = (
         main_window.on_view_fullscreen_handle_activate)
     self.on_set_as_wallpaper_handle_activate = (
         main_window.on_set_as_wallpaper_handle_activate)
     self.on_photo_properties_handle_activate = (
         main_window.on_photo_properties_handle_activate)
     UITricks.__init__(self, 'ui/webilder_desktop.glade',
                       'WebilderImagePopup')
Beispiel #7
0
    def __init__(self):
        UITricks.__init__(self, 'ui/config.glade', 'config_dialog')
        self.on_flickr_enabled_handle_toggled()
        self.on_webshots_enabled_handle_toggled()
        self.on_autodownload_bool_handle_toggled()
        self.on_rotate_bool_handle_toggled()
        self.on_wallpaper_use_script_handle_toggled()

        cell = gtk.CellRendererToggle()
        cell.set_property('activatable', True)
        column = gtk.TreeViewColumn('', cell, active=3)
        self.flickr_rules.append_column(column)
        cell.connect('toggled', self.on_rule_toggled, 3)

        for index, value in enumerate([_('Album'), _('Tags'), _('User')]):
            cell = gtk.CellRendererText()
            cell.set_property('editable', True)
            column = gtk.TreeViewColumn(value, cell, text=index)
            column.set_resizable(True)
            self.flickr_rules.append_column(column)
            cell.connect('edited', self.on_cell_edited, index)

        cell = gtk.CellRendererCombo()
        cell.set_property('has-entry', False)
        combo_model = gtk.ListStore(str)
        combo_model.append(('Interestingness', ))
        combo_model.append((_('Date'), ))
        cell.set_property('model', combo_model)
        cell.set_property('text-column', 0)
        cell.set_property('editable', True)
        column = gtk.TreeViewColumn(_('Sort'), cell, text=4)
        self.flickr_rules.append_column(column)
        cell.connect('edited', self.on_cell_edited, 4)
        self.rotate_interval.get_model().clear()

        for time in sorted(ROTATION_CONSTS.keys()):
            self.rotate_interval.append_text(ROTATION_CONSTS[time])
        self.wallpaper_widgets = dict(
                gnome=self.wallpaper_use_gnome,
                gnome3=self.wallpaper_use_gnome3,
                kde=self.wallpaper_use_kde,
                xfce=self.wallpaper_use_xfce,
                compiz_wallpaper=self.wallpaper_use_compiz_wallpaper,
                script=self.wallpaper_use_script)
        self.notebook.drag_dest_set(
            gtk.DEST_DEFAULT_MOTION |
            gtk.DEST_DEFAULT_HIGHLIGHT |
            gtk.DEST_DEFAULT_DROP,
            [('text/plain', 0, 0), ('text/uri-list', 0, 1)],
            gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE)
Beispiel #8
0
    def __init__(self):
        UITricks.__init__(self, 'ui/config.glade', 'config_dialog')
        self.on_flickr_enabled_handle_toggled()
        self.on_webshots_enabled_handle_toggled()
        self.on_autodownload_bool_handle_toggled()
        self.on_rotate_bool_handle_toggled()
        self.on_wallpaper_use_script_handle_toggled()

        cell = gtk.CellRendererToggle()
        cell.set_property('activatable', True)
        column = gtk.TreeViewColumn('', cell, active=3)
        self.flickr_rules.append_column(column)
        cell.connect('toggled', self.on_rule_toggled, 3)

        for index, value in enumerate([_('Album'), _('Tags'), _('User')]):
            cell = gtk.CellRendererText()
            cell.set_property('editable', True)
            column = gtk.TreeViewColumn(value, cell, text=index)
            column.set_resizable(True)
            self.flickr_rules.append_column(column)
            cell.connect('edited', self.on_cell_edited, index)

        cell = gtk.CellRendererCombo()
        cell.set_property('has-entry', False)
        combo_model = gtk.ListStore(str)
        combo_model.append(('Interestingness', ))
        combo_model.append((_('Date'), ))
        cell.set_property('model', combo_model)
        cell.set_property('text-column', 0)
        cell.set_property('editable', True)
        column = gtk.TreeViewColumn(_('Sort'), cell, text=4)
        self.flickr_rules.append_column(column)
        cell.connect('edited', self.on_cell_edited, 4)
        self.rotate_interval.get_model().clear()

        for time in sorted(ROTATION_CONSTS.keys()):
            self.rotate_interval.append_text(ROTATION_CONSTS[time])
        self.wallpaper_widgets = dict(
            gnome=self.wallpaper_use_gnome,
            kde=self.wallpaper_use_kde,
            xfce=self.wallpaper_use_xfce,
            compiz_wallpaper=self.wallpaper_use_compiz_wallpaper,
            script=self.wallpaper_use_script)
        self.notebook.drag_dest_set(
            gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT
            | gtk.DEST_DEFAULT_DROP, [('text/plain', 0, 0),
                                      ('text/uri-list', 0, 1)],
            gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
Beispiel #9
0
    def info_current(self, *_args):
        """Opens the photo properties window."""
        import os, time, commands
        from webilder.webshots.wbz import parse_metadata
        from webilder.uitricks import UITricks, open_browser

        currentfile = commands.getoutput('/usr/bin/gconftool-2 -g /desktop/gnome/background/picture_filename')

        if self.image_file == currentfile:
            currentinfo = self.info_file
            try:
                fileobj = open(currentinfo, 'r')
                infodata = parse_metadata(fileobj.read())
                fileobj.close()
            except IOError:
                infodata = {}

        else:
            import getpass
            wbtestpath = '/home/' + getpass.getuser() + '/.webilder/Collection/'
            wbtest = currentfile.startswith(wbtestpath)
            if wbtest == True:
                currentinfo = os.path.splitext(currentfile)[0] + '.inf'
                try:
                    fileobj = open(currentinfo, 'r')
                    infodata = parse_metadata(fileobj.read())
                    fileobj.close()
                except IOError:
                    infodata = {}
            else:
                try:
                    infodata = parse_metadata("url=--\ncredit=--\ntitle=--\ntags=--\nalbumTitle=--\n")
                except IOError:
                    infodata = {}

        applet_win = UITricks('ui/webilder.glade', 'PhotoPropertiesDialog')
        applet_win.title.set_markup('<b>%s</b>' % infodata['title'])
        applet_win.album.set_markup(infodata['albumTitle'])
        applet_win.file.set_text(currentfile)
        applet_win.tags.set_text(infodata['tags'])
        applet_win.size.set_text(_('%.1f KB') % (os.path.getsize(currentfile) / 1024.0))
        applet_win.date.set_text(time.strftime('%c', time.localtime(os.path.getctime(currentfile))))
        applet_win.url.set_text(infodata['url'])

        applet_win.closebutton.connect('clicked', lambda *args: applet_win.destroy())
        applet_win.show()
Beispiel #10
0
 def run(self):
     val = UITricks.run(self)
     if val == 0:
         open_browser(self.url, no_browser_title=_('Thank You!'),
                      no_browser_markup=_(
                          '<b>Thanks for your interest in supporting '
                          'Webilder.</b>\n\n'
                          'Please follow this link to send us a '
                          'donation:\n\n%s') % self.url)
Beispiel #11
0
 def run(self):
     val = UITricks.run(self)
     if val == 0:
         open_browser(self.url,
                      no_browser_title=_('Thank You!'),
                      no_browser_markup=_(
                          '<b>Thanks for your interest in supporting '
                          'Webilder.</b>\n\n'
                          'Please follow this link to send us a '
                          'donation:\n\n%s') % self.url)
Beispiel #12
0
    def on_photo_properties_handle_activate(self, _event):
        """Called when photo properties has been clicked."""
        selected = self.iconview.get_selected_items()
        if not selected:
            return

        win = UITricks('ui/webilder.glade', 'PhotoPropertiesDialog')
        selected = selected[-1]
        path = selected
        iterator = self.iconview.get_model().get_iter(path)
        data = self.iconview.get_model().get_value(iterator,
            IV_DATA_COLUMN)
        win.title.set_markup('<b>%s</b>' % data['title'])
        win.album.set_markup(data['album'])
        win.file.set_text(data['filename'])
        win.tags.set_text(data['tags'])
        win.size.set_text(_('%.1f KB') % (os.path.getsize(data['filename']) /
                                          1024.0))
        win.date.set_text(time.strftime('%c', time.localtime(os.path.getctime(
            data['filename']))))
        win.url.set_text(data['inf'].get('url', ''))

        win.closebutton.connect('clicked', lambda *args: win.destroy())
        win.show()
Beispiel #13
0
    def on_photo_properties_handle_activate(self, _event):
        """Called when photo properties has been clicked."""
        selected = self.iconview.get_selected_items()
        if not selected:
            return

        win = UITricks('ui/webilder.glade', 'PhotoPropertiesDialog')
        selected = selected[-1]
        path = selected
        iterator = self.iconview.get_model().get_iter(path)
        data = self.iconview.get_model().get_value(iterator, IV_DATA_COLUMN)
        win.title.set_markup('<b>%s</b>' % data['title'])
        win.album.set_markup(data['album'])
        win.file.set_text(data['filename'])
        win.tags.set_text(data['tags'])
        win.size.set_text(
            _('%.1f KB') % (os.path.getsize(data['filename']) / 1024.0))
        win.date.set_text(
            time.strftime('%c',
                          time.localtime(os.path.getctime(data['filename']))))
        win.url.set_text(data['inf'].get('url', ''))

        win.closebutton.connect('clicked', lambda *args: win.destroy())
        win.show()