| 1 |
# *************************************************************************** |
| 2 |
# * Copyright (c) 2022 Zheng Lei (realthunder) <[email protected]>* |
| 3 |
# * * |
| 4 |
# * This program is free software; you can redistribute it and/or modify * |
| 5 |
# * it under the terms of the GNU Lesser General Public License (LGPL) * |
| 6 |
# * as published by the Free Software Foundation; either version 2 of * |
| 7 |
# * the License, or (at your option) any later version. * |
| 8 |
# * for detail see the LICENCE text file. * |
| 9 |
# * * |
| 10 |
# * This program is distributed in the hope that it will be useful, * |
| 11 |
# * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 |
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 |
# * GNU Library General Public License for more details. * |
| 14 |
# * * |
| 15 |
# * You should have received a copy of the GNU Library General Public * |
| 16 |
# * License along with this program; if not, write to the Free Software * |
| 17 |
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * |
| 18 |
# * USA * |
| 19 |
# * * |
| 20 |
# *************************************************************************** |
| 21 |
"""Auto code generator for parameters in Preferences/TreeView""" |
| 22 |
import sys |
| 23 |
from os import path |
| 24 |
|
| 25 |
# import Tools/params_utils.py |
| 26 |
sys.path.append(path.join(path.dirname(path.dirname(path.abspath(__file__))), "Tools")) |
| 27 |
import params_utils |
| 28 |
|
| 29 |
from params_utils import ( |
| 30 |
ParamBool, |
| 31 |
ParamInt, |
| 32 |
ParamString, |
| 33 |
ParamUInt, |
| 34 |
ParamFloat, |
| 35 |
ParamSpinBox, |
| 36 |
ParamColor, |
| 37 |
ParamHex, |
| 38 |
) |
| 39 |
|
| 40 |
NameSpace = "Gui" |
| 41 |
ClassName = "TreeParams" |
| 42 |
ParamPath = "User parameter:BaseApp/Preferences/TreeView" |
| 43 |
ClassDoc = "Convenient class to obtain tree view related parameters" |
| 44 |
SourceFile = "Tree.cpp" |
| 45 |
|
| 46 |
Params = [ |
| 47 |
ParamBool("SyncSelection", True, on_change=True), |
| 48 |
ParamBool("CheckBoxesSelection", False, on_change=True, title="Show item checkbox"), |
| 49 |
ParamBool("SyncView", True), |
| 50 |
ParamBool("PreSelection", True), |
| 51 |
ParamBool("SyncPlacement", False), |
| 52 |
ParamBool("RecordSelection", True), |
| 53 |
ParamInt("DocumentMode", 2, on_change=True), |
| 54 |
ParamInt("StatusTimeout", 100), |
| 55 |
ParamInt("SelectionTimeout", 100), |
| 56 |
ParamInt("PreSelectionTimeout", 500), |
| 57 |
ParamInt("PreSelectionDelay", 700), |
| 58 |
ParamInt("PreSelectionMinDelay", 200), |
| 59 |
ParamBool("RecomputeOnDrop", True), |
| 60 |
ParamBool("KeepRootOrder", True), |
| 61 |
ParamBool("TreeActiveAutoExpand", True), |
| 62 |
ParamUInt("TreeActiveColor", 0xE6E6FFFF, on_change=True), |
| 63 |
ParamUInt("TreeEditColor", 0x929200FF, on_change=True), |
| 64 |
ParamUInt("SelectingGroupColor", 0x408081FF, on_change=True), |
| 65 |
ParamBool("TreeActiveBold", True, on_change=True), |
| 66 |
ParamBool("TreeActiveItalic", False, on_change=True), |
| 67 |
ParamBool("TreeActiveUnderlined", False, on_change=True), |
| 68 |
ParamBool("TreeActiveOverlined", False, on_change=True), |
| 69 |
ParamInt("Indentation", 0, on_change=True), |
| 70 |
ParamBool("LabelExpression", False), |
| 71 |
ParamInt("IconSize", 0, on_change=True), |
| 72 |
ParamInt( |
| 73 |
"FontSize", |
| 74 |
0, |
| 75 |
on_change=True, |
| 76 |
title="Font size", |
| 77 |
proxy=ParamSpinBox(0, 100, 1, suffix=" pt"), |
| 78 |
), |
| 79 |
ParamInt("ItemSpacing", 0, on_change=True), |
| 80 |
ParamHex( |
| 81 |
"ItemBackground", |
| 82 |
0, |
| 83 |
on_change=True, |
| 84 |
title="Item background color", |
| 85 |
proxy=ParamColor(), |
| 86 |
doc="Tree view item background. Only effective in overlay.", |
| 87 |
), |
| 88 |
ParamInt( |
| 89 |
"ItemBackgroundPadding", |
| 90 |
0, |
| 91 |
on_change=True, |
| 92 |
title="Item background padding", |
| 93 |
proxy=ParamSpinBox(0, 100, 1, suffix=" px"), |
| 94 |
doc="Tree view item background padding.", |
| 95 |
), |
| 96 |
ParamBool( |
| 97 |
"HideColumn", |
| 98 |
True, |
| 99 |
on_change=True, |
| 100 |
title="Hide Description", |
| 101 |
doc="Hide extra tree view column for item description.", |
| 102 |
), |
| 103 |
ParamBool( |
| 104 |
"HideInternalNames", |
| 105 |
True, |
| 106 |
on_change=True, |
| 107 |
title="Hide Internal Names", |
| 108 |
doc="Hide extra tree view column - Internal Names.", |
| 109 |
), |
| 110 |
ParamBool( |
| 111 |
"HideScrollBar", |
| 112 |
True, |
| 113 |
title="Hide scroll bar", |
| 114 |
doc="Hide tree view scroll bar in dock overlay.", |
| 115 |
), |
| 116 |
ParamBool( |
| 117 |
"HideHeaderView", |
| 118 |
True, |
| 119 |
title="Hide header", |
| 120 |
doc="Hide tree view header view in dock overlay.", |
| 121 |
), |
| 122 |
ParamBool( |
| 123 |
"ResizableColumn", |
| 124 |
False, |
| 125 |
on_change=True, |
| 126 |
title="Resizable columns", |
| 127 |
doc="Allow tree view columns to be manually resized.", |
| 128 |
), |
| 129 |
ParamInt("ColumnSize1", 0), |
| 130 |
ParamInt("ColumnSize2", 0), |
| 131 |
ParamInt("ColumnSize3", 0), |
| 132 |
ParamBool("TreeToolTipIcon", False, title="Show icon in tool tip"), |
| 133 |
ParamBool( |
| 134 |
"VisibilityIcon", |
| 135 |
True, |
| 136 |
on_change=True, |
| 137 |
title="Show visibility icon", |
| 138 |
doc="Displays an eye icon in front of the tree view items, showing the items visibility status. When clicked the visibility is toggled", |
| 139 |
), |
| 140 |
] |
| 141 |
|
| 142 |
|
| 143 |
def declare_begin(): |
| 144 |
params_utils.declare_begin(sys.modules[__name__]) |
| 145 |
|
| 146 |
|
| 147 |
def declare_end(): |
| 148 |
params_utils.declare_end(sys.modules[__name__]) |
| 149 |
|
| 150 |
|
| 151 |
def define(): |
| 152 |
params_utils.define(sys.modules[__name__]) |
| 153 |
|
| 154 |
|
| 155 |
params_utils.init_params(Params, NameSpace, ClassName, ParamPath) |