~lorzeteam/lorze/trunk

« back to all changes in this revision

Viewing changes to Scripts/lrzoptions.py

  • Committer: Andreas Ulrich
  • Date: 2012-12-13 20:54:19 UTC
  • Revision ID: ulrich3110@gmail.com-20121213205419-aucgdskqtqmyrj10
new file structure, new object structure, about dialogue, help dialogue, hep pages in english and german, german translation, ponton5h installer, documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
# -*- coding: utf-8 -*-
3
 
 
4
 
# LORZE erasandcad, a 2D CAD with an intuitive user interface, simple and easy.
5
 
# http://erasand.jimdo.com/python-programme/lorze/
6
 
# (C) 2012, Andreas Ulrich
7
 
 
8
 
# This program is free software: you can redistribute it and/or modify  it under  the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
9
 
 
10
 
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
11
 
 
12
 
# You should have received a copy of the GNU General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.
13
 
 
14
 
import wx
15
 
from lrzvalchck import LorzeValueCheck
16
 
 
17
 
class LorzeOptions():
18
 
    # Lorze options
19
 
 
20
 
    def __init__(self):
21
 
        # initialize LorzeOptions, wx.Config object to load options from system settings
22
 
        self.__lrzcfg = wx.Config('lorzecfg')
23
 
 
24
 
        # frametitle: window title, string
25
 
        # framesize: main window size, (w, h)
26
 
        # gdiborder: grafik panel border, string, key for self.__bordersdict
27
 
        # dezplcs: number of decimal places, integer
28
 
        # cursorwin: standard-cursor, string, key for self.__cursorsdict
29
 
        # cursorgdi: cursor graphic-panel, string, key for self.__cursorsdict
30
 
        # dlgborder: distance in dialogs between widgets, integer
31
 
        # dlgoptsize: options dialog size, (w, h)
32
 
        # sbrange: GraphicPANEL() scrollbar range, integer
33
 
        # sbsize: GraphicPANEL() size scrollbar slider, integer
34
 
        # wheelenlarge: mouse wheel factor enlargement, float
35
 
        # wheelreduce: mouse wheel factor reduction, float
36
 
        # sensitive: pixelsize smart cursor, integer
37
 
        # maxpenstylescale: maximum scale factor (pen), integer
38
 
        # maxuserscale: maximum userscale, integer
39
 
        # scsize: smart cursor mark size in pixel, integer
40
 
        # scpensize: smart cursor mark pen size in pixel, integer
41
 
        # sccolpoint: smart cursor colour point, string, html format
42
 
        # sccolsegm: smart cursor colour segment, string, html format
43
 
        # sccolelem: smart cursor colour element, string, html format
44
 
        # scmarkpensize: smart cursor mark pen size factor, float
45
 
        # prevcol: preview color, string, html format
46
 
        # prevpensize: preview pen size, integer
47
 
        # prevpenstyle: preview pen style, string
48
 
        # stcoordw: statusbar field with for coordinates, integer
49
 
        # selcol: color selected elements, string, html format
50
 
        # dlgattrsize: attribute dialog size (w,h)
51
 
        # optlistwidths: column width option values
52
 
        # attrlistwidths: column width attribute values
53
 
        # defcolorname: default drawing colour name, string
54
 
        # defcolorvalue: default drawing colour value, string, 'r, g, b'
55
 
        # defcolorlabel: default drawing color label, string
56
 
        # deflayername: default drawing layer name, string
57
 
        # deflayerlabel: default drawing layer label, string
58
 
        # defstylename: default drawing line style name, string
59
 
        # defstylevalue: default drawing line style value, string, list: 'USER_DASH', '10, 20, 10'
60
 
        # defstylelabel: default drawing line style label, string
61
 
        # defwidthname: default drawing line width name, string
62
 
        # defwidthvalue: default drawing line width value, Float
63
 
        # defwidthlabel: default drawing line width label, string
64
 
 
65
 
        # value check
66
 
        self.__valchk= LorzeValueCheck()
67
 
 
68
 
        # default values: dictionairy
69
 
        self.__defval= {'framesizew':800, 'framesizeh':600, 'gdiborder':'wx.SUNKEN_BORDER', 'dezplcs':6, 'cursorwin':'wx.CURSOR_DEFAULT', 'cursorgdi':'wx.CURSOR_CROSS', 'dlgborder':5, 'dlgoptsizew':450, 'dlgoptsizeh':600, 'sbrange':200, 'sbsize':10, 'wheelenlarge':1.2, 'wheelreduce':0.8, 'sensitive':10, 'maxpenstylescale':50, 'maxuserscale':1000, 'scsize':20, 'scpensize':2, 'sccolpoint':'#000000', 'sccolsegm':'#0AE2F2', 'sccolelem':'#0000FF', 'scmarkpensize':1.5, 'prevcol':'#000000', 'prevpensize':1, 'prevpenstyle':'wx.SOLID', 'stcoordw': 150, 'selcol': '#00FF00', 'dlgattrsizew':600, 'dlgattrsizeh':500, 'optlistwidth0':290, 'optlistwidth1':120, 'attrlistwidth0':220, 'attrlistwidth1':120, 'attrlistwidth2':120, 'attrlistwidth3':120, 'attrlistwidth4':220, 'attrlistwidth5':120, 'attrlistwidth6':120, 'attrlistwidth7':120, 'attrlistwidth8':220, 'attrlistwidth9':120, 'attrlistwidth10':120, 'attrlistwidth11':120, 'attrlistwidth12':220, 'attrlistwidth13':120, 'attrlistwidth14':120, 'attrlistwidth15':120, 'defcolorname':'Black', 'defcolorvalue':'0, 0, 0', 'defcolorlabel':'Default colour', 'deflayername':'System', 'deflayerlabel': 'Default layer', 'defstylename':'Solid', 'defstylevalue': 'SOLID', 'defstylelabel':'Default line style', 'defwidthname':'1mm', 'defwidthvalue':'1.0', 'defwidthlabel':'Default line width'}
70
 
 
71
 
        # frametitle is not editable
72
 
        self.__frametitle= u'LORZE erasandcad 0.2 alpha 2012/10/20'
73
 
 
74
 
        # set options from 'lorzecfg'
75
 
        w= self.__lrzcfg.ReadInt('framesizew', self.__defval['framesizew'])
76
 
        h= self.__lrzcfg.ReadInt('framesizeh', self.__defval['framesizeh'])
77
 
        self.__framesize= (w, h)
78
 
 
79
 
        self.__gdiborder= self.__lrzcfg.Read('gdiborder', self.__defval['gdiborder'])
80
 
        self.__dezplcs= self.__lrzcfg.ReadInt('dezplcs', self.__defval['dezplcs'])
81
 
        self.__cursorwin= self.__lrzcfg.Read('cursorwin', self.__defval['cursorwin'])
82
 
        self.__cursorgdi= self.__lrzcfg.Read('cursorgdi', self.__defval['cursorgdi'])
83
 
        self.__dlgborder= self.__lrzcfg.ReadInt('dlgborder', self.__defval['dlgborder'])
84
 
 
85
 
        w= self.__lrzcfg.ReadInt('dlgoptsizew', self.__defval['dlgoptsizew'])
86
 
        h= self.__lrzcfg.ReadInt('dlgoptsizeh', self.__defval['dlgoptsizeh'])
87
 
        self.__dlgoptsize= (w, h)
88
 
 
89
 
        self.__sbrange= self.__lrzcfg.ReadInt('sbrange', self.__defval['sbrange'])
90
 
        self.__sbsize= self.__lrzcfg.ReadInt('sbsize', self.__defval['sbsize'])
91
 
        self.__wheelenlarge= self.__lrzcfg.ReadFloat('wheelenlarge', self.__defval['wheelenlarge'])
92
 
        self.__wheelreduce= self.__lrzcfg.ReadFloat('wheelreduce', self.__defval['wheelreduce'])
93
 
        self.__sensitive= self.__lrzcfg.ReadInt('sensitive', self.__defval['sensitive'])
94
 
        self.__maxpenstylescale= self.__lrzcfg.ReadInt('maxpenstylescale', self.__defval['maxpenstylescale'])
95
 
        self.__maxuserscale= self.__lrzcfg.ReadInt('maxuserscale', self.__defval['maxuserscale'])
96
 
        self.__scsize= self.__lrzcfg.ReadInt('scsize', self.__defval['scsize'])
97
 
        self.__scpensize= self.__lrzcfg.ReadInt('scpensize', self.__defval['scpensize'])
98
 
        self.__sccolpoint= self.__lrzcfg.Read('sccolpoint', self.__defval['sccolpoint'])
99
 
        self.__sccolsegm= self.__lrzcfg.Read('sccolsegm', self.__defval['sccolsegm'])
100
 
        self.__sccolelem= self.__lrzcfg.Read('sccolelem', self.__defval['sccolelem'])
101
 
        self.__scmarkpensize= self.__lrzcfg.ReadFloat('scmarkpensize', self.__defval['scmarkpensize'])
102
 
        self.__prevcol= self.__lrzcfg.Read('prevcol', self.__defval['prevcol'])
103
 
        self.__prevpensize= self.__lrzcfg.ReadInt('prevpensize', self.__defval['prevpensize'])
104
 
        self.__prevpenstyle= self.__lrzcfg.Read('prevpenstyle', self.__defval['prevpenstyle'])
105
 
        self.__stcoordw= self.__lrzcfg.ReadInt('stcoordw', self.__defval['stcoordw'])
106
 
        self.__selcol= self.__lrzcfg.Read('selcol', self.__defval['selcol'])
107
 
 
108
 
        w= self.__lrzcfg.ReadInt('dlgattrsizew', self.__defval['dlgattrsizew'])
109
 
        h= self.__lrzcfg.ReadInt('dlgattrsizeh', self.__defval['dlgattrsizeh'])
110
 
        self.__dlgattrsize= (w, h)
111
 
 
112
 
        w1= self.__lrzcfg.ReadInt('optlistwidth0', self.__defval['optlistwidth0'])
113
 
        w2= self.__lrzcfg.ReadInt('optlistwidth1', self.__defval['optlistwidth1'])
114
 
        self.__optlistwidths= (w1, w2)
115
 
 
116
 
        w0= self.__lrzcfg.ReadInt('attrlistwidth0', self.__defval['attrlistwidth0'])
117
 
        w1= self.__lrzcfg.ReadInt('attrlistwidth1', self.__defval['attrlistwidth1'])
118
 
        w2= self.__lrzcfg.ReadInt('attrlistwidth2', self.__defval['attrlistwidth2'])
119
 
        w3= self.__lrzcfg.ReadInt('attrlistwidth3', self.__defval['attrlistwidth3'])
120
 
        w4= self.__lrzcfg.ReadInt('attrlistwidth4', self.__defval['attrlistwidth4'])
121
 
        w5= self.__lrzcfg.ReadInt('attrlistwidth5', self.__defval['attrlistwidth5'])
122
 
        w6= self.__lrzcfg.ReadInt('attrlistwidth6', self.__defval['attrlistwidth6'])
123
 
        w7= self.__lrzcfg.ReadInt('attrlistwidth7', self.__defval['attrlistwidth7'])
124
 
        w8= self.__lrzcfg.ReadInt('attrlistwidth8', self.__defval['attrlistwidth8'])
125
 
        w9= self.__lrzcfg.ReadInt('attrlistwidth9', self.__defval['attrlistwidth9'])
126
 
        w10= self.__lrzcfg.ReadInt('attrlistwidth10', self.__defval['attrlistwidth10'])
127
 
        w11= self.__lrzcfg.ReadInt('attrlistwidth11', self.__defval['attrlistwidth11'])
128
 
        w12= self.__lrzcfg.ReadInt('attrlistwidth12', self.__defval['attrlistwidth12'])
129
 
        w13= self.__lrzcfg.ReadInt('attrlistwidth13', self.__defval['attrlistwidth13'])
130
 
        w14= self.__lrzcfg.ReadInt('attrlistwidth14', self.__defval['attrlistwidth14'])
131
 
        w15= self.__lrzcfg.ReadInt('attrlistwidth15', self.__defval['attrlistwidth15'])
132
 
        self.__attrlistwidths= (w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15)
133
 
 
134
 
        name= self.__lrzcfg.Read('defcolorname', self.__defval['defcolorname'])
135
 
        value= self.__lrzcfg.Read('defcolorvalue', self.__defval['defcolorvalue'])
136
 
        label= self.__lrzcfg.Read('defcolorlabel', self.__defval['defcolorlabel'])
137
 
        self.__drawdefcolor= (name, value, label)
138
 
 
139
 
        name= self.__lrzcfg.Read('deflayername', self.__defval['deflayername'])
140
 
        label= self.__lrzcfg.Read('deflayerlabel', self.__defval['deflayerlabel'])
141
 
        self.__drawdeflayer= (name, label)
142
 
 
143
 
        name= self.__lrzcfg.Read('defstylename', self.__defval['defstylename'])
144
 
        value= self.__lrzcfg.Read('defstylevalue', self.__defval['defstylevalue'])
145
 
        label= self.__lrzcfg.Read('defstylelabel', self.__defval['defstylelabel'])
146
 
        self.__drawdefstyle= (name, value, label)
147
 
 
148
 
        name= self.__lrzcfg.Read('defwidthname', self.__defval['defwidthname'])
149
 
        value= self.__lrzcfg.Read('defwidthvalue', self.__defval['defwidthvalue'])
150
 
        label= self.__lrzcfg.Read('defwidthlabel', self.__defval['defwidthlabel'])
151
 
        self.__drawdefwidth= (name, value, label)
152
 
 
153
 
 
154
 
    def SaveOptions(self):
155
 
        self.__lrzcfg.WriteInt('framesizew', self.__framesize[0])
156
 
        self.__lrzcfg.WriteInt('framesizeh', self.__framesize[1])
157
 
        self.__lrzcfg.Write('gdiborder', self.__gdiborder)
158
 
        self.__lrzcfg.WriteInt('dezplcs', self.__dezplcs)
159
 
        self.__lrzcfg.Write('cursorwin', self.__cursorwin)
160
 
        self.__lrzcfg.Write('cursorgdi', self.__cursorgdi)
161
 
        self.__lrzcfg.WriteInt('dlgborder', self.__dlgborder)
162
 
        self.__lrzcfg.WriteInt('dlgoptsizew', self.__dlgoptsize[0])
163
 
        self.__lrzcfg.WriteInt('dlgoptsizeh', self.__dlgoptsize[1])
164
 
        self.__lrzcfg.WriteInt('sbrange', self.__sbrange)
165
 
        self.__lrzcfg.WriteInt('sbsize', self.__sbsize)
166
 
        self.__lrzcfg.WriteFloat('wheelenlarge', self.__wheelenlarge)
167
 
        self.__lrzcfg.WriteFloat('wheelreduce', self.__wheelreduce)
168
 
        self.__lrzcfg.WriteInt('sensitive', self.__sensitive)
169
 
        self.__lrzcfg.WriteInt('maxpenstylescale', self.__maxpenstylescale)
170
 
        self.__lrzcfg.WriteInt('maxuserscale', self.__maxuserscale)
171
 
        self.__lrzcfg.WriteInt('scsize', self.__scsize)
172
 
        self.__lrzcfg.WriteInt('scpensize', self.__scpensize)
173
 
        self.__lrzcfg.Write('sccolpoint', self.__sccolpoint)
174
 
        self.__lrzcfg.Write('sccolsegm', self.__sccolsegm)
175
 
        self.__lrzcfg.Write('sccolelem', self.__sccolelem)
176
 
        self.__lrzcfg.WriteFloat('scmarkpensize', self.__scmarkpensize)
177
 
        self.__lrzcfg.Write('prevcol', self.__prevcol)
178
 
        self.__lrzcfg.WriteInt('prevpensize', self.__prevpensize)
179
 
        self.__lrzcfg.Write('prevpenstyle', self.__prevpenstyle)
180
 
        self.__lrzcfg.WriteInt('stcoordw', self.__stcoordw)
181
 
        self.__lrzcfg.Write('selcol', self.__selcol)
182
 
 
183
 
        self.__lrzcfg.WriteInt('dlgattrsizew', self.__dlgattrsize[0])
184
 
        self.__lrzcfg.WriteInt('dlgattrsizeh', self.__dlgattrsize[1])
185
 
 
186
 
        self.__lrzcfg.WriteInt('optlistwidth0', self.__optlistwidths[0])
187
 
        self.__lrzcfg.WriteInt('optlistwidth1', self.__optlistwidths[1])
188
 
 
189
 
        self.__lrzcfg.WriteInt('attrlistwidth0', self.__attrlistwidths[0])
190
 
        self.__lrzcfg.WriteInt('attrlistwidth1', self.__attrlistwidths[1])
191
 
        self.__lrzcfg.WriteInt('attrlistwidth2', self.__attrlistwidths[2])
192
 
        self.__lrzcfg.WriteInt('attrlistwidth3', self.__attrlistwidths[3])
193
 
        self.__lrzcfg.WriteInt('attrlistwidth4', self.__attrlistwidths[4])
194
 
        self.__lrzcfg.WriteInt('attrlistwidth5', self.__attrlistwidths[5])
195
 
        self.__lrzcfg.WriteInt('attrlistwidth6', self.__attrlistwidths[6])
196
 
        self.__lrzcfg.WriteInt('attrlistwidth7', self.__attrlistwidths[7])
197
 
        self.__lrzcfg.WriteInt('attrlistwidth8', self.__attrlistwidths[8])
198
 
        self.__lrzcfg.WriteInt('attrlistwidth9', self.__attrlistwidths[9])
199
 
        self.__lrzcfg.WriteInt('attrlistwidth10', self.__attrlistwidths[10])
200
 
        self.__lrzcfg.WriteInt('attrlistwidth11', self.__attrlistwidths[11])
201
 
        self.__lrzcfg.WriteInt('attrlistwidth12', self.__attrlistwidths[12])
202
 
        self.__lrzcfg.WriteInt('attrlistwidth13', self.__attrlistwidths[13])
203
 
        self.__lrzcfg.WriteInt('attrlistwidth14', self.__attrlistwidths[14])
204
 
        self.__lrzcfg.WriteInt('attrlistwidth15', self.__attrlistwidths[15])
205
 
 
206
 
        self.__lrzcfg.Write('defcolorname', self.__drawdefcolor[0])
207
 
        self.__lrzcfg.Write('defcolorvalue', self.__drawdefcolor[1])
208
 
        self.__lrzcfg.Write('defcolorlabel', self.__drawdefcolor[2])
209
 
 
210
 
        self.__lrzcfg.Write('deflayername', self.__drawdeflayer[0])
211
 
        self.__lrzcfg.Write('deflayerlabel', self.__drawdeflayer[1])
212
 
 
213
 
        self.__lrzcfg.Write('defstylename', self.__drawdefstyle[0])
214
 
        self.__lrzcfg.Write('defstylevalue', self.__drawdefstyle[1])
215
 
        self.__lrzcfg.Write('defstylelabel', self.__drawdefstyle[2])
216
 
 
217
 
        self.__lrzcfg.Write('defwidthname', self.__drawdefwidth[0])
218
 
        self.__lrzcfg.Write('defwidthvalue', self.__drawdefwidth[1])
219
 
        self.__lrzcfg.Write('defwidthlabel', self.__drawdefwidth[2])
220
 
 
221
 
 
222
 
    def Reset(self):
223
 
        self.__framesize= ((self.__defval['framesizew'], self.__defval['framesizeh']))
224
 
        self.__gdiborder= self.__defval['gdiborder']
225
 
        self.__dezplcs= self.__defval['dezplcs']
226
 
        self.__cursorwin= self.__defval['cursorwin']
227
 
        self.__cursorgdi= self.__defval['cursorgdi']
228
 
        self.__dlgborder= self.__defval['dlgborder']
229
 
        self.__dlgoptsize= ((self.__defval['dlgoptsizew'], self.__defval['dlgoptsizeh']))
230
 
        self.__sbrange= self.__defval['sbrange']
231
 
        self.__sbsize= self.__defval['sbsize']
232
 
        self.__wheelenlarge= self.__defval['wheelenlarge']
233
 
        self.__wheelreduce= self.__defval['wheelreduce']
234
 
        self.__sensitive= self.__defval['sensitive']
235
 
        self.__maxpenstylescale= self.__defval['maxpenstylescale']
236
 
        self.__maxuserscale= self.__defval['maxuserscale']
237
 
        self.__scsize= self.__defval['scsize']
238
 
        self.__scpensize= self.__defval['scpensize']
239
 
        self.__sccolpoint= self.__defval['sccolpoint']
240
 
        self.__sccolsegm= self.__defval['sccolsegm']
241
 
        self.__sccolelem= self.__defval['sccolelem']
242
 
        self.__scmarkpensize= self.__defval['scmarkpensize']
243
 
        self.__prevcol= self.__defval['prevcol']
244
 
        self.__prevpensize= self.__defval['prevpensize']
245
 
        self.__prevpenstyle= self.__defval['prevpenstyle']
246
 
        self.__stcoordw= self.__defval['stcoordw']
247
 
        self.__selcol= self.__defval['selcol']
248
 
        self.__dlgattrsize= (self.__defval['dlgattrsizew'], self.__defval['dlgattrsizeh'])
249
 
        self.__optlistwidths= (self.__defval['optlistwidth0'], self.__defval['optlistwidth1'])
250
 
        self.__attrlistwidths= (self.__defval['attrlistwidth0'], self.__defval['attrlistwidth1'], self.__defval['attrlistwidth2'], self.__defval['attrlistwidth3'], self.__defval['attrlistwidth4'], self.__defval['attrlistwidth5'], self.__defval['attrlistwidth6'], self.__defval['attrlistwidth7'], self.__defval['attrlistwidth8'], self.__defval['attrlistwidth9'], self.__defval['attrlistwidth10'], self.__defval['attrlistwidth11'], self.__defval['attrlistwidth12'], self.__defval['attrlistwidth13'], self.__defval['attrlistwidth14'], self.__defval['attrlistwidth15'])
251
 
        self.__drawdefcolor= (self.__defval['defcolorname'], self.__defval['defcolorvalue'], self.__defval['defcolorlabel'])
252
 
        self.__drawdeflayer= (self.__defval['deflayername'], self.__defval['deflayerlabel'])
253
 
        self.__drawdefstyle= (self.__defval['defstylename'], self.__defval['defstylevalue'], self.__defval['defstylelabel'])
254
 
        self.__drawdefwidth= (self.__defval['defwidthname'], self.__defval['defwidthvalue'], self.__defval['defwidthlabel'])
255
 
 
256
 
 
257
 
    def SetFrameSize(self, width, height):
258
 
        self.__framesize= (width, height)
259
 
 
260
 
 
261
 
    def GetFrameSize(self):
262
 
        return(self.__framesize)
263
 
 
264
 
 
265
 
    def GetFrameTitle(self):
266
 
        return(self.__frametitle)
267
 
 
268
 
 
269
 
    def SetGDIBorder(self, gdiborder):
270
 
        self.__gdiborder= str(gdiborder)
271
 
 
272
 
 
273
 
    def GetGDIBorder(self):
274
 
        return(self.__gdiborder)
275
 
 
276
 
 
277
 
    def SetDezPlcs(self, dezplcs):
278
 
        self.__dezplcs= int(dezplcs)
279
 
 
280
 
 
281
 
    def GetDezPlcs(self):
282
 
        return(self.__dezplcs)
283
 
 
284
 
 
285
 
    def SetCursorGdi(self, cursorgdi):
286
 
        self.__cursorgdi= str(cursorgdi)
287
 
 
288
 
 
289
 
    def GetCursorGdi(self):
290
 
        return (self.__cursorgdi)
291
 
 
292
 
 
293
 
    def SetCursorWin(self, cursorwin):
294
 
        self.__cursorwin= str(cursorwin)
295
 
 
296
 
 
297
 
    def GetCursorWin(self):
298
 
        return (self.__cursorwin)
299
 
 
300
 
 
301
 
    def SetDlgBorder(self, dlgborder):
302
 
        self.__dlgborder= int(dlgborder)
303
 
 
304
 
 
305
 
    def GetDlgBorder(self):
306
 
        return(self.__dlgborder)
307
 
 
308
 
 
309
 
    def SetDlgOptSize(self, width, height):
310
 
        self.__dlgoptsize= (width, height)
311
 
 
312
 
 
313
 
    def GetDlgOptSize(self):
314
 
        return(self.__dlgoptsize)
315
 
 
316
 
 
317
 
    def SetSbRange(self, sbrange):
318
 
        self.__sbrange= int(sbrange)
319
 
 
320
 
 
321
 
    def GetSbRange(self):
322
 
        return(self.__sbrange)
323
 
 
324
 
 
325
 
    def SetSbSize(self, sbsize):
326
 
        self.__sbsize= int(sbsize)
327
 
 
328
 
 
329
 
    def GetSbSize(self):
330
 
        return(self.__sbsize)
331
 
 
332
 
 
333
 
    def SetWheelEnlarge(self, wheelenlarge):
334
 
        self.__wheelenlarge= float(wheelenlarge)
335
 
 
336
 
 
337
 
    def GetWheelEnlarge(self):
338
 
        return(self.__wheelenlarge)
339
 
 
340
 
 
341
 
    def SetWheelReduce(self, wheelreduce):
342
 
        self.__wheelreduce= float(wheelreduce)
343
 
 
344
 
 
345
 
    def GetWheelReduce(self):
346
 
        return(self.__wheelreduce)
347
 
 
348
 
 
349
 
    def SetSensitive(self, sensitive):
350
 
        self.__sensitive= int(sensitive)
351
 
 
352
 
 
353
 
    def GetSensitive(self):
354
 
        return(self.__sensitive)
355
 
 
356
 
 
357
 
    def SetMaxPenStyleScale(self, maxpenstylescale):
358
 
        self.__maxpenstylescale= int(maxpenstylescale)
359
 
 
360
 
 
361
 
    def GetMaxPenStyleScale(self):
362
 
        return(self.__maxpenstylescale)
363
 
 
364
 
 
365
 
    def SetMaxUserScale(self, maxuserscale):
366
 
        self.__maxuserscale= int(maxuserscale)
367
 
 
368
 
 
369
 
    def GetMaxUserScale(self):
370
 
        return(self.__maxuserscale)
371
 
 
372
 
 
373
 
    def SetSmartCursSize(self, scsize):
374
 
        self.__scsize= int(scsize)
375
 
 
376
 
 
377
 
    def GetSmartCursSize(self):
378
 
        return(self.__scsize)
379
 
 
380
 
 
381
 
    def SetSmartCursPenSize(self, scpensize):
382
 
        self.__scpensize= int(scpensize)
383
 
 
384
 
 
385
 
    def GetSmartCursPenSize(self):
386
 
        return(self.__scpensize)
387
 
 
388
 
 
389
 
    def SetSmartCursColPoint(self, sccolpoint):
390
 
        self.__sccolpoint= str(sccolpoint)
391
 
 
392
 
 
393
 
    def GetSmartCursColPoint(self):
394
 
        return(self.__sccolpoint)
395
 
 
396
 
 
397
 
    def SetSmartCursColSegm(self, sccolsegm):
398
 
        self.__sccolsegm= str(sccolsegm)
399
 
 
400
 
 
401
 
    def GetSmartCursColSegm(self):
402
 
        return(self.__sccolsegm)
403
 
 
404
 
 
405
 
    def SetSmartCursColElem(self, sccolelem):
406
 
        self.__sccolelem= str(sccolelem)
407
 
 
408
 
 
409
 
    def GetSmartCursColElem(self):
410
 
        return(self.__sccolelem)
411
 
 
412
 
 
413
 
    def SetSmartCursMarkPenSize(self, scmarkpensize):
414
 
        self.__scmarkpensize= float(scmarkpensize)
415
 
 
416
 
 
417
 
    def GetSmartCursMarkPenSize(self):
418
 
        return(self.__scmarkpensize)
419
 
 
420
 
 
421
 
    def SetPreviewColor(self, prevcol):
422
 
        self.__prevcol= str(prevcol)
423
 
 
424
 
 
425
 
    def GetPreviewColor(self):
426
 
        return(self.__prevcol)
427
 
 
428
 
 
429
 
    def SetPreviewPenSize(self, prevpensize):
430
 
        self.__prevpensize= int(prevpensize)
431
 
 
432
 
 
433
 
    def GetPreviewPenSize(self):
434
 
        return(self.__prevpensize)
435
 
 
436
 
 
437
 
    def SetPreviewPenStyle(self, prevpenstyle):
438
 
        self.__prevpenstyle= str(prevpenstyle)
439
 
 
440
 
 
441
 
    def GetPreviewPenStyle(self):
442
 
        return (self.__prevpenstyle)
443
 
 
444
 
 
445
 
    def SetStCoordW(self, stcoordw):
446
 
        self.__stcoordw= int(stcoordw)
447
 
 
448
 
 
449
 
    def GetStCoordW(self):
450
 
        return (self.__stcoordw)
451
 
 
452
 
 
453
 
    def SetSelCol(self, selcol):
454
 
        self.__selcol= str(selcol)
455
 
 
456
 
 
457
 
    def GetSelCol(self):
458
 
        return(self.__selcol)
459
 
 
460
 
 
461
 
    def SetDlgAttrSize(self, width, height):
462
 
        self.__dlgattrsize= (width, height)
463
 
 
464
 
 
465
 
    def GetDlgAttrSize(self):
466
 
        return(self.__dlgattrsize)
467
 
 
468
 
 
469
 
    def SetOptListWidths(self, w1, w2):
470
 
        self.__optlistwidths= (w1, w2)
471
 
 
472
 
 
473
 
    def GetOptListWidths(self):
474
 
        return(self.__optlistwidths)
475
 
 
476
 
 
477
 
    def SetAttrListWidths(self, w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15):
478
 
        self.__attrlistwidths= (w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15)
479
 
 
480
 
 
481
 
    def GetAttrListWidths(self):
482
 
        return(self.__attrlistwidths)
483
 
 
484
 
 
485
 
    def SetDrawDefColor(self, name, value, label):
486
 
        self.__drawdefcolor= (name, value, label)
487
 
 
488
 
 
489
 
    def SetDrawDefLayer(self, name, label):
490
 
        self.__drawdeflayer= (name, label)
491
 
 
492
 
 
493
 
    def SetDrawDefStyle(self, name, value, label):
494
 
        self.__drawdefstyle= (name, value, label)
495
 
 
496
 
 
497
 
    def SetDrawDefWidth(self, name, value, label):
498
 
        self.__drawdefwidth= (name, value, label)
499
 
 
500
 
 
501
 
    def GetDrawDefColor(self):
502
 
        return(self.__drawdefcolor)
503
 
 
504
 
 
505
 
    def GetDrawDefLayer(self):
506
 
        return(self.__drawdeflayer)
507
 
 
508
 
 
509
 
    def GetDrawDefStyle(self):
510
 
        return(self.__drawdefstyle)
511
 
 
512
 
 
513
 
    def GetDrawDefWidth(self):
514
 
        return(self.__drawdefwidth)
515
 
 
516
 
 
517
 
if __name__== '__main__':
518
 
    options= LorzeOptions()
519
 
    # wx for load and save configurations
520
 
    app= wx.App()
521
 
 
522
 
    # test, flag, True= test the object, False= reset lorze options
523
 
    test= False
524
 
 
525
 
    if test== True:
526
 
        # test LorzeOptions()
527
 
        print('Values after initialization')
528
 
        print(options.GetFrameSize())
529
 
        print(options.GetFrameTitle())
530
 
        print(options.GetGDIBorder())
531
 
        print(options.GetDezPlcs())
532
 
        print(options.GetCursorGdi())
533
 
        print(options.GetCursorWin())
534
 
        print(options.GetDlgBorder())
535
 
        print(options.GetDlgOptSize())
536
 
        print(options.GetSbRange())
537
 
        print(options.GetSbSize())
538
 
        print(options.GetWheelEnlarge())
539
 
        print(options.GetWheelReduce())
540
 
        print(options.GetSensitive())
541
 
        print(options.GetMaxPenStyleScale())
542
 
        print(options.GetMaxUserScale())
543
 
        print(options.GetSmartCursSize())
544
 
        print(options.GetSmartCursPenSize())
545
 
        print(options.GetSmartCursColPoint())
546
 
        print(options.GetSmartCursColSegm())
547
 
        print(options.GetSmartCursColElem())
548
 
        print(options.GetSmartCursMarkPenSize())
549
 
        print(options.GetPreviewColor())
550
 
        print(options.GetPreviewPenSize())
551
 
        print(options.GetPreviewPenStyle())
552
 
        print(options.GetStCoordW())
553
 
        print(options.GetSelCol())
554
 
        print(options.GetDlgAttrSize())
555
 
        print(options.GetOptListWidths())
556
 
        print(options.GetAttrListWidths())
557
 
        print(options.GetDrawDefColor())
558
 
        print(options.GetDrawDefLayer())
559
 
        print(options.GetDrawDefStyle())
560
 
        print(options.GetDrawDefWidth())
561
 
 
562
 
        print('Set new values')
563
 
        options.SetFrameSize(100, 200)
564
 
        options.SetGDIBorder('wx.RAISED_BORDER')
565
 
        options.SetDezPlcs(3)
566
 
        options.SetCursorGdi('wx.CURSOR_SPRAYCAN')
567
 
        options.SetCursorWin('wx.CURSOR_BULLSEYE')
568
 
        options.SetDlgBorder(7)
569
 
        options.SetDlgOptSize(222, 333)
570
 
        options.SetSbRange(444)
571
 
        options.SetSbSize(55)
572
 
        options.SetWheelEnlarge(7.7)
573
 
        options.SetWheelReduce(0.55)
574
 
        options.SetSensitive(18)
575
 
        options.SetMaxPenStyleScale(66)
576
 
        options.SetMaxUserScale(1111)
577
 
        options.SetSmartCursSize(22)
578
 
        options.SetSmartCursPenSize(4)
579
 
        options.SetSmartCursColPoint('#FF0000')
580
 
        options.SetSmartCursColSegm('#FFFFFF')
581
 
        options.SetSmartCursColElem('#00FF00')
582
 
        options.SetSmartCursMarkPenSize(9.9)
583
 
        options.SetPreviewColor('#FFFFFA')
584
 
        options.SetPreviewPenSize(6)
585
 
        options.SetPreviewPenStyle('wx.DOT')
586
 
        options.SetStCoordW(222)
587
 
        options.SetSelCol('#ABCDEF')
588
 
        options.SetDlgAttrSize(444, 555)
589
 
        options.SetOptListWidths(123, 124)
590
 
        options.SetAttrListWidths(100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115)
591
 
        options.SetDrawDefColor('White', '255, 255, 255', 'Colour test')
592
 
        options.SetDrawDefLayer('Default', 'Layer test')
593
 
        options.SetDrawDefStyle('Dot', 'DOT', 'Line style test')
594
 
        options.SetDrawDefWidth('2 mm', '2.0', 'Line width test')
595
 
 
596
 
        print('Frameszize should be 100, 200 / it is', options.GetFrameSize())
597
 
        print('Frametitle was not modified / it is', options.GetFrameTitle())
598
 
        print('GDIBorder should be wx.RAISED_BORDER / it is', options.GetGDIBorder())
599
 
        print('DezPlcs should be 3 / it is', options.GetDezPlcs())
600
 
        print('CursorGDI should be wx.CURSOR_SPRAYCAN / it is', options.GetCursorGdi())
601
 
        print('CursorWin should be wx.CURSOR_BULLSEYE / it is', options.GetCursorWin())
602
 
        print('Dialog border should be 7 / it is', options.GetDlgBorder())
603
 
        print('Options-dialog size should be 222, 333 / it is', options.GetDlgOptSize())
604
 
        print('Scrollable range should be 444 / it is', options.GetSbRange())
605
 
        print('Size scrollbar slider should be 55 / it is', options.GetSbSize())
606
 
        print('Enlarge factor mouse whee should be 7.7 / it is', options.GetWheelEnlarge())
607
 
        print('Reduce factor mouse wheel should be 0.55 / it is', options.GetWheelReduce())
608
 
        print('Pixel size smart cursor should be 18 / it is', options.GetSensitive())
609
 
        print('Maximum scale factor penstyles should be 66 / it is', options.GetMaxPenStyleScale())
610
 
        print('Maximum userscale should be 1111 / it is', options.GetMaxUserScale())
611
 
        print('Smart cursor mark size should be 22 / it is', options.GetSmartCursSize())
612
 
        print('Smart cursor mark pen size should be 4 / it is', options.GetSmartCursPenSize())
613
 
        print('Smart cursor color point mark should be #FF0000 / it is', options.GetSmartCursColPoint())
614
 
        print('Smart cursor color point mark should be #FFFFFF / it is', options.GetSmartCursColSegm())
615
 
        print('Smart cursor color point mark should be #00FF00 / it is', options.GetSmartCursColElem())
616
 
        print('Smart cur. pen size fact. marked elem. should be 9.9 / it is', options.GetSmartCursMarkPenSize())
617
 
        print('Preview color shuld be #FFFFFA / it is', options.GetPreviewColor())
618
 
        print('Preview pen size should be 6 / it is', options.GetPreviewPenSize())
619
 
        print('Preview pen style should be wx.DOT / it is', options.GetPreviewPenStyle())
620
 
        print('Width field coordinates should be 222 / it is', options.GetStCoordW())
621
 
        print('Selectet elements color should be #ABCDEF / it is', options.GetSelCol())
622
 
        print('Options-dialog size should be 444, 555 / it is', options.GetDlgAttrSize())
623
 
        print('List width option values should be 123, 124 / it is', options.GetOptListWidths())
624
 
        print('List width attributes values should be 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115 / it is', options.GetAttrListWidths())
625
 
        print('Default drawing colour should be White, 255, 255, 255, Colour test / it is', options.GetDrawDefColor())
626
 
        print('Default drawing layer should be Default, Layer test / it is', options.GetDrawDefLayer())
627
 
        print('Default drawing line style should be Dot, DOT, Line style test / it is', options.GetDrawDefStyle())
628
 
        print('Default drawing line width should be 2 mm, 2.0, Line width test / it is', options.GetDrawDefWidth())
629
 
 
630
 
        print(u'Save new options')
631
 
        options.SaveOptions()
632
 
        print(u'Restart LorzeOptions to load')
633
 
 
634
 
    else:
635
 
        # reset & save options
636
 
        print('reset & save options .. done.')
637
 
        options.Reset()
638
 
        options.SaveOptions()
639