Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8; tab-width: 4; mode: python -*-
- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
- # vi: set ft=python sts=4 ts=4 sw=4 noet
- #
- # This file is part of FreeStation.
- #
- # FreeStation is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 3 of the License, or
- # (at your option) any later version.
- #
- # FreeStation is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with Fail2Ban; if not, write to the Free Software
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- # Author: Ángel Guzmán Maeso
- #
- # $Revision$
- __author__ = 'Ángel Guzmán Maeso'
- __version__ = '$Revision$'
- __date__ = '$Date$'
- __copyright__ = 'Copyright (c) 2012 Ángel Guzmán Maeso'
- __license__ = 'GPL'
- from freestation.logger import Logger
- LOG = Logger('GUI').get()
- import gi
- gi.require_version('Gtk', '3.0')
- from gi.repository import Gdk, Gtk #@UnresolvedImport
- from gi.repository import GdkX11 #@UnresolvedImport # For get_xid() @UnusedImport
- from freestation.constants import APP_NAME
- from freestation.widget_loader import WidgetLoader
- class GUI2(Gtk.Window):
- __name__ = 'GUI' #@ReservedAssignment
- def __init__(self, application):
- Gtk.Window.__init__(self, type = Gtk.WindowType.TOPLEVEL)
- LOG.debug('Starting')
- self.application = application
- self.__connect_signals()
- self.set_title(APP_NAME)
- self.set_border_width(24)
- self.set_decorated(False)
- self.__pack_widgets()
- self.add(self.box)
- self.fullscreen()
- self.show_all()
- def __pack_widgets(self):
- self.box = Gtk.Box(orientation = Gtk.Orientation.VERTICAL, spacing = 6)
- from freestation.widgets import BrowserView
- self.browser_view_widget = BrowserView.BrowserView(None)
- self.box.pack_start(self.browser_view_widget , True, True, True)
- def __connect_signals(self):
- self.connect('key-press-event', self.__key_press_event)
- self.connect('delete-event', self.application.on_destroy)
- def __key_press_event(self, widget, event) :
- # event.keyval == Gdk.keyval_from_name("w")
- if event.string == 'q' :
- if hasattr(self, 'browser_view_widget'):
- self.browser_view_widget.on_destroy()
- widget.destroy()
- self.application.on_destroy(widget, event)
- elif event.string == 'f' :
- self.unfullscreen()
Advertisement
Add Comment
Please, Sign In to add comment