|
15 | 15 | configurations file, parse arguments from command lines, and also parse |
16 | 16 | arguments passed from method/function calling inside python. |
17 | 17 |
|
18 | | -This one is similar to ConfigBase but use Traits, so every option (self.*option* is a trait) |
19 | | -
|
20 | | -Note: for python 2.6, argparse and orderedDict is required, install them with easy_install |
| 18 | +This one is similar to ConfigBase but use Traits, so every option |
| 19 | +(self.*option* is a trait) can be observed and have a GUI interface. |
21 | 20 | """ |
22 | 21 |
|
23 | | -import argparse |
24 | | -import os |
25 | | -import re |
26 | | -import sys |
27 | | -from configparser import ConfigParser |
28 | | -from functools import partial |
29 | | - |
30 | 22 | from traits.api import ( |
31 | 23 | Array, |
32 | 24 | Bool, |
33 | 25 | CFloat, |
34 | 26 | CInt, |
35 | 27 | Directory, |
36 | 28 | Enum, |
37 | | - Event, |
38 | 29 | File, |
39 | | - Float, |
40 | 30 | HasTraits, |
41 | | - Instance, |
42 | | - Int, |
43 | 31 | List, |
44 | | - Property, |
45 | | - Range, |
46 | | - Str, |
47 | 32 | String, |
48 | | - cached_property, |
49 | | - on_trait_change, |
50 | 33 | ) |
51 | | -from traitsui.api import Group, Item, View |
52 | 34 |
|
53 | 35 | from diffpy.srxconfutils.config import ConfigBase |
54 | | -from diffpy.srxconfutils.tools import ( |
55 | | - StrConv, |
56 | | - _configPropertyR, |
57 | | - _configPropertyRad, |
58 | | - _configPropertyRW, |
59 | | - opt2Str, |
60 | | - str2bool, |
61 | | - str2Opt, |
62 | | -) |
63 | 36 |
|
64 | 37 |
|
65 | 38 | class ConfigBaseTraits(HasTraits, ConfigBase): |
66 | 39 | """_optdatalist_default, _optdatalist are metadata used to |
67 | 40 | initialize the options, see below for examples. |
68 | 41 |
|
69 | | - options presents in --help (in cmd), config file, headers have same order as |
70 | | - in these list, so arrange them in right order here. |
| 42 | + options presents in --help (in cmd), config file, headers have |
| 43 | + same order as in these list, so arrange them in right order here. |
71 | 44 |
|
72 | 45 | optional args to control if the options presents in args, config file or |
73 | 46 | file header |
@@ -165,7 +138,10 @@ class ConfigBaseTraits(HasTraits, ConfigBase): |
165 | 138 | "sec": "Control", |
166 | 139 | "config": "n", |
167 | 140 | "header": "n", |
168 | | - "h": "create a config file according to default or current values", |
| 141 | + "h": ( |
| 142 | + "create a config file according to " |
| 143 | + "default or current values" |
| 144 | + ), |
169 | 145 | "d": "", |
170 | 146 | }, |
171 | 147 | ], |
@@ -269,8 +245,12 @@ class ConfigBaseTraits(HasTraits, ConfigBase): |
269 | 245 | "config": "f", |
270 | 246 | "tt": "array", |
271 | 247 | "l": "Mask edges", |
272 | | - "h": "mask the edge pixels, first four means the number of pixels masked in each edge \ |
273 | | - (left, right, top, bottom), the last one is the radius of a region masked around the corner", |
| 248 | + "h": ( |
| 249 | + "mask the edge pixels, first four means " |
| 250 | + "the number of pixels masked in each edge " |
| 251 | + "(left, right, top, bottom), the last one is the " |
| 252 | + "radius of a region masked around the corner" |
| 253 | + ), |
274 | 254 | "n": 5, |
275 | 255 | "d": [10, 10, 10, 10, 100], |
276 | 256 | }, |
|
0 commit comments