[gnoduino] add sketchdir selection to preferences
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnoduino] add sketchdir selection to preferences
- Date: Mon, 9 Apr 2012 18:01:33 +0000 (UTC)
commit 9bcc8d9ea3ecc76ce432ebbc9a7df6b803c9b695
Author: Lucian Langa <lucilanga gnome org>
Date: Mon Apr 9 19:55:51 2012 +0200
add sketchdir selection to preferences
src/config.py | 1 +
src/prefs.py | 1 +
src/ui.py | 7 +++++++
ui/main.ui | 47 ++++++++++++++++++++++++++++++++++++++++++++---
4 files changed, 53 insertions(+), 3 deletions(-)
---
diff --git a/src/config.py b/src/config.py
index 653847c..959d22e 100644
--- a/src/config.py
+++ b/src/config.py
@@ -11,3 +11,4 @@ upload_verbose = -1
user_library = -1
serial_baud_rate = -1
show_numbers = -1
+sketchdir = -1
diff --git a/src/prefs.py b/src/prefs.py
index 6912b4d..1185fc6 100644
--- a/src/prefs.py
+++ b/src/prefs.py
@@ -42,6 +42,7 @@ config_keys = [
[ "console.font", "/apps/gnoduino/console_font", "string", "Monospace,10" ],
[ "build.verbose", "/apps/gnoduino/build_verbose", "string", "false" ],
[ "upload.verbose", "/apps/gnoduino/upload_verbose", "string", "false" ],
+[ "sketchbook.path", "/apps/gnoduino/sketchbook_path", "string", "false" ],
[ "show.numbers", "/apps/gnoduino/show_numbers", "string", "false" ]]
class preferences(object):
diff --git a/src/ui.py b/src/ui.py
index 943fbc0..2a31441 100644
--- a/src/ui.py
+++ b/src/ui.py
@@ -298,6 +298,7 @@ def preferences(widget, data=None):
uv = gui.get_object("upload.verbose")
sn = gui.get_object("show.numbers")
ul = gui.get_object("user.library")
+ sd = gui.get_object("sketchdir")
p = prefs.preferences()
fe.set_font_name(misc.merge_font_name(fe, config.cur_editor_font))
fc.set_font_name(misc.merge_font_name(fc, config.cur_console_font))
@@ -329,6 +330,11 @@ def preferences(widget, data=None):
ul.set_text(str(config.user_library))
else:
ul.set_text(str(p.getSafeValue("user.library", "")))
+
+ if (config.sketchdir != None and config.sketchdir != -1):
+ sd.set_filename(str(config.sketchdir))
+ else:
+ sd.set_filename(str(p.getSafeValue("sketchbook.path", "")))
r = pref.run()
if r == 1:
config.cur_editor_font = fe.get_font_name()
@@ -358,6 +364,7 @@ def preferences(widget, data=None):
else:
sv.set_show_line_numbers(False)
p.setValue("user.library", config.user_library)
+ p.setValue("sketchbook.path", sd.get_filename())
p.saveValues()
misc.set_widget_font(tw, config.cur_console_font)
misc.set_widget_font(sctw, config.cur_console_font)
diff --git a/ui/main.ui b/ui/main.ui
index 407c254..e9131ce 100644
--- a/ui/main.ui
+++ b/ui/main.ui
@@ -418,6 +418,9 @@ Pascal de Bruijn <pmjdebruijn pcode nl></property>
</packing>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -429,6 +432,7 @@ Pascal de Bruijn <pmjdebruijn pcode nl></property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -438,24 +442,61 @@ Pascal de Bruijn <pmjdebruijn pcode nl></property>
</packing>
</child>
<child>
+ <object class="GtkVBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Sketchdir: </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFileChooserButton" id="sketchdir">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="action">select-folder</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Enter any supplementary path that compiler will check for, separate them by semicolons. (eg /usr/share/gnoduino;/usr/local/share/gnoduino)</property>
<property name="tooltip_text" translatable="yes">Enter any supplementary path that compiler will check for, separate them by semicolons. (eg /usr/share/gnoduino;/usr/local/share/gnoduino)</property>
<property name="label" translatable="yes">Additional library paths:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
@@ -469,7 +510,7 @@ Pascal de Bruijn <pmjdebruijn pcode nl></property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]