2015-10-12 00:23:37 +00:00
|
|
|
#!/usr/bin/env python3
|
2013-06-30 02:25:27 +00:00
|
|
|
|
2018-02-24 13:24:39 +00:00
|
|
|
# Copyright (C) 2013-2018 Christian Thomas 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/>.
|
|
|
|
|
2017-07-13 16:24:42 +00:00
|
|
|
from pyqso.dx_cluster import DXCluster
|
2018-02-24 13:24:39 +00:00
|
|
|
from pyqso.world_map import WorldMap
|
2017-07-13 16:24:42 +00:00
|
|
|
from pyqso.awards import Awards
|
2013-06-30 02:25:27 +00:00
|
|
|
|
2016-01-27 16:23:09 +00:00
|
|
|
|
2017-02-15 23:17:51 +00:00
|
|
|
class Toolbox:
|
2013-09-04 20:03:48 +00:00
|
|
|
|
2016-01-27 16:23:09 +00:00
|
|
|
""" Contains a Gtk.Notebook full of amateur radio-related tools. """
|
|
|
|
|
2017-03-31 09:31:30 +00:00
|
|
|
def __init__(self, application):
|
2017-02-21 14:54:04 +00:00
|
|
|
""" Instantiate and insert the various tools into the toolbox.
|
|
|
|
|
2017-03-31 09:31:30 +00:00
|
|
|
:arg application: The PyQSO application containing the main Gtk window, etc.
|
|
|
|
"""
|
2015-10-03 16:51:25 +00:00
|
|
|
|
2017-03-31 09:31:30 +00:00
|
|
|
self.application = application
|
|
|
|
self.builder = self.application.builder
|
2013-06-30 02:25:27 +00:00
|
|
|
|
2017-02-21 14:54:04 +00:00
|
|
|
self.tools = self.builder.get_object("tools")
|
2013-06-30 02:25:27 +00:00
|
|
|
|
2017-04-01 17:10:24 +00:00
|
|
|
self.dx_cluster = DXCluster(self.application)
|
2018-02-24 13:24:39 +00:00
|
|
|
self.world_map = WorldMap(self.application)
|
2017-04-01 17:10:24 +00:00
|
|
|
self.awards = Awards(self.application)
|
2017-02-21 16:47:35 +00:00
|
|
|
|
2017-04-14 20:45:59 +00:00
|
|
|
self.tools.connect_after("switch-page", self.on_switch_page)
|
2013-09-15 03:29:44 +00:00
|
|
|
|
2016-01-27 16:23:09 +00:00
|
|
|
return
|
2013-06-30 02:25:27 +00:00
|
|
|
|
2016-01-27 16:23:09 +00:00
|
|
|
def toggle_visible_callback(self, widget=None):
|
|
|
|
""" Show/hide the toolbox. """
|
2017-02-21 18:16:02 +00:00
|
|
|
toolbox_frame = self.builder.get_object("toolbox")
|
|
|
|
toolbox_frame.set_visible(not toolbox_frame.get_visible())
|
2016-01-27 16:23:09 +00:00
|
|
|
return
|
2013-06-30 23:56:32 +00:00
|
|
|
|
2017-04-14 20:45:59 +00:00
|
|
|
def on_switch_page(self, widget, label, new_page):
|
2018-02-24 13:24:39 +00:00
|
|
|
""" Re-draw the WorldMap if the user switches to the World Map tab. """
|
|
|
|
if(widget.get_tab_label(label).get_text() == "World Map"):
|
|
|
|
self.world_map.draw()
|
2016-01-27 16:23:09 +00:00
|
|
|
return
|