Skip to content

Commit

Permalink
Merge pull request #43 from tobias47n9e/master
Browse files Browse the repository at this point in the history
Merge Angelier-plots, style-defaults, 2 strings for i18n
  • Loading branch information
tobias47n9e committed Jul 28, 2015
2 parents 1c2ad7e + bb131bd commit a283456
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 48 deletions.
125 changes: 100 additions & 25 deletions innstereo/gui_layout.glade
Original file line number Diff line number Diff line change
Expand Up @@ -3125,35 +3125,122 @@ customizable grid.</property>
<property name="margin_top">10</property>
<property name="margin_bottom">5</property>
<child>
<object class="GtkCheckButton" id="checkbutton_hoeppener">
<property name="label" translatable="yes">Draw Hoeppener Arrows</property>
<object class="GtkLabel" id="label56">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_checkbutton_hoeppener_toggled" swapped="no"/>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Draw Angelier</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton_lp_plane">
<property name="label" translatable="yes">Draw Linear-Pole-Plane</property>
<object class="GtkSwitch" id="switch_draw_angelier">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_checkbutton_lp_plane_toggled" swapped="no"/>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="state-set" handler="on_switch_draw_angelier_state_set" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label72">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Draw Hoeppener</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="switch_draw_hoeppene">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_left">6</property>
<property name="margin_right">9</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="state-set" handler="on_switch_draw_hoeppene_state_set" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label73">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">9</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Draw Hoeppener Linear-Pole-Plane</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="switch_draw_lp_plane">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="state-set" handler="on_switch_draw_lp_plane_state_set" swapped="no"/>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">1</property>
</packing>
</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>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">3</property>
Expand Down Expand Up @@ -3894,18 +3981,6 @@ customizable grid.</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">5</property>
Expand Down
4 changes: 3 additions & 1 deletion innstereo/i18n.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/python3

#==============================================================================#
# InnStereo #
# #
Expand Down Expand Up @@ -76,4 +78,4 @@ def language(self):

def get_ts_domain(self):
return self.app_name


47 changes: 29 additions & 18 deletions innstereo/layer_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,15 @@ def load_fault_properties(self):
current settings from the active layer and applies these settings to
the interface.
"""
self.checkbutton_hoeppener = \
self.builder.get_object("checkbutton_hoeppener")
self.checkbutton_lp_plane = \
self.builder.get_object("checkbutton_lp_plane")
self.checkbutton_hoeppener.set_active(self.layer.get_draw_hoeppener())
self.checkbutton_lp_plane.set_active(self.layer.get_draw_lp_plane())
self.switch_draw_hoeppene = \
self.builder.get_object("switch_draw_hoeppene")
self.switch_draw_angelier = \
self.builder.get_object("switch_draw_angelier")
self.switch_draw_lp_plane = \
self.builder.get_object("switch_draw_lp_plane")
self.switch_draw_hoeppene.set_active(self.layer.get_draw_hoeppener())
self.switch_draw_angelier.set_active(self.layer.get_draw_angelier())
self.switch_draw_lp_plane.set_active(self.layer.get_draw_lp_plane())

def load_contour_properties(self):
"""
Expand Down Expand Up @@ -779,27 +782,35 @@ def on_colorbutton_contour_line_color_color_set(self, colorbutton):
self.changes.append(
lambda: self.layer.set_contour_line_color(new_color))

def on_checkbutton_lp_plane_toggled(self, checkbutton):
def on_switch_draw_lp_plane_state_set(self, switch, state):
"""
Queues up a new state for the linear-pole-plane checkbutton.
Queues up a new state for the linear-pole-plane switch.
Triggered when a new state for the linear-pole-plane checkbutton
is set. Gets the new state and queues it up in the list of changes.
Triggered when a new state for the linear-pole-plane switch
is set. Queues it up in the list of changes.
"""
draw_lp_plane = checkbutton.get_active()
self.changes.append(
lambda: self.layer.set_draw_lp_plane(draw_lp_plane))
lambda: self.layer.set_draw_lp_plane(state))

def on_checkbutton_hoeppener_toggled(self, checkbutton):
def on_switch_draw_hoeppene_state_set(self, switch, state):
"""
Queues up a new state for the draw Hoeppener checkbutton.
Queues up a new state for the draw Hoeppener switch.
Triggered when a new state for the Hoeppener checkbutton
is set. Gets the new state and queues it up in the list of changes.
Triggered when a new state for the Hoeppener switch
is set. Queues it up in the list of changes.
"""
draw_hoeppener = checkbutton.get_active()
self.changes.append(
lambda: self.layer.set_draw_hoeppener(draw_hoeppener))
lambda: self.layer.set_draw_hoeppener(state))

def on_switch_draw_angelier_state_set(self, switch, state):
"""
Queues up a new state for the draw Angelier switch.
Triggered when a new state for the Anglier switch
is set. Queues it up in the list of changes.
"""
self.changes.append(
lambda: self.layer.set_draw_angelier(state))

def on_switch_manual_range_state_set(self, switch, state):
"""
Expand Down
46 changes: 42 additions & 4 deletions innstereo/layer_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ def __init__(self, treestore, treeview):
"rose_bottom": 0,
"dip_rose_spacing": 10,
#Faultplane properties
"draw_angelier": True,
"draw_hoeppener": False,
"draw_lp_plane": False,
"arrow_color": "#d51e1e",
#Contours
"draw_contour_fills": False,
"draw_contour_lines": False,
Expand All @@ -91,6 +93,7 @@ def __init__(self, treestore, treeview):
"upper_limit": 10,
"steps": 10
}
self.props["label"] = _("Plane Layer")

def get_page(self):
"""
Expand Down Expand Up @@ -1025,6 +1028,38 @@ def set_dip_rose_spacing(self, new_steps):
"""
self.props["dip_rose_spacing"] = new_steps

def get_draw_angelier(self):
"""
Get the current state whether Angelier arrows should be drawn.
Default is False.
"""
return self.props["draw_angelier"]

def set_draw_angelier(self, new_state):
"""
Sets a new state whether Angelier arrows should be drawn.
Expects a boolean.
"""
self.props["draw_angelier"] = new_state

def get_arrow_color(self):
"""
Get the current color of the faultplane arrows.
Returns a RGP-string.
"""
return self.props["arrow_color"]

def set_arrow_color(self, new_color):
"""
Sets a new color for the faultplane arrows.
Expects a RGP-string
"""
self.props["arrow_color"] = new_color


class FaultPlaneLayer(PlaneLayer):

Expand All @@ -1045,7 +1080,9 @@ def __init__(self, treestore, treeview):
"""
PlaneLayer.__init__(self, treestore, treeview)
self.props["type"] = "faultplane"
self.props["label"] = "Faultplane layer"
self.props["label"] = _("Faultplane Layer")
self.props["line_color"] = "#000000"
self.props["marker_fill"] = "#ffffff"


class LineLayer(PlaneLayer):
Expand All @@ -1070,8 +1107,9 @@ def __init__(self, treestore, treeview):
"""
PlaneLayer.__init__(self, treestore, treeview)
self.props["type"] = "line"
self.props["label"] = _("Linear layer")
self.props["label"] = _("Linear Layer")
self.props["page"] = 1
self.props["marker_fill"] = "#69b3ff"

def get_pixbuf(self):
"""
Expand Down Expand Up @@ -1109,7 +1147,7 @@ def __init__(self, treestore, treeview):
"""
PlaneLayer.__init__(self, treestore, treeview)
self.props["type"] = "eigenvector"
self.props["label"] = _("Eigenvector layer")
self.props["label"] = _("Eigenvector Layer")
self.props["page"] = 1

def get_pixbuf(self):
Expand Down Expand Up @@ -1147,5 +1185,5 @@ def __init__(self, treestore, treeview):
"""
PlaneLayer.__init__(self, treestore, treeview)
self.props["type"] = "smallcircle"
self.props["label"] = _("Small circle layer")
self.props["label"] = _("Small-Circle Layer")

40 changes: 40 additions & 0 deletions innstereo/main_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,41 @@ def draw_contours(self, lyr_obj, dipdir, dips, measure_type):

self.cbar.append(cbar)

def draw_angelier(self, values):
"""
Draws the Angelier arrows for a fault plane layer.
Receives the data as a list. Iterates over arrow-position and the sense
and displays the resulting arrow.
"""
lyr_obj, plane_dir, plane_dip, strikes, \
line_dir, line_dip, lp_plane_dir, lp_plane_dip, sense = values
lon, lat = mplstereonet.line(line_dip, line_dir)

for x, y, sns in zip(lon, lat, sense):
mag = np.hypot(x, y)
u, v = x / mag, y / mag

if sns == "up":
self.ax_stereo.quiver(x, y, -u, -v, width=1.5, headwidth=4,
units="dots", pivot="middle",
color=lyr_obj.get_arrow_color())
elif sns == "dn":
self.ax_stereo.quiver(x, y, u, v, width=1.5, headwidth=4,
units="dots", pivot="middle",
color=lyr_obj.get_arrow_color())

elif sns == "sin":
pass

elif sns == "dex":
pass

else:
pass

return None

def draw_hoeppener(self, lyr_obj, plane_dir, plane_dip, line_dir,
line_dip, lp_plane_dir, lp_plane_dip, sense):
"""
Expand Down Expand Up @@ -2048,6 +2083,11 @@ def plot_layer(self, lyr_obj, subset=None, highlight=False):
line_dir, line_dip, lp_plane_dir,
lp_plane_dip, sense)

if lyr_obj.get_draw_angelier() == True:
self.draw_angelier([lyr_obj, plane_dir, plane_dip, strike,
line_dir, line_dip, lp_plane_dir,
lp_plane_dip, sense])


elif lyr_type == "smallcircle":
dipdir, dip, angle = self.parse_smallcircles(store, subset)
Expand Down

0 comments on commit a283456

Please sign in to comment.