2013-06-30 02:25:27 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2015-03-06 23:31:46 +00:00
|
|
|
# Copyright (C) 2013 Christian T. Jacobs.
|
2013-06-30 02:25:27 +00:00
|
|
|
|
|
|
|
# This file is part of PyQSO.
|
|
|
|
|
|
|
|
# PyQSO 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.
|
|
|
|
#
|
|
|
|
# PyQSO 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 PyQSO. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-09-30 08:56:56 +00:00
|
|
|
from gi.repository import Gtk
|
2013-06-30 02:25:27 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
from pyqso.dx_cluster import *
|
|
|
|
from pyqso.grey_line import *
|
2013-07-15 00:56:54 +00:00
|
|
|
from pyqso.awards import *
|
2013-06-30 02:25:27 +00:00
|
|
|
|
|
|
|
class Toolbox(Gtk.Frame):
|
2013-09-04 20:12:04 +00:00
|
|
|
""" Contains a Gtk.Notebook full of amateur radio-related tools. """
|
2013-09-04 20:03:48 +00:00
|
|
|
|
2013-08-03 19:11:00 +00:00
|
|
|
def __init__(self, parent):
|
2015-10-03 16:51:25 +00:00
|
|
|
""" Instantiate and insert the various tools into the toolbox. """
|
|
|
|
|
2013-09-15 03:29:44 +00:00
|
|
|
logging.debug("Setting up the toolbox...")
|
2013-06-30 02:25:27 +00:00
|
|
|
|
|
|
|
Gtk.Frame.__init__(self)
|
|
|
|
self.set_label("Toolbox")
|
2013-08-03 19:11:00 +00:00
|
|
|
self.parent = parent
|
2013-06-30 02:25:27 +00:00
|
|
|
|
|
|
|
self.tools = Gtk.Notebook()
|
|
|
|
|
2013-08-03 19:11:00 +00:00
|
|
|
self.dx_cluster = DXCluster(self.parent)
|
2013-06-30 02:25:27 +00:00
|
|
|
self.tools.insert_page(self.dx_cluster, Gtk.Label("DX Cluster"), 0)
|
2013-08-03 19:11:00 +00:00
|
|
|
self.grey_line = GreyLine(self.parent)
|
2013-06-30 02:25:27 +00:00
|
|
|
self.tools.insert_page(self.grey_line, Gtk.Label("Grey Line"), 1)
|
2013-08-03 19:11:00 +00:00
|
|
|
self.awards = Awards(self.parent)
|
2013-07-15 00:56:54 +00:00
|
|
|
self.tools.insert_page(self.awards, Gtk.Label("Awards"), 2)
|
2013-06-30 02:25:27 +00:00
|
|
|
|
|
|
|
self.add(self.tools)
|
2013-07-03 10:48:51 +00:00
|
|
|
self.tools.connect_after("switch-page", self._on_switch_page)
|
2013-06-30 02:25:27 +00:00
|
|
|
|
2013-09-15 03:29:44 +00:00
|
|
|
logging.debug("Toolbox ready!")
|
|
|
|
|
2013-06-30 02:25:27 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
def toggle_visible_callback(self, widget=None):
|
2013-09-04 20:12:04 +00:00
|
|
|
""" Show/hide the toolbox. """
|
2013-06-30 02:25:27 +00:00
|
|
|
self.set_visible(not self.get_visible())
|
|
|
|
return
|
|
|
|
|
|
|
|
def _on_switch_page(self, widget, label, new_page):
|
2013-09-04 20:12:04 +00:00
|
|
|
""" Re-draw the Grey Line if the user switches to the grey line tab. """
|
2013-06-30 02:25:27 +00:00
|
|
|
if(type(label) == GreyLine):
|
|
|
|
label.draw() # Note that 'label' is actually a GreyLine object.
|
|
|
|
return
|
2013-06-30 23:56:32 +00:00
|
|
|
|