wolfhece 2.1.126__py3-none-any.whl → 2.1.128__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wolfhece/PyConfig.py CHANGED
@@ -32,6 +32,9 @@ class ConfigurationKeys(Enum):
32
32
  ACTIVE_ARRAY_PALETTE_FOR_IMAGE = "Use active array palette for image"
33
33
  ACTIVE_RES2D_PALETTE_FOR_IMAGE = "Use active result palette for image"
34
34
  ASSEMBLY_IMAGES = "AssemblyImages"
35
+ DIRECTORY_DEM = "Default DEM directory"
36
+ DIRECTORY_DTM = "Default DTM directory"
37
+ DIRECTORY_LAZ = "Default LAZ directory"
35
38
 
36
39
  class WolfConfiguration:
37
40
  """ Holds the PyWolf configuration """
@@ -76,7 +79,10 @@ class WolfConfiguration:
76
79
  ConfigurationKeys.COLOR_BACKGROUND.value: [255, 255, 255, 255],
77
80
  ConfigurationKeys.ASSEMBLY_IMAGES.value: 0,
78
81
  ConfigurationKeys.TICKS_XROTATION.value: 30.,
79
- ConfigurationKeys.TICKS_FONTSIZE.value: 12
82
+ ConfigurationKeys.TICKS_FONTSIZE.value: 12,
83
+ ConfigurationKeys.DIRECTORY_DEM.value: "",
84
+ ConfigurationKeys.DIRECTORY_DTM.value: "",
85
+ ConfigurationKeys.DIRECTORY_LAZ.value: ""
80
86
 
81
87
  }
82
88
  self._types = {
@@ -89,7 +95,10 @@ class WolfConfiguration:
89
95
  ConfigurationKeys.COLOR_BACKGROUND.value: list,
90
96
  ConfigurationKeys.ASSEMBLY_IMAGES.value: int,
91
97
  ConfigurationKeys.TICKS_XROTATION.value: float,
92
- ConfigurationKeys.TICKS_FONTSIZE.value: int
98
+ ConfigurationKeys.TICKS_FONTSIZE.value: int,
99
+ ConfigurationKeys.DIRECTORY_DEM.value: str,
100
+ ConfigurationKeys.DIRECTORY_DTM.value: str,
101
+ ConfigurationKeys.DIRECTORY_LAZ.value: str
93
102
  }
94
103
 
95
104
  self._check_config()
@@ -97,7 +106,7 @@ class WolfConfiguration:
97
106
  def _check_config(self):
98
107
  assert self._config.keys() == self._types.keys()
99
108
  for idx, (key,val) in enumerate(self._config.items()):
100
- assert type(val) == self._types[key]
109
+ assert isinstance(val, self._types[key])
101
110
 
102
111
  def load(self):
103
112
  with open(self._options_file_path, "r", encoding="utf-8") as configfile:
@@ -136,7 +145,7 @@ class GlobalOptionsDialog(wx.Dialog):
136
145
  super(GlobalOptionsDialog, self).__init__(*args, **kw)
137
146
 
138
147
  self.InitUI()
139
- self.SetSize((600, 400))
148
+ self.SetSize((600, 500))
140
149
  self.SetTitle(_("Global options"))
141
150
 
142
151
  def push_configuration(self, configuration):
@@ -149,6 +158,9 @@ class GlobalOptionsDialog(wx.Dialog):
149
158
  self.cfg_assembly_images.SetSelection(configuration[ConfigurationKeys.ASSEMBLY_IMAGES])
150
159
  self.cfg_ticks_xrotation.SetValue(str(configuration[ConfigurationKeys.TICKS_XROTATION]))
151
160
  self.cfg_ticks_fontsize.SetValue(str(configuration[ConfigurationKeys.TICKS_FONTSIZE]))
161
+ self.cfg_directory_dem.SetValue(str(configuration[ConfigurationKeys.DIRECTORY_DEM]))
162
+ self.cfg_directory_dtm.SetValue(str(configuration[ConfigurationKeys.DIRECTORY_DTM]))
163
+ self.cfg_directory_laz.SetValue(str(configuration[ConfigurationKeys.DIRECTORY_LAZ]))
152
164
 
153
165
  def pull_configuration(self, configuration):
154
166
  configuration[ConfigurationKeys.PLAY_WELCOME_SOUND] = self.cfg_welcome_voice.IsChecked()
@@ -160,6 +172,9 @@ class GlobalOptionsDialog(wx.Dialog):
160
172
  configuration[ConfigurationKeys.ASSEMBLY_IMAGES] = self.cfg_assembly_images.GetSelection()
161
173
  configuration[ConfigurationKeys.TICKS_XROTATION] = float(self.cfg_ticks_xrotation.Value)
162
174
  configuration[ConfigurationKeys.TICKS_FONTSIZE] = int(self.cfg_ticks_fontsize.Value)
175
+ configuration[ConfigurationKeys.DIRECTORY_DEM] = str(self.cfg_directory_dem.Value)
176
+ configuration[ConfigurationKeys.DIRECTORY_DTM] = str(self.cfg_directory_dtm.Value)
177
+ configuration[ConfigurationKeys.DIRECTORY_LAZ] = str(self.cfg_directory_laz.Value)
163
178
 
164
179
  def InitUI(self):
165
180
 
@@ -246,6 +261,43 @@ class GlobalOptionsDialog(wx.Dialog):
246
261
 
247
262
  sbs.Add(locsizer, 3, wx.EXPAND, 5)
248
263
 
264
+ # DEM directory
265
+ dir_dem = wx.BoxSizer(wx.HORIZONTAL)
266
+ self.label_directory_dem = wx.StaticText(pnl, label=_('Default DEM directory'))
267
+ self.cfg_directory_dem = wx.TextCtrl(pnl, value='',style = wx.TE_CENTRE )
268
+ self.btn_choose_dem = wx.Button(pnl, label=_('Choose'))
269
+ self.btn_choose_dem.Bind(wx.EVT_BUTTON, self.OnChooseDem)
270
+
271
+ dir_dem.Add(self.label_directory_dem, 1, wx.EXPAND, 2)
272
+ dir_dem.Add(self.cfg_directory_dem, 1, wx.EXPAND, 5)
273
+ dir_dem.Add(self.btn_choose_dem, 1, wx.EXPAND, 5)
274
+
275
+ # DTM directory
276
+ dir_dtm = wx.BoxSizer(wx.HORIZONTAL)
277
+ self.label_directory_dtm = wx.StaticText(pnl, label=_('Default DTM directory'))
278
+ self.cfg_directory_dtm = wx.TextCtrl(pnl, value='',style = wx.TE_CENTRE )
279
+ self.btn_choose_dtm = wx.Button(pnl, label=_('Choose'))
280
+ self.btn_choose_dtm.Bind(wx.EVT_BUTTON, self.OnChooseDtm)
281
+
282
+ dir_dtm.Add(self.label_directory_dtm, 1, wx.EXPAND, 2)
283
+ dir_dtm.Add(self.cfg_directory_dtm, 1, wx.EXPAND, 5)
284
+ dir_dtm.Add(self.btn_choose_dtm, 1, wx.EXPAND, 5)
285
+
286
+ # LAZ directory
287
+ dir_laz = wx.BoxSizer(wx.HORIZONTAL)
288
+ self.label_directory_laz = wx.StaticText(pnl, label=_('Default LAZ directory'))
289
+ self.cfg_directory_laz = wx.TextCtrl(pnl, value='',style = wx.TE_CENTRE )
290
+ self.btn_choose_laz = wx.Button(pnl, label=_('Choose'))
291
+ self.btn_choose_laz.Bind(wx.EVT_BUTTON, self.OnChooseLaz)
292
+
293
+ dir_laz.Add(self.label_directory_laz, 1, wx.EXPAND, 2)
294
+ dir_laz.Add(self.cfg_directory_laz, 1, wx.EXPAND, 5)
295
+ dir_laz.Add(self.btn_choose_laz, 1, wx.EXPAND, 5)
296
+
297
+ sbs.Add(dir_dem, 1, wx.EXPAND, 5)
298
+ sbs.Add(dir_dtm, 1, wx.EXPAND, 5)
299
+ sbs.Add(dir_laz, 1, wx.EXPAND, 5)
300
+
249
301
  pnl.SetSizer(sbs)
250
302
  pnl.Layout()
251
303
 
@@ -267,6 +319,27 @@ class GlobalOptionsDialog(wx.Dialog):
267
319
  okButton.Bind(wx.EVT_BUTTON, self.OnOk)
268
320
  closeButton.Bind(wx.EVT_BUTTON, self.OnClose)
269
321
 
322
+ def OnChooseDem(self, e):
323
+ """ Choose a directory for DEM files """
324
+ dlg = wx.DirDialog(self, _("Choose a directory"), style=wx.DD_DEFAULT_STYLE)
325
+ if dlg.ShowModal() == wx.ID_OK:
326
+ self.cfg_directory_dem.SetValue(str(dlg.GetPath()))
327
+ dlg.Destroy()
328
+
329
+ def OnChooseDtm(self, e):
330
+ """ Choose a directory for DTM files """
331
+ dlg = wx.DirDialog(self, _("Choose a directory"), style=wx.DD_DEFAULT_STYLE)
332
+ if dlg.ShowModal() == wx.ID_OK:
333
+ self.cfg_directory_dtm.SetValue(str(dlg.GetPath()))
334
+ dlg.Destroy()
335
+
336
+ def OnChooseLaz(self, e):
337
+ """ Choose a directory for LAZ files """
338
+ dlg = wx.DirDialog(self, _("Choose a directory"), style=wx.DD_DEFAULT_STYLE)
339
+ if dlg.ShowModal() == wx.ID_OK:
340
+ self.cfg_directory_laz.SetValue(str(dlg.GetPath()))
341
+ dlg.Destroy()
342
+
270
343
  def OnOk(self, e):
271
344
  if self.IsModal():
272
345
  self.EndModal(wx.ID_OK)