[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/13: grc: add default value to ToggleActi
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/13: grc: add default value to ToggleActions |
Date: |
Fri, 24 Jul 2015 15:33:48 +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 be46a6c25b0a77c6d0141e9e958f302cac51943f
Author: Sebastian Koslowski <address@hidden>
Date: Fri Jul 17 10:01:04 2015 +0200
grc: add default value to ToggleActions
---
grc/gui/Actions.py | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index a028a33..cfb72d3 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -106,7 +106,8 @@ class Action(gtk.Action, _ActionBase):
Pass additional arguments such as keypresses.
"""
- def __init__(self, keypresses=(), name=None, label=None, tooltip=None,
stock_id=None):
+ def __init__(self, keypresses=(), name=None, label=None, tooltip=None,
+ stock_id=None):
"""
Create a new Action instance.
@@ -129,7 +130,8 @@ class ToggleAction(gtk.ToggleAction, _ActionBase):
Pass additional arguments such as keypresses.
"""
- def __init__(self, keypresses=(), name=None, label=None, tooltip=None,
stock_id=None, preference_name=None):
+ def __init__(self, keypresses=(), name=None, label=None, tooltip=None,
+ stock_id=None, preference_name=None, default=True):
"""
Create a new ToggleAction instance.
@@ -137,22 +139,24 @@ class ToggleAction(gtk.ToggleAction, _ActionBase):
key_presses: a tuple of (keyval1, mod_mask1, keyval2, mod_mask2,
...)
the: regular gtk.Action parameters (defaults to None)
"""
- if name is None: name = label
+ if name is None:
+ name = label
gtk.ToggleAction.__init__(self,
- name=name, label=label,
- tooltip=tooltip, stock_id=stock_id,
+ name=name, label=label, tooltip=tooltip, stock_id=stock_id,
)
- #register this action
_ActionBase.__init__(self, label, keypresses)
self.preference_name = preference_name
+ self.default = default
def load_from_preferences(self):
if self.preference_name is not None:
- self.set_active(Preferences.bool_entry(self.preference_name))
+ self.set_active(Preferences.bool_entry(self.preference_name,
+ default=self.default))
def save_to_preferences(self):
if self.preference_name is not None:
- Preferences.bool_entry(self.preference_name, self.get_active())
+ Preferences.bool_entry(self.preference_name,
+ value=self.get_active())
########################################################################
# Actions
- [Commit-gnuradio] [gnuradio] branch master updated (cc973de -> 65d6523), git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 12/13: Merge branch 'maint', git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 13/13: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 06/13: grc: align default flowgraph block with canvas grid, git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 11/13: grc: clean-up Block port counters, git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 02/13: grc: show preview of generated code in each blocks properties dialog, git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 07/13: grc: fix bus ports spacing in gui, git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 03/13: grc: add default value to ToggleActions,
git <=
- [Commit-gnuradio] [gnuradio] 04/13: grc: only show code preview tab after user enables it, git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 01/13: grc: refactor Preferences.py, git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 05/13: grc: add user settings for canvas default size and canvas font size (+ clean-ups), git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 08/13: grc: add QT GUI hier blocks (#727), git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 09/13: grc: add support for dynamic param names, git, 2015/07/24
- [Commit-gnuradio] [gnuradio] 10/13: grc: add struct variable block, git, 2015/07/24