pyqso/pyqso/toolbox.py

66 wiersze
2.1 KiB
Python
Czysty Zwykły widok Historia

#!/usr/bin/env python3
# Copyright (C) 2013-2017 Christian Thomas Jacobs.
# 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/>.
import logging
from pyqso.dx_cluster import *
from pyqso.grey_line import *
from pyqso.awards import *
class Toolbox:
2013-09-04 20:03:48 +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.
:arg builder: The Gtk builder.
"""
2015-10-03 16:51:25 +00:00
logging.debug("Setting up the toolbox...")
2017-03-31 09:31:30 +00:00
self.application = application
self.builder = self.application.builder
2017-02-21 14:54:04 +00:00
self.tools = self.builder.get_object("tools")
self.dx_cluster = DXCluster(self.builder)
self.grey_line = GreyLine(self.builder)
self.awards = Awards(self.builder)
2017-02-21 16:47:35 +00:00
self.tools.connect_after("switch-page", self._on_switch_page)
logging.debug("Toolbox ready!")
return
def toggle_visible_callback(self, widget=None):
""" Show/hide the toolbox. """
toolbox_frame = self.builder.get_object("toolbox")
toolbox_frame.set_visible(not toolbox_frame.get_visible())
return
def _on_switch_page(self, widget, label, new_page):
""" Re-draw the Grey Line if the user switches to the grey line tab. """
if(widget.get_tab_label(label).get_text() == "Grey Line"):
self.grey_line.draw()
return