kopia lustrzana https://github.com/ctjacobs/pyqso
- Added a frame to place amateur radio related tools.
- Added a grey line plot. Note that this requires an extra dependency (netcdf-python). Note also that the backend to matplotlib needs to be updated to work with PyGTK3.pull/17/head
rodzic
e9b73d6985
commit
0f242f3d20
10
bin/pyqso
10
bin/pyqso
|
@ -35,7 +35,7 @@ from pyqso.adif import *
|
|||
from pyqso.logbook import *
|
||||
from pyqso.menu import *
|
||||
from pyqso.toolbar import *
|
||||
from pyqso.dx_cluster import *
|
||||
from pyqso.toolbox import *
|
||||
|
||||
class PyQSO(Gtk.Window):
|
||||
|
||||
|
@ -68,7 +68,7 @@ class PyQSO(Gtk.Window):
|
|||
self.logbook = Logbook(self)
|
||||
self.logbook.set_scrollable(True)
|
||||
|
||||
self.dx_cluster = DXCluster(self)
|
||||
self.toolbox = Toolbox(self)
|
||||
|
||||
# Set up menu and tool bars
|
||||
# These classes depend on the Logbook class,
|
||||
|
@ -82,13 +82,13 @@ class PyQSO(Gtk.Window):
|
|||
vbox_outer.pack_start(self.menu, False, False, 0)
|
||||
vbox_outer.pack_start(self.toolbar, False, False, 0)
|
||||
vbox_outer.pack_start(self.logbook, True, True, 0)
|
||||
vbox_outer.pack_start(self.dx_cluster, True, True, 0)
|
||||
vbox_outer.pack_start(self.toolbox, True, True, 0)
|
||||
vbox_outer.pack_start(self.statusbar, False, False, 0)
|
||||
|
||||
self.show_all()
|
||||
|
||||
# Hide the DX cluster by default
|
||||
self.dx_cluster.toggle_visible_callback()
|
||||
# Hide the Toolbox by default
|
||||
self.toolbox.toggle_visible_callback()
|
||||
|
||||
return
|
||||
|
||||
|
|
|
@ -27,26 +27,17 @@ import telnetlib
|
|||
|
||||
from pyqso.telnet_connection_dialog import *
|
||||
|
||||
# This will help Python find the PyQSO modules
|
||||
# that need to be imported below.
|
||||
pyqso_path = os.path.join(os.path.realpath(os.path.dirname(__file__)), os.pardir)
|
||||
sys.path.insert(0, pyqso_path)
|
||||
|
||||
class DXCluster(Gtk.Frame):
|
||||
class DXCluster(Gtk.VBox):
|
||||
|
||||
def __init__(self, root_window):
|
||||
|
||||
Gtk.Frame.__init__(self)
|
||||
label = Gtk.Label("DX Cluster")
|
||||
self.set_label_widget(label)
|
||||
Gtk.VBox.__init__(self, spacing=2)
|
||||
|
||||
self.check_io_event = GObject.timeout_add(1000, self.on_telnet_io)
|
||||
|
||||
self.connection = None
|
||||
self.root_window = root_window
|
||||
|
||||
vbox_inner = Gtk.VBox(spacing=2)
|
||||
|
||||
# Set up the toolbar
|
||||
self.toolbar = Gtk.HBox(spacing=2)
|
||||
self.buttons = {}
|
||||
|
@ -78,7 +69,7 @@ class DXCluster(Gtk.Frame):
|
|||
self.send.connect("clicked", self.telnet_send_command)
|
||||
self.toolbar.pack_start(self.send, False, False, 0)
|
||||
|
||||
vbox_inner.pack_start(self.toolbar, False, False, 0)
|
||||
self.pack_start(self.toolbar, False, False, 0)
|
||||
|
||||
# A TextView object to display the output from the Telnet server.
|
||||
self.renderer = Gtk.TextView()
|
||||
|
@ -89,9 +80,7 @@ class DXCluster(Gtk.Frame):
|
|||
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
sw.add(self.renderer)
|
||||
self.buffer = self.renderer.get_buffer()
|
||||
vbox_inner.pack_start(sw, True, True, 0)
|
||||
|
||||
self.add(vbox_inner)
|
||||
self.pack_start(sw, True, True, 0)
|
||||
|
||||
self.set_connect_button_sensitive(True)
|
||||
|
||||
|
@ -184,7 +173,3 @@ class DXCluster(Gtk.Frame):
|
|||
self.send.set_sensitive(not sensitive)
|
||||
return
|
||||
|
||||
def toggle_visible_callback(self, widget=None):
|
||||
self.set_visible(not self.get_visible())
|
||||
return
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env python
|
||||
# File: grey_line.py
|
||||
|
||||
# Copyright (C) 2013 Christian 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/>.
|
||||
|
||||
from gi.repository import Gtk, GObject
|
||||
import logging
|
||||
import numpy
|
||||
from mpl_toolkits.basemap import Basemap
|
||||
from datetime import datetime
|
||||
from matplotlib.figure import Figure
|
||||
from backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
|
||||
|
||||
class GreyLine(Gtk.VBox):
|
||||
|
||||
def __init__(self, root_window):
|
||||
|
||||
Gtk.VBox.__init__(self, spacing=2)
|
||||
|
||||
fig = Figure()
|
||||
sub = fig.add_subplot(111)
|
||||
|
||||
# Draw the map of the world. This is based on the example from:
|
||||
# http://matplotlib.org/basemap/users/examples.html
|
||||
m = Basemap(projection='mill', lon_0=0, ax=sub, resolution='c', fix_aspect=False)
|
||||
m.drawcoastlines()
|
||||
m.drawparallels(numpy.arange(-90,90,30), labels=[1,0,0,0])
|
||||
m.drawmeridians(numpy.arange(m.lonmin,m.lonmax+30,60), labels=[0,0,0,1])
|
||||
|
||||
m.drawmapboundary(fill_color='lightblue')
|
||||
m.fillcontinents(color='darkgreen', lake_color='lightblue')
|
||||
m.nightshade(datetime.utcnow()) # Add in the grey line using UTC time. Note that this requires NetCDF.
|
||||
|
||||
canvas = FigureCanvas(fig) # For embedding in the Gtk application
|
||||
self.pack_start(canvas, True, True, 0)
|
||||
|
||||
self.show_all()
|
||||
|
||||
return
|
||||
|
|
@ -168,11 +168,11 @@ class Menu(Gtk.MenuBar):
|
|||
subm_view = Gtk.Menu()
|
||||
mitem_view.set_submenu(subm_view)
|
||||
|
||||
mitem_dxcluster = Gtk.CheckMenuItem("DX Cluster")
|
||||
mitem_dxcluster.set_active(False)
|
||||
mitem_dxcluster.connect("activate", parent.dx_cluster.toggle_visible_callback)
|
||||
subm_view.append(mitem_dxcluster)
|
||||
self.items["DX_CLUSTER"] = mitem_dxcluster
|
||||
mitem_toolbox = Gtk.CheckMenuItem("Toolbox")
|
||||
mitem_toolbox.set_active(False)
|
||||
mitem_toolbox.connect("activate", parent.toolbox.toggle_visible_callback)
|
||||
subm_view.append(mitem_toolbox)
|
||||
self.items["TOOLBOX"] = mitem_toolbox
|
||||
|
||||
|
||||
###### HELP ######
|
||||
|
|
Ładowanie…
Reference in New Issue