[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 04/06: grc: move font size definition in Co
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 04/06: grc: move font size definition in Constants.py |
Date: |
Wed, 1 Oct 2014 19:33:00 +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 2563650388b4fe61349803131763818e515e36d6
Author: Sebastian Koslowski <address@hidden>
Date: Thu Sep 18 14:03:49 2014 -0400
grc: move font size definition in Constants.py
---
grc/gui/Block.py | 10 ++++++----
grc/gui/Constants.py | 7 +++++++
grc/gui/Param.py | 5 +++--
grc/gui/Port.py | 8 +++-----
4 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 0ae624f..70496ac 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -25,7 +25,7 @@ from Constants import BORDER_PROXIMITY_SENSITIVITY
from Constants import \
BLOCK_LABEL_PADDING, \
PORT_SEPARATION, LABEL_SEPARATION, \
- PORT_BORDER_SEPARATION, POSSIBLE_ROTATIONS
+ PORT_BORDER_SEPARATION, POSSIBLE_ROTATIONS, BLOCK_FONT, PARAM_FONT
import Actions
import pygtk
pygtk.require('2.0')
@@ -34,7 +34,7 @@ import pango
BLOCK_MARKUP_TMPL="""\
#set $foreground = $block.is_valid() and 'black' or 'red'
-<span foreground="$foreground" font_desc="Sans
8"><b>$encode($block.get_name())</b></span>"""
+<span foreground="$foreground"
font_desc="$font"><b>$encode($block.get_name())</b></span>"""
class Block(Element):
"""The graphical signal block."""
@@ -146,11 +146,13 @@ class Block(Element):
#create the main layout
layout = gtk.DrawingArea().create_pango_layout('')
layouts.append(layout)
- layout.set_markup(Utils.parse_template(BLOCK_MARKUP_TMPL, block=self))
+ layout.set_markup(Utils.parse_template(BLOCK_MARKUP_TMPL, block=self,
font=BLOCK_FONT))
self.label_width, self.label_height = layout.get_pixel_size()
#display the params
if self.is_dummy_block():
- markups = ['<span foreground="black" font_desc="Sans 7.5"><b>key:
</b>{}</span>'.format(self._key)]
+ markups = [
+ '<span foreground="black" font_desc="$font"><b>key:
</b>{key}</span>'.format(font=PARAM_FONT, key=self._key)
+ ]
else:
markups = [param.get_markup() for param in self.get_params() if
param.get_hide() not in ('all', 'part')]
if markups:
diff --git a/grc/gui/Constants.py b/grc/gui/Constants.py
index 7db291d..0dc6279 100644
--- a/grc/gui/Constants.py
+++ b/grc/gui/Constants.py
@@ -41,6 +41,13 @@ MIN_DIALOG_HEIGHT = 500
##default sizes
DEFAULT_BLOCKS_WINDOW_WIDTH = 100
DEFAULT_REPORTS_WINDOW_WIDTH = 100
+## flow-graph canvas fonts
+FONT_FAMILY = "Sans"
+FONT_SIZE = 8
+BLOCK_FONT = "%s %f" % (FONT_FAMILY, FONT_SIZE)
+PORT_FONT = BLOCK_FONT
+PARAM_FONT = "%s %f" % (FONT_FAMILY, FONT_SIZE - 0.5)
+
##The size of the state saving cache in the flow graph (for undo/redo
functionality)
STATE_CACHE_SIZE = 42
diff --git a/grc/gui/Param.py b/grc/gui/Param.py
index 499af2e..76dafdf 100644
--- a/grc/gui/Param.py
+++ b/grc/gui/Param.py
@@ -19,6 +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
import pygtk
pygtk.require('2.0')
import gtk
@@ -184,7 +185,7 @@ class FileParam(EntryParam):
PARAM_MARKUP_TMPL="""\
#set $foreground = $param.is_valid() and 'black' or 'red'
-<span foreground="$foreground" font_desc="Sans
7.5"><b>$encode($param.get_name()): </b>$encode(repr($param))</span>"""
+<span foreground="$foreground"
font_desc="$font"><b>$encode($param.get_name()):
</b>$encode(repr($param))</span>"""
PARAM_LABEL_MARKUP_TMPL="""\
#set $foreground = $modified and 'blue' or $param.is_valid() and 'black' or
'red'
@@ -249,4 +250,4 @@ class Param(Element):
Returns:
a pango markup string
"""
- return Utils.parse_template(PARAM_MARKUP_TMPL, param=self)
+ return Utils.parse_template(PARAM_MARKUP_TMPL, param=self,
font=PARAM_FONT)
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
index 188281a..fdd2934 100644
--- a/grc/gui/Port.py
+++ b/grc/gui/Port.py
@@ -21,7 +21,7 @@ from Element import Element
from Constants import \
PORT_SEPARATION, CONNECTOR_EXTENSION_MINIMAL, \
CONNECTOR_EXTENSION_INCREMENT, \
- PORT_LABEL_PADDING, PORT_MIN_WIDTH, PORT_LABEL_HIDDEN_WIDTH
+ PORT_LABEL_PADDING, PORT_MIN_WIDTH, PORT_LABEL_HIDDEN_WIDTH, PORT_FONT
import Utils
import Actions
import Colors
@@ -29,10 +29,8 @@ import pygtk
pygtk.require('2.0')
import gtk
-PORT_HIDDEN_MARKUP_TMPL="""\
-<span foreground="black" font_desc="Sans 7.5"> </span>"""
PORT_MARKUP_TMPL="""\
-<span foreground="black" font_desc="Sans
7.5">$encode($port.get_name())</span>"""
+<span foreground="black" font_desc="$font">$encode($port.get_name())</span>"""
class Port(Element):
@@ -110,7 +108,7 @@ class Port(Element):
self._bg_color = Colors.get_color(self.get_color())
#create the layout
layout = gtk.DrawingArea().create_pango_layout('')
- layout.set_markup(Utils.parse_template(PORT_MARKUP_TMPL, port=self))
+ layout.set_markup(Utils.parse_template(PORT_MARKUP_TMPL, port=self,
font=PORT_FONT))
self.w, self.h = layout.get_pixel_size()
self.W, self.H = 2*PORT_LABEL_PADDING + self.w,
2*PORT_LABEL_PADDING+self.h
self.H = self.modify_height(self.H)
- [Commit-gnuradio] [gnuradio] branch master updated (029079c -> d598e49), git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 05/06: Merge branch 'maint', git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 06/06: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 04/06: grc: move font size definition in Constants.py,
git <=
- [Commit-gnuradio] [gnuradio] 01/06: grc: making qt-gui the default (Feature #634), git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 03/06: grc: switch timestamp in grc files from modified to created, git, 2014/10/01
- [Commit-gnuradio] [gnuradio] 02/06: grc: show fg return code if not 0 (Bug #726), git, 2014/10/01