def __init__(self):
Gtk.Dialog.__init__(
self,
_('National Geographic Wallpaper'),
None,
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
self.set_size_request(350, 80)
self.set_icon_from_file(comun.ICON)
self.connect('destroy', self.close_application)
self.config = Config()
self.croni = Croni()
self.autostart = Autostart()
grid = Gtk.Grid()
grid.set_row_spacing(5)
grid.set_column_spacing(5)
grid.set_border_width(5)
self.get_content_area().add(grid)
label10 = Gtk.Label(_('Change wallpaper automatically?') + ':')
label10.set_alignment(0, 0.5)
grid.add(label10)
self.switch = Gtk.Switch()
self.switch.set_active(self.croni.is_enabled())
hbox = Gtk.Box(Gtk.Orientation.HORIZONTAL, 5)
hbox.pack_start(self.switch, False, False, 0)
grid.attach(hbox, 1, 0, 1, 1)
label20 = Gtk.Label(_('Select backgrounds source') + ':')
label20.set_alignment(0, 0.5)
grid.attach(label20, 0, 1, 1, 1)
source_store = Gtk.ListStore(str, str)
source_store.append([_('National Geographic'), 'national-geographic'])
source_store.append([_('Bing'), 'bing'])
source_store.append([_('GoPro'), 'gopro'])
source_store.append([_('Powder'), 'powder'])
source_store.append([_('Fstoppers'), 'fstoppers'])
source_store.append([_('Desktoppr'), 'desktoppr'])
source_store.append([_('Nasa'), 'nasa'])
self.combobox_source = Gtk.ComboBox.new()
self.combobox_source.set_model(source_store)
cell1 = Gtk.CellRendererText()
self.combobox_source.pack_start(cell1, True)
self.combobox_source.add_attribute(cell1, 'text', 0)
grid.attach(self.combobox_source, 1, 1, 1, 1)
button = Gtk.Button(_('Change now'))
button.connect('clicked', self.button_pressed)
hbox = Gtk.Box(Gtk.Orientation.HORIZONTAL, 5)
hbox.pack_start(button, True, False, 0)
grid.attach(hbox, 0, 2, 2, 1)
self.load_preferences()
self.show_all()
national-geographic-wallpaper.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录