kopia lustrzana https://github.com/ctjacobs/pyqso
Porting toolbox tools over to Glade.
rodzic
304d35fe0f
commit
3eb3275d35
|
@ -78,7 +78,7 @@ class PyQSO:
|
|||
possible_icon_paths = [os.path.join(pyqso_path, "icons", "log_64x64.png")]
|
||||
for icon_path in possible_icon_paths:
|
||||
try:
|
||||
window.set_icon_from_file(icon_path)
|
||||
self.window.set_icon_from_file(icon_path)
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
|
||||
|
|
|
@ -21,22 +21,22 @@ from gi.repository import Gtk
|
|||
import logging
|
||||
|
||||
|
||||
class Awards(Gtk.VBox):
|
||||
class Awards:
|
||||
|
||||
""" A tool for tracking progress towards an award. Currently this only supports the DXCC award.
|
||||
For more information visit http://www.arrl.org/dxcc """
|
||||
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent, builder):
|
||||
""" Set up a table for progress tracking purposes.
|
||||
|
||||
:arg parent: The parent Gtk window.
|
||||
:arg builder: The Gtk builder.
|
||||
"""
|
||||
# TODO: This only considers the DXCC award for now.
|
||||
logging.debug("New Awards instance created!")
|
||||
|
||||
Gtk.VBox.__init__(self, spacing=2)
|
||||
logging.debug("Setting up awards table...")
|
||||
|
||||
self.parent = parent
|
||||
self.builder = builder
|
||||
|
||||
self.bands = ["70cm", "2m", "6m", "10m", "12m", "15m", "17m", "20m", "30m", "40m", "80m", "160m"]
|
||||
self.modes = ["Phone", "CW", "Digital", "Mixed"]
|
||||
|
@ -60,13 +60,9 @@ class Awards(Gtk.VBox):
|
|||
column.set_clickable(False)
|
||||
self.treeview.append_column(column)
|
||||
|
||||
# Add a label to inform the user that this only considers the DXCC award for now.
|
||||
label = Gtk.Label(halign=Gtk.Align.START)
|
||||
label.set_markup("<span size=\"x-large\">%s</span>" % "DXCC Award")
|
||||
self.pack_start(label, False, False, 4)
|
||||
# Show the table in the Awards tab
|
||||
self.add(self.treeview)
|
||||
self.show_all()
|
||||
self.builder.get_object("awards").add(self.treeview)
|
||||
self.builder.get_object("awards").show_all()
|
||||
|
||||
logging.debug("Awards table set up successfully.")
|
||||
|
||||
|
@ -78,7 +74,7 @@ class Awards(Gtk.VBox):
|
|||
""" Update the table for progress tracking. """
|
||||
|
||||
logging.debug("Counting the band/mode combinations for the awards table...")
|
||||
# Wipe everything and start again
|
||||
# Wipe everything and start again.
|
||||
self.awards.clear()
|
||||
# For each mode, add a new list for holding the totals, and initialise the values to zero.
|
||||
count = []
|
||||
|
@ -100,7 +96,7 @@ class Awards(Gtk.VBox):
|
|||
else:
|
||||
# FIXME: This assumes that all the other modes in the ADIF list are digital modes. Is this the case?
|
||||
count[2][band] += 1
|
||||
count[3][band] += 1 # Keep the total of each column in the "Mixed" mode
|
||||
count[3][band] += 1 # Keep the total of each column in the "Mixed" mode.
|
||||
else:
|
||||
logging.error("Could not update the awards table for '%s' because of a database error." % log.name)
|
||||
# Insert the rows containing the totals
|
||||
|
|
|
@ -32,7 +32,7 @@ from xml.dom import minidom
|
|||
from pyqso.auxiliary_dialogs import *
|
||||
|
||||
|
||||
class CallsignLookupQRZ():
|
||||
class CallsignLookupQRZ:
|
||||
|
||||
""" Use qrz.com to lookup details about a particular callsign. """
|
||||
|
||||
|
@ -161,7 +161,7 @@ class CallsignLookupQRZ():
|
|||
return fields_and_data
|
||||
|
||||
|
||||
class CallsignLookupHamQTH():
|
||||
class CallsignLookupHamQTH:
|
||||
|
||||
""" Use hamqth.com to lookup details about a particular callsign. """
|
||||
|
||||
|
|
|
@ -34,91 +34,41 @@ import os.path
|
|||
BOOKMARKS_FILE = os.path.expanduser('~/.config/pyqso/bookmarks.ini')
|
||||
|
||||
|
||||
class DXCluster(Gtk.VBox):
|
||||
class DXCluster:
|
||||
|
||||
""" A tool for connecting to a DX cluster (specifically Telnet-based DX clusters). """
|
||||
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent, builder):
|
||||
""" Set up the DX cluster's Gtk.VBox, and set up a timer so that PyQSO can retrieve new data from the Telnet server every few seconds.
|
||||
|
||||
:arg parent: The parent Gtk window.
|
||||
:arg builder: The Gtk builder.
|
||||
"""
|
||||
|
||||
logging.debug("Setting up the DX cluster...")
|
||||
Gtk.VBox.__init__(self, spacing=2)
|
||||
|
||||
self.connection = None
|
||||
self.parent = parent
|
||||
self.builder = builder
|
||||
|
||||
# Set up the menubar
|
||||
self.menubar = Gtk.MenuBar()
|
||||
# Connect signals.
|
||||
self.builder.get_object("mitem_new").connect("activate", self.new_server)
|
||||
self.builder.get_object("mitem_disconnect").connect("activate", self.telnet_disconnect)
|
||||
self.builder.get_object("send").connect("clicked", self.telnet_send_command)
|
||||
self.builder.get_object("command").connect("key-release-event", self._on_command_key_press)
|
||||
|
||||
self.items = {}
|
||||
|
||||
# CONNECTION
|
||||
mitem_connection = Gtk.MenuItem(label="Connection")
|
||||
self.menubar.append(mitem_connection)
|
||||
subm_connection = Gtk.Menu()
|
||||
mitem_connection.set_submenu(subm_connection)
|
||||
|
||||
# Connect
|
||||
mitem_connect = Gtk.ImageMenuItem(label="Connect to Telnet Server")
|
||||
icon = Gtk.Image()
|
||||
icon.set_from_stock(Gtk.STOCK_CONNECT, Gtk.IconSize.MENU)
|
||||
mitem_connect.set_image(icon)
|
||||
subm_connection.append(mitem_connect)
|
||||
self.items["CONNECT"] = mitem_connect
|
||||
|
||||
subm_connect = Gtk.Menu()
|
||||
|
||||
# New
|
||||
mitem_new = Gtk.MenuItem(label="New...")
|
||||
mitem_new.connect("activate", self.new_server)
|
||||
subm_connect.append(mitem_new)
|
||||
|
||||
# From Bookmark
|
||||
mitem_bookmark = Gtk.MenuItem(label="From Bookmark")
|
||||
self.subm_bookmarks = Gtk.Menu()
|
||||
mitem_bookmark.set_submenu(self.subm_bookmarks)
|
||||
self._populate_bookmarks()
|
||||
subm_connect.append(mitem_bookmark)
|
||||
|
||||
mitem_connect.set_submenu(subm_connect)
|
||||
|
||||
# Disconnect
|
||||
mitem_disconnect = Gtk.ImageMenuItem(label="Disconnect from Telnet Server")
|
||||
icon = Gtk.Image()
|
||||
icon.set_from_stock(Gtk.STOCK_DISCONNECT, Gtk.IconSize.MENU)
|
||||
mitem_disconnect.set_image(icon)
|
||||
mitem_disconnect.connect("activate", self.telnet_disconnect)
|
||||
subm_connection.append(mitem_disconnect)
|
||||
self.items["DISCONNECT"] = mitem_disconnect
|
||||
|
||||
self.pack_start(self.menubar, False, False, 0)
|
||||
|
||||
# A TextView object to display the output from the Telnet server.
|
||||
self.renderer = Gtk.TextView()
|
||||
self.renderer.set_editable(False)
|
||||
self.renderer.set_cursor_visible(False)
|
||||
sw = Gtk.ScrolledWindow()
|
||||
sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
|
||||
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
sw.add(self.renderer)
|
||||
# Get the text renderer and its buffer.
|
||||
self.renderer = self.builder.get_object("renderer")
|
||||
self.buffer = self.renderer.get_buffer()
|
||||
self.pack_start(sw, True, True, 0)
|
||||
|
||||
# Set up the command box.
|
||||
self.commandbox = Gtk.HBox(spacing=2)
|
||||
self.command = Gtk.Entry()
|
||||
self.command.connect("key-release-event", self._on_command_key_press)
|
||||
self.commandbox.pack_start(self.command, True, True, 0)
|
||||
self.send = Gtk.Button(label="Send Command")
|
||||
self.send.connect("clicked", self.telnet_send_command)
|
||||
self.commandbox.pack_start(self.send, False, False, 0)
|
||||
self.pack_start(self.commandbox, False, False, 0)
|
||||
|
||||
# Items whose sensitivity may change.
|
||||
self.items = {}
|
||||
self.items["CONNECT"] = self.builder.get_object("mitem_connect")
|
||||
self.items["DISCONNECT"] = self.builder.get_object("mitem_disconnect")
|
||||
self.items["SEND"] = self.builder.get_object("send")
|
||||
self.set_items_sensitive(True)
|
||||
|
||||
self.show_all()
|
||||
self._populate_bookmarks()
|
||||
|
||||
logging.debug("DX cluster ready!")
|
||||
|
||||
|
@ -135,14 +85,12 @@ class DXCluster(Gtk.VBox):
|
|||
|
||||
# Build connection dialog
|
||||
logging.debug("Setting up the Telnet connection dialog...")
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file(os.path.abspath(os.path.dirname(__file__)) + "/glade/telnet_connection.glade")
|
||||
dialog = builder.get_object("telnet_connection_dialog")
|
||||
connection_info = {"HOST": builder.get_object("host_entry"),
|
||||
"PORT": builder.get_object("port_entry"),
|
||||
"USERNAME": builder.get_object("username_entry"),
|
||||
"PASSWORD": builder.get_object("password_entry"),
|
||||
"BOOKMARK": builder.get_object("bookmark_checkbox")}
|
||||
dialog = self.builder.get_object("telnet_connection_dialog")
|
||||
connection_info = {"HOST": self.builder.get_object("host_entry"),
|
||||
"PORT": self.builder.get_object("port_entry"),
|
||||
"USERNAME": self.builder.get_object("username_entry"),
|
||||
"PASSWORD": self.builder.get_object("password_entry"),
|
||||
"BOOKMARK": self.builder.get_object("bookmark_checkbox")}
|
||||
|
||||
response = dialog.run()
|
||||
if(response == Gtk.ResponseType.OK):
|
||||
|
@ -218,26 +166,30 @@ class DXCluster(Gtk.VBox):
|
|||
|
||||
def _populate_bookmarks(self):
|
||||
""" Populate the list of bookmarked Telnet servers in the menu. """
|
||||
|
||||
# Get the bookmarks submenu.
|
||||
subm_bookmarks = self.builder.get_object("subm_bookmarks")
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
have_config = (config.read(BOOKMARKS_FILE) != [])
|
||||
|
||||
if(have_config):
|
||||
try:
|
||||
# Clear the menu of all current bookmarks.
|
||||
for i in self.subm_bookmarks.get_children():
|
||||
self.subm_bookmarks.remove(i)
|
||||
for i in subm_bookmarks.get_children():
|
||||
subm_bookmarks.remove(i)
|
||||
|
||||
# Add all bookmarks in the config file.
|
||||
for bookmark in config.sections():
|
||||
mitem = Gtk.MenuItem(label=bookmark)
|
||||
mitem.connect("activate", self.bookmarked_server, bookmark)
|
||||
self.subm_bookmarks.append(mitem)
|
||||
subm_bookmarks.append(mitem)
|
||||
|
||||
except Exception as e:
|
||||
logging.error("An error occurred whilst populating the DX cluster bookmarks menu.")
|
||||
logging.exception(e)
|
||||
|
||||
self.show_all() # Need to do this to update the bookmarks list in the menu.
|
||||
self.builder.get_object("dx_cluster").show_all() # Need to do this to update the bookmarks list in the menu.
|
||||
|
||||
return
|
||||
|
||||
|
@ -328,8 +280,9 @@ class DXCluster(Gtk.VBox):
|
|||
def telnet_send_command(self, widget=None):
|
||||
""" Send the user-specified command in the Gtk.Entry box to the Telnet server (if PyQSO is connected to one). """
|
||||
if(self.connection):
|
||||
self.connection.write((self.command.get_text() + "\n").encode())
|
||||
self.command.set_text("")
|
||||
command = self.builder.get_object("command")
|
||||
self.connection.write((command.get_text() + "\n").encode())
|
||||
command.set_text("")
|
||||
return
|
||||
|
||||
def _on_telnet_io(self):
|
||||
|
@ -368,7 +321,7 @@ class DXCluster(Gtk.VBox):
|
|||
"""
|
||||
self.items["CONNECT"].set_sensitive(sensitive)
|
||||
self.items["DISCONNECT"].set_sensitive(not sensitive)
|
||||
self.send.set_sensitive(not sensitive)
|
||||
self.items["SEND"].set_sensitive(not sensitive)
|
||||
return
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,16 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-connect</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-disconnect</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="pyqso">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">PyQSO</property>
|
||||
|
@ -168,6 +178,7 @@
|
|||
<object class="GtkNotebook" id="logbook">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="scrollable">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
@ -198,12 +209,10 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<object class="GtkAlignment" id="toolbox_alignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="tools">
|
||||
<property name="visible">True</property>
|
||||
|
@ -213,6 +222,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkMenuBar" id="dx_cluster_menu">
|
||||
<property name="visible">True</property>
|
||||
|
@ -227,54 +237,47 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="imagemenuitem1">
|
||||
<property name="label">gtk-new</property>
|
||||
<object class="GtkImageMenuItem" id="mitem_connect">
|
||||
<property name="label">Connect to Telnet Server</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">image5</property>
|
||||
<property name="use_stock">False</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="subm_connect">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mitem_new">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">New...</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="mitem_bookmark ">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">From Bookmark</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="subm_bookmarks">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="imagemenuitem2">
|
||||
<property name="label">gtk-open</property>
|
||||
<object class="GtkImageMenuItem" id="mitem_disconnect">
|
||||
<property name="label">Disconnect from Telnet Server</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="imagemenuitem3">
|
||||
<property name="label">gtk-save</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="imagemenuitem4">
|
||||
<property name="label">gtk-save-as</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="imagemenuitem5">
|
||||
<property name="label">gtk-quit</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="image">image6</property>
|
||||
<property name="use_stock">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -289,7 +292,60 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkScrolledWindow" id="sw">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">etched-in</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="renderer">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="commandbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="command">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="send">
|
||||
<property name="label" translatable="yes">Send Command</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -304,11 +360,14 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label" translatable="yes">button</property>
|
||||
<object class="GtkBox" id="greyline">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
@ -326,11 +385,30 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label" translatable="yes">button</property>
|
||||
<object class="GtkBox" id="awards">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="dxcc_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin_left">4</property>
|
||||
<property name="label" translatable="yes"><span size="x-large">DXCC Award</span></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">4</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
|
|
|
@ -42,18 +42,20 @@ except ImportError as e:
|
|||
have_necessary_modules = False
|
||||
|
||||
|
||||
class GreyLine(Gtk.VBox):
|
||||
class GreyLine:
|
||||
|
||||
""" A tool for visualising the grey line. """
|
||||
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent, builder):
|
||||
""" Set up the drawing canvas and the timer which will re-plot the grey line every 30 minutes.
|
||||
|
||||
:arg parent: The parent Gtk window.
|
||||
:arg builder: The Gtk builder.
|
||||
"""
|
||||
logging.debug("Setting up the grey line...")
|
||||
Gtk.VBox.__init__(self, spacing=2)
|
||||
|
||||
self.parent = parent
|
||||
self.builder = builder
|
||||
|
||||
# Get the QTH coordinates, if available.
|
||||
config = configparser.ConfigParser()
|
||||
|
@ -74,10 +76,10 @@ class GreyLine(Gtk.VBox):
|
|||
if(have_necessary_modules):
|
||||
self.fig = matplotlib.figure.Figure()
|
||||
self.canvas = FigureCanvas(self.fig) # For embedding in the Gtk application
|
||||
self.pack_start(self.canvas, True, True, 0)
|
||||
self.builder.get_object("greyline").add(self.canvas)
|
||||
self.refresh_event = GObject.timeout_add(1800000, self.draw) # Re-draw the grey line automatically after 30 minutes (if the grey line tool is visible).
|
||||
|
||||
self.show_all()
|
||||
self.builder.get_object("greyline").show_all()
|
||||
|
||||
logging.debug("Grey line ready!")
|
||||
|
||||
|
|
|
@ -30,21 +30,22 @@ class Toolbox:
|
|||
""" Contains a Gtk.Notebook full of amateur radio-related tools. """
|
||||
|
||||
def __init__(self, parent, builder):
|
||||
""" Instantiate and insert the various tools into the toolbox. """
|
||||
""" Instantiate and insert the various tools into the toolbox.
|
||||
|
||||
:arg parent: The parent Gtk window.
|
||||
:arg builder: The Gtk builder."""
|
||||
|
||||
logging.debug("Setting up the toolbox...")
|
||||
|
||||
self.parent = parent
|
||||
self.builder = builder
|
||||
|
||||
self.tools = builder.get_object("tools")
|
||||
|
||||
self.dx_cluster = DXCluster(self.parent)
|
||||
self.tools.insert_page(self.dx_cluster, Gtk.Label("DX Cluster"), 0)
|
||||
self.grey_line = GreyLine(self.parent)
|
||||
self.tools.insert_page(self.grey_line, Gtk.Label("Grey Line"), 1)
|
||||
#self.awards = Awards(self.parent)
|
||||
#self.tools.insert_page(self.awards, Gtk.Label("Awards"), 2)
|
||||
self.tools = self.builder.get_object("tools")
|
||||
|
||||
self.dx_cluster = DXCluster(self.parent, self.builder)
|
||||
self.grey_line = GreyLine(self.parent, self.builder)
|
||||
#self.awards = Awards(self.parent, self.builder)
|
||||
|
||||
self.tools.connect_after("switch-page", self._on_switch_page)
|
||||
|
||||
logging.debug("Toolbox ready!")
|
||||
|
|
Ładowanie…
Reference in New Issue