Skip to content

Commit

Permalink
Allow custom pak size
Browse files Browse the repository at this point in the history
Also adds 256, 320, 512 as defaults on dropdown

Bumps version to 1.1.2
  • Loading branch information
An-dz committed Aug 12, 2019
1 parent e78ca0f commit 113b9f0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
10 changes: 5 additions & 5 deletions config.py
Expand Up @@ -66,12 +66,12 @@ class Config(object):
"default_language": "English",
}
internals = {
"version": "1.1.1",
"version": "1.1.2",
"TCPversion": "1.1",
"choicelist_paksize": [16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240],
"choicelist_views": [1, 2, 4],
"choicelist_dims": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
"choicelist_dims_z": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
"choicelist_paksize": [16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256, 320, 512],
"choicelist_views": [1, 2, 4],
"choicelist_dims": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
"choicelist_dims_z": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
}

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion languages/tc_en.tab
Expand Up @@ -118,7 +118,7 @@ Here you can enter the datfile properties necessary to produce a building using
240
240
tt_dims_paksize_select
Select the paksize of the project from the dropdown list
Select the paksize of the project from the dropdown list (allowed: 16-32765)
tt_facing_select_north
View/modify the North-facing view of this building
tt_menu_help_help
Expand Down
2 changes: 1 addition & 1 deletion project.py
Expand Up @@ -692,7 +692,7 @@ def transparency(self, set=None, validate=False):
def paksize(self, set=None, validate=False):
"""Set or return paksize"""
if set is not None:
if set in config.choicelist_paksize:
if int(set) in range(16, 32766):
if not validate:
self.props["dims"]["paksize"] = int(set)
logging.debug("project: paksize - set to %i" % self.props["dims"]["paksize"])
Expand Down
2 changes: 1 addition & 1 deletion tcproject.py
Expand Up @@ -358,7 +358,7 @@ def z(self, set=None):
def paksize(self, set=None):
"""Set or return paksize"""
if set != None:
if set in config.choicelist_paksize:
if int(set) in range(16, 32766):
self.dims.paksize = int(set)
logging.info("Paksize set to %i" % self.dims.paksize)
self.on_change()
Expand Down
11 changes: 6 additions & 5 deletions tcui/controlDims.py
Expand Up @@ -24,7 +24,7 @@ def __init__(self, parent, app):

# Add items
self.dims_p_label = wx.StaticText(self, wx.ID_ANY, "", (-1, -1), (-1, -1))
self.dims_p_select = wx.ComboBox( self, wx.ID_ANY, "", (-1, -1), (-1, -1), style=wx.CB_READONLY)
self.dims_p_select = wx.ComboBox( self, wx.ID_ANY, "", (-1, -1), (-1, -1))
self.dims_z_label = wx.StaticText(self, wx.ID_ANY, "", (-1, -1), (-1, -1))
self.dims_z_select = wx.ComboBox( self, wx.ID_ANY, "", (-1, -1), (-1, -1), style=wx.CB_READONLY)
self.dims_pz_sizer = wx.BoxSizer(wx.VERTICAL)
Expand Down Expand Up @@ -65,7 +65,7 @@ def __init__(self, parent, app):
self.SetSizer(self.sizer)

# Bind functions
self.dims_p_select.Bind(wx.EVT_COMBOBOX, self.OnPaksizeSelect, self.dims_p_select)
self.dims_p_select.Bind(wx.EVT_TEXT, self.OnPaksizeSelect, self.dims_p_select)
self.dims_z_select.Bind(wx.EVT_COMBOBOX, self.OnZdimsSelect, self.dims_z_select)
self.dims_x_select.Bind(wx.EVT_COMBOBOX, self.OnXdimsSelect, self.dims_x_select)
self.dims_y_select.Bind(wx.EVT_COMBOBOX, self.OnYdimsSelect, self.dims_y_select)
Expand Down Expand Up @@ -129,16 +129,17 @@ def translate(self):
def update(self):
"""Set the values of the controls in this group to the values in the project"""
logging.info("tcui.controlDims: update")
self.dims_p_select.SetSelection(config.choicelist_paksize.index(self.app.activeproject.paksize()))
self.dims_p_select.SetValue(str(self.app.activeproject.paksize()))
self.dims_z_select.SetSelection(config.choicelist_dims_z.index( self.app.activeproject.z()))
self.dims_x_select.SetSelection(config.choicelist_dims.index( self.app.activeproject.x()))
self.dims_y_select.SetSelection(config.choicelist_dims.index( self.app.activeproject.y()))

def OnPaksizeSelect(self, e):
"""Change value of the paksize"""
logging.info("tcui.controlDims: OnPaksizeSelect")
self.app.activeproject.paksize(config.choicelist_paksize[self.choicelist_packsize.index(self.dims_p_select.GetValue())])
self.app.frame.display.update()
if self.app.activeproject.paksize() != int(self.dims_p_select.GetValue()):
self.app.activeproject.paksize(self.dims_p_select.GetValue())
self.app.frame.display.update()

def OnZdimsSelect(self, e):
"""Change value of the Z dims"""
Expand Down

0 comments on commit 113b9f0

Please sign in to comment.