[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 11/16: grc: added param to set per-flow-gra
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 11/16: grc: added param to set per-flow-graph QT-theme file |
Date: |
Sat, 3 Oct 2015 19:14:12 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit bd97903e06da8a4f7fee8d9cd7a7644f55f46215
Author: Glenn Richardson <address@hidden>
Date: Mon Aug 31 23:13:04 2015 -0400
grc: added param to set per-flow-graph QT-theme file
---
grc/blocks/options.xml | 19 +++++++++++++++++--
grc/gui/Param.py | 11 +++++++++--
grc/python/flow_graph.tmpl | 18 ++++++++++++++++++
3 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml
index 34822f1..09cc74d 100644
--- a/grc/blocks/options.xml
+++ b/grc/blocks/options.xml
@@ -163,6 +163,23 @@ part#slurp
</option>
</param>
<param>
+ <name>QSS Theme</name>
+ <key>qt_qss_theme</key>
+ <value></value>
+ <type>file_open</type>
+ <hide>
+#if $generate_options() in ('qt_gui',)
+ #if $qt_qss_theme()
+ none
+ #else
+ part
+ #end if
+#else
+ all
+#end if
+</hide>
+ </param>
+ <param>
<name>Thread-safe setters</name>
<key>thread_safe_setters</key>
<value></value>
@@ -218,7 +235,5 @@ To put hier blocks into the root category, enter / for the
category.
The Max Number of Output is the maximum number of output items allowed for any
block \
in the flowgraph; to disable this set the max_nouts equal to 0.\
Use this to adjust the maximum latency a flowgraph can exhibit.
-
-
</doc>
</block>
diff --git a/grc/gui/Param.py b/grc/gui/Param.py
index b9436ab..ca0a8c6 100644
--- a/grc/gui/Param.py
+++ b/grc/gui/Param.py
@@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA
import Utils
from Element import Element
-from . Constants import PARAM_FONT
+from . Constants import PARAM_FONT, GR_PREFIX
import pygtk
pygtk.require('2.0')
import gtk
@@ -233,7 +233,14 @@ class FileParam(EntryParam):
#get the paths
file_path = self.param.is_valid() and self.param.get_evaluated() or ''
(dirname, basename) = os.path.isfile(file_path) and
os.path.split(file_path) or (file_path, '')
- if not os.path.exists(dirname): dirname = os.getcwd() #fix bad paths
+ # check for qss theme default directory
+ if self.param.get_key() == 'qt_qss_theme':
+ dirname = os.path.dirname(dirname) # trim filename
+ if not os.path.exists(dirname):
+ dirname = os.path.join(GR_PREFIX, '/share/gnuradio/themes')
+ if not os.path.exists(dirname):
+ dirname = os.getcwd() # fix bad paths
+
#build the dialog
if self.param.get_type() == 'file_open':
file_dialog = gtk.FileChooserDialog('Open a Data File...', None,
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index 52f4902..72891b7 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -53,6 +53,9 @@ if __name__ == '__main__':
########################################################
##Create Imports
########################################################
+#if $flow_graph.get_option('qt_qss_theme')
+#set imports = $sorted(set($imports + ["import os", "import sys"]))
+#end if
#if any(imp.endswith("# grc-generated hier_block") for imp in $imports)
import os
import sys
@@ -267,6 +270,18 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(',
'.join($size_strs))])
self.settings = Qt.QSettings("GNU Radio", "$class_name")
self.settings.setValue("geometry", self.saveGeometry())
event.accept()
+
+ #if $flow_graph.get_option('qt_qss_theme')
+ def setStyleSheetFromFile(self, filename):
+ try:
+ if not os.path.exists(filename):
+ filename = os.path.join(
+ gr.prefix(), "share", "gnuradio", "themes", filename)
+ with open(filename) as ss:
+ tb.setStyleSheet('1' + ss.read())
+ except Exception as e:
+ print >> sys.stderr, e
+ #end if
#end if
########################################################
##Create Callbacks
@@ -367,6 +382,9 @@ def main(top_block_cls=$(class_name), options=None):
tb.start()
#end if
#end if
+ #if $flow_graph.get_option('qt_qss_theme')
+ tb.setStyleSheetFromFile($repr($flow_graph.get_option('qt_qss_theme')))
+ #end if
tb.show()
def quitting():
- [Commit-gnuradio] [gnuradio] branch master updated (222e000 -> 0f9b29a), git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 04/16: gr-dtv: check for SSE2 support, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 14/16: Merge remote-tracking branch 'mbr0wn/uhd/multi_uhd_fft', git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 12/16: Merge branch 'maint', git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 07/16: grc: per-flowgraph custom run commands, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 03/16: uhd: uhd_fft now uses UHDApp, some bugfixes, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 10/16: grc: simple dialog for selecting QSS theme for QT GUI apps, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 16/16: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 11/16: grc: added param to set per-flow-graph QT-theme file,
git <=
- [Commit-gnuradio] [gnuradio] 01/16: grc: Flowgraph complexity. Shows under options block when enabled., git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 02/16: grc: pad comment boxes like blocks, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 06/16: grc: add File->New submenu with generate modes preset, Bar.py refactoring, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 08/16: grc: move generated start-up code into main(), whitespace fixes in generated code, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 13/16: Merge branch 'maint', git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 09/16: grc: flowgraph template: split arg parser from main(), git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 05/16: grc: fixup Actions*.py, git, 2015/10/08
- [Commit-gnuradio] [gnuradio] 15/16: Merge remote-tracking branch 'pinkavaj/no-x86-dtv-fix-00', git, 2015/10/08