Skip to content

Commit

Permalink
Merge pull request #48 from tobias47n9e/master
Browse files Browse the repository at this point in the history
GSettings schema and dialog
  • Loading branch information
tobias47n9e committed Aug 2, 2015
2 parents 95c6587 + f1468ea commit 2172ca8
Show file tree
Hide file tree
Showing 5 changed files with 429 additions and 26 deletions.
26 changes: 26 additions & 0 deletions data/org.gtk.innstereo.gschema.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema id="org.gtk.innstereo" path="/org/gtk/innstereo/">
<key type="b" name="draw-grid">
<default>true</default>
<summary>Draw stereonet grid</summary>
<description>This sets whether the stereonet-grid should be drawn.</description>
</key>
<key type="b" name="stereonet-projection">
<default>true</default>
<summary>Equal area or equal angle projection</summary>
<description>True = equal area. False = equal angle.</description>
</key>
<key type="b" name="show-legend">
<default>true</default>
<summary>Display a legend by default</summary>
<description>True means that a legend will be drawn by default.</description>
</key>
<key type="b" name="center-cross">
<default>true</default>
<summary>Center stereonet cross</summary>
<description>When True a cross is displayed at the center of the stereonet.</description>
</key>
</schema>
</schemalist>

316 changes: 291 additions & 25 deletions innstereo/gui_layout.glade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3
<!-- Generated with glade 3.19.0
InnStereo - An open source stereographic projection program used for geology
Copyright (C)
Expand Down Expand Up @@ -3217,30 +3217,6 @@ customizable grid.</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">3</property>
Expand Down Expand Up @@ -4615,6 +4591,20 @@ customizable grid.</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="toolbutton_settings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Settings</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-justify-fill</property>
<signal name="clicked" handler="on_toolbutton_settings_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<style>
<class name="Gtk.STYLE_CLASS_PRIMARY_TOOLBAR"/>
</style>
Expand Down Expand Up @@ -5038,4 +5028,280 @@ customizable grid.</property>
</object>
</child>
</object>
<object class="GtkApplicationWindow" id="settings_window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">InnStereo Settings</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">600</property>
<property name="default_height">250</property>
<signal name="destroy" handler="on_settings_window_destroy" swapped="no"/>
<child>
<object class="GtkBox" id="box10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<child>
<object class="GtkLabel" id="label75">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">10</property>
<property name="label" translatable="yes">&lt;b&gt;Stereonet Projection&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton_def_area">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="margin_left">30</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_radiobutton_def_area_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton_def_angle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="margin_left">30</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radiobutton_def_area</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label76">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">&lt;b&gt;Equal Area&lt;/b&gt;
Uses a Lambert Azimuthal Equal-Area Projection or Schmidt Net.</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label77">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">&lt;b&gt;Equal Angle&lt;/b&gt;
Uses a Stereographic Projection or Wulff Net.</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label78">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="label" translatable="yes">&lt;b&gt;Stereonet Grid&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="switch_def_grid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="margin_left">30</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="state-set" handler="on_switch_def_grid_state_set" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label79">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">&lt;b&gt;Show Grid&lt;/b&gt;
Will display a grid in the background of the stereonet.</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="switch_def_cross">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="margin_left">30</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="state-set" handler="on_switch_def_cross_state_set" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label80">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">&lt;b&gt;Center Cross&lt;/b&gt;
A cross will be shown in the center of the stereonet.</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label81">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="label" translatable="yes">&lt;b&gt;Legend&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="switch_def_legend">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="margin_left">30</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="state-set" handler="on_switch_def_legend_state_set" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label82">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">&lt;b&gt;Show Legend&lt;/b&gt;
Will generate an automatic legend on the project canvas.</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">7</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
10 changes: 10 additions & 0 deletions innstereo/main_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from .file_parser import FileParseDialog
from .rotation_dialog import RotationDialog
from .viridis import viridis
from .settings import AppSettings

from .i18n import i18n

Expand Down Expand Up @@ -554,6 +555,15 @@ def change_night_mode(self):
Gtk.Settings.get_default().set_property("gtk-application-prefer-dark-theme", state)
self.main_window.show_all()

def on_toolbutton_settings_clicked(self, toolbutton):
"""
Opens the window where the GSettings can be set for Innstereo.
An instance of the window is created and then displayed.
"""
set_win = AppSettings(self.main_window)
set_win.run()

def on_toolbutton_eigenvector_clicked(self, widget):
# pylint: disable=unused-argument
"""
Expand Down

0 comments on commit 2172ca8

Please sign in to comment.