Added way to change application display from narrow to wide layout

This commit is contained in:
Mark J. Fine 2022-12-21 22:28:29 -05:00
parent 1679eda1c5
commit 69057f967a
4 changed files with 5065 additions and 73 deletions

View File

@ -35,7 +35,8 @@ else:
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject, Gdk, GdkPixbuf, GLib
gi.require_version("Notify", "0.7")
from gi.repository import Gtk, GObject, Gdk, GdkPixbuf, GLib, Notify
import urllib3
from OpenSSL import SSL
@ -310,6 +311,19 @@ class NRSC5_DUI(object):
self.lblExtend.set_sensitive(dlCoversSet)
self.cbExtend.set_sensitive(dlCoversSet)
def restart_program(self):
python = sys.executable
os.execl(python, python, * sys.argv)
def on_cbxAspect_changed(self, btn):
screenAspect = self.cbxAspect.get_active_text()
if (screenAspect == "narrow") or (screenAspect == "wide"):
mainFile = os.path.join(resDir, "mainForm.glade")
gladeFile = os.path.join(resDir, "mainForm-"+screenAspect+".glade")
if (os.path.isfile(gladeFile)):
shutil.copy(gladeFile,mainFile)
self.restart_program()
def on_cbxSDRRadio_changed(self, btn):
useSDRPlay = (self.cbxSDRRadio.get_active_text() == "SDRPlay")
self.lblSdrPlaySer.set_visible(useSDRPlay)
@ -654,6 +668,7 @@ class NRSC5_DUI(object):
# disable the controls
self.spinFreq.set_sensitive(False)
self.cbxAspect.ser_sensitive(False)
self.cbxSDRRadio.set_sensitive(False)
self.spinGain.set_sensitive(False)
self.spinPPM.set_sensitive(False)
@ -718,6 +733,7 @@ class NRSC5_DUI(object):
if (not self.cbAutoGain.get_active()):
self.spinGain.set_sensitive(True)
self.spinFreq.set_sensitive(True)
self.cbxAspect.set_sensitive(True)
self.cbxSDRRadio.set_sensitive(True)
self.spinPPM.set_sensitive(True)
self.spinRTL.set_sensitive(True)
@ -795,7 +811,7 @@ class NRSC5_DUI(object):
authors = [
"Cody Nybo <cmnybo@gmail.com>",
"Clayton Smith <argilo@gmail.com>",
"nefie <zefie@zefie.net>",
"zefie <zefie@zefie.net>",
"Mark J. Fine <mark.fine@fineware-swl.com>"
]
@ -1565,7 +1581,7 @@ class NRSC5_DUI(object):
# match Open device failed
self.on_btnStop_clicked(None)
self.set_synchronization(-1)
def getControls(self):
global resDir
# setup gui
@ -1589,6 +1605,7 @@ class NRSC5_DUI(object):
self.alignmentMap = builder.get_object("alignment_map")
self.imgMap = builder.get_object("imgMap")
self.spinFreq = builder.get_object("spinFreq")
self.cbxAspect = builder.get_object("cbxAspect")
self.cbxSDRRadio = builder.get_object("cbxSDRRadio")
self.spinGain = builder.get_object("spinGain")
self.cbAutoGain = builder.get_object("cbAutoGain")

2454
res/mainForm-narrow.glade Normal file

File diff suppressed because it is too large Load Diff

2464
res/mainForm-wide.glade Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1341,7 +1341,7 @@
<object class="GtkTable" id="tableSettings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">11</property>
<property name="n_rows">12</property>
<property name="n_columns">3</property>
<property name="column_spacing">10</property>
<property name="row_spacing">3</property>
@ -1354,6 +1354,57 @@
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="lblAspect">
<property name="visible">True</property>
<property name="sensitive">True</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
<property name="label" translatable="yes">Aspect ratio:</property>
<property name="justify">right</property>
<property name="single_line_mode">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="cbxAspect">
<property name="visible">True</property>
<property name="sensitive">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Choose display style</property>
<property name="has_entry">False</property>
<property name="active">0</property>
<signal name="changed" handler="on_cbxAspect_changed" swapped="no"/>
<items>
<item translatable="yes" id="aspectnull">no change</item>
<item translatable="yes" id="aspectnarrow">narrow</item>
<item translatable="yes" id="aspectwidw">wide</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label14e">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="single_line_mode">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblSDRRadio">
<property name="visible">True</property>
@ -1368,25 +1419,29 @@
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="cbxSDRRadio">
<property name="visible">True</property>
<property name="sensitive">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Choose SDR device</property>
<property name="has_entry">False</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Choose SDR device</property>
<property name="has_entry">False</property>
<property name="active">0</property>
<signal name="changed" handler="on_cbxSDRRadio_changed" swapped="no"/>
<items>
<item translatable="yes" id="rcvrRTL-SDR">RTL-SDR</item>
<item translatable="yes" id="rcvrRTL-SDR">RTL-SDR</item>
<item translatable="yes" id="rcvrSDRPlay">SDRPlay</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1400,6 +1455,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1415,8 +1472,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1438,8 +1495,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1459,8 +1516,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1476,8 +1533,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1498,8 +1555,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1516,8 +1573,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1534,8 +1591,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1557,8 +1614,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1572,8 +1629,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1590,8 +1647,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1608,8 +1665,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1628,8 +1685,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1646,8 +1703,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1664,8 +1721,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1679,8 +1736,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1697,8 +1754,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1707,13 +1764,13 @@
<object class="GtkComboBoxText" id="cbxSDRPlayAnt">
<property name="visible">False</property>
<property name="sensitive">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Choose SDRPlay antenna</property>
<property name="has_entry">False</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Choose SDRPlay antenna</property>
<property name="has_entry">False</property>
<property name="active">0</property>
<items>
<item translatable="yes" id="antAuto">Auto</item>
<item translatable="yes" id="antA">A</item>
<item translatable="yes" id="antAuto">Auto</item>
<item translatable="yes" id="antA">A</item>
<item translatable="yes" id="antB">B</item>
<item translatable="yes" id="antC">C</item>
</items>
@ -1721,8 +1778,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1736,8 +1793,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1753,8 +1810,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1772,8 +1829,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1786,8 +1843,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1803,8 +1860,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1823,8 +1880,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1837,8 +1894,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1855,8 +1912,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1875,8 +1932,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1889,8 +1946,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1907,8 +1964,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1927,8 +1984,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1941,8 +1998,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>