예제 #1
0
        def dropDowns():
            self.drpDwnProj = forms.DropDown()
            self.drpDwnProj.DataStore = self.GetProjectList(r'J:\\')
            self.drpDwnProj.SelectedIndexChanged += self.OnProjectChanged

            self.drpDwnVersion = forms.DropDown()
            self.drpDwnVersion.Enabled = False
            self.drpDwnVersion.DataStore = ['---CREATE NEW---', '180427_Stacking']
            self.drpDwnVersion.SelectedIndexChanged += self.OnVersionChanged

            self.drpDwnProjState = forms.DropDown()
            self.drpDwnProjState.DataStore = self.states
            self.drpDwnProjState.SelectedKey = 'New York'
            self.drpDwnProjState.Enabled = False

            self.drpDwnProjCountry = forms.DropDown()
            self.drpDwnProjCountry.DataStore = self.countries
            self.drpDwnProjCountry.SelectedKey = 'United States of America'
            self.drpDwnProjCountry.Enabled = False
예제 #2
0
 def create_multidata_custom_cell_event(eventArgs):
     try:
         row_values = eventArgs.Item
         control = None
         if type == 'DropDown':
             control = forms.DropDown() 
         elif type == 'ListBox':
             control = forms.ListBox()
         else:
             return
         #drop down delegates
         def multidata_get_item_delegate(multidata_item):
             return multidata_item.item
             
         def multidata_get_selected_index_delegate():
             return row_values.GetItemDataAt(index).SelectedIndex
             
         def multidata_set_selected_index_delegate(sel_index):
             row_values.GetItemDataAt(index).SelectedIndex = sel_index
             #for test log:
             #name = row_values.GetItemDataAt(0)
             #num = row_values.GetItemDataAt(index).SelectedIndex 
             #item = row_values.GetItemDataAt(index).GetItemValueAt(num)
             #print name + " multidata is now set to " + item                         
             
         control.ItemTextBinding = \
             forms.DirectBinding.Delegate[MultiDataItem, System.String]\
                                 (multidata_get_item_delegate)
                               
         delegate = forms.DirectBinding.Delegate[System.Int32](
                        multidata_get_selected_index_delegate, 
                        multidata_set_selected_index_delegate)
         control.SelectedIndexBinding.Bind(delegate)
         
         control.DataStore = row_values.GetItemDataAt(index)
         #control.BackgroundColor = drawing.Color(0,0,1)
         #control.ShowBorder = False
         #control.SelectedIndexChanged += self.OnSelectedIndexChanged
         print "creating..."
     except Exception as e:
         print e         
     return control        
예제 #3
0
    def __init__(self):
        self.Title = "EasyCut"
        self.selected = []
        self.edgeshighlightMode = -1
        self.m_gridview = forms.GridView()
        self.m_gridview.ShowHeader = True
        self.Padding = drawing.Padding(10)
        self.Resizable = True
        num = 0
        for idx in range(len(ATTRS)):
            if num == QUANTITY_COLUMN_POS:
                attr = QUANT_FIELD
                column = forms.GridColumn()
                column.HeaderText = attr.name
                column.Editable = attr.isEditable
                column.DataCell = forms.TextBoxCell(num)
                self.m_gridview.Columns.Add(column)
                num += 1
            attr = ATTRS[idx]
            if attr.isOn:

                column = forms.GridColumn()
                column.HeaderText = attr.name
                column.Editable = attr.isEditable
                column.DataCell = forms.TextBoxCell(num)
                self.m_gridview.Columns.Add(column)
                num += 1

        self.precision_dropdownlist = forms.DropDown()
        self.precision_dropdownlist.DataStore = [
            '1', '0.1', '0.01', '0.001', '0.0001', '0.00001'
        ]
        self.precision_dropdownlist.SelectedIndex = DIM_PRECISION
        self.precision_label = forms.Label(Text="Dimensions precision ")
        self.precision_dropdownlist.DropDownClosed += self.changePrecisionVal

        layout0 = forms.TableLayout()
        cell = forms.TableCell(self.precision_label, scaleWidth=False)
        cell.ScaleWidth = False
        cell2 = forms.TableCell(self.precision_dropdownlist, scaleWidth=False)
        cell2.ScaleWidth = False
        row = forms.TableRow(None, cell, cell2)
        row.ScaleHeight = False
        layout0.Rows.Add(row)

        self.m_gridview.CellClick += self.gridClick
        self.m_gridview.SelectionChanged += self.gridSelChanged
        self.m_gridview.CellEdited += self.gridEdited
        self.m_gridview.CellFormatting += self.OnCellFormatting
        self.buttonAutoNum = forms.Button(self.buttonAutoNumClick)
        self.buttonAutoNum.Text = "Auto number"
        self.button = forms.Button(self.buttonClick)
        self.button.Text = "Export"
        layout = forms.TableLayout()
        layout.Spacing = drawing.Size(5, 5)
        cell = forms.TableCell(self.m_gridview)
        row = forms.TableRow(cell)
        row.ScaleHeight = True
        layout.Rows.Add(layout0)
        layout.Rows.Add(row)

        layout2 = forms.TableLayout()
        layout2.Spacing = drawing.Size(5, 5)

        cell = forms.TableCell(self.button, True)
        cell2 = forms.TableCell(self.buttonAutoNum, True)
        row = forms.TableRow([cell, cell2])

        layout2.Rows.Add(row)
        layout.Rows.Add(layout2)
        layout2 = forms.TableLayout()
        layout2.Spacing = drawing.Size(5, 5)
        self.m_linkbutton = forms.LinkButton(Text='Easycut')
        self.m_linkbutton.Click += self.OnLinkButtonClick
        self.m_donatebutton = forms.LinkButton(Text='Donate',
                                               Style="right-align")
        self.m_donatebutton.Click += self.OnDonateButtonClick
        cell = forms.TableCell(self.m_linkbutton, True)
        cell2 = forms.TableCell(None, False)
        cell3 = forms.TableCell(self.m_donatebutton, False)
        row = forms.TableRow([cell, cell2, cell3])
        layout2.Rows.Add(row)

        layout.Rows.Add(layout2)

        self.Content = layout
예제 #4
0
        def __init__(self):
            # Initialize dialog box
            self.Title = 'LandArchTools: Stair Generator'
            self.Padding = drawing.Padding(10)
            self.Resizable = False
            self.Closing += self.OnFormClosed
    ################################################################################

            # Create controls for the dialog
            # Stair gen label
            self.stairGenLabel = forms.Label(Text='STAIR GENERATOR')

            # Gen Handrail label
            self.genStairLabel = forms.Label(Text='Generate Stair?:')
            # Gen Handrail control
            self.genStairBool = forms.CheckBox()
            self.genStairBool.Checked = False
            self.genStairBool.CheckedChanged += self.stairGen

            # Number of Steps Label
            self.numStepsLabel = forms.Label(Text='Number of steps:')
            # Number of Steps control
            self.numStepsC = forms.NumericStepper()
            self.numStepsC.DecimalPlaces = 0
            self.numStepsC.Increment = 1
            self.numStepsC.MaxValue = 100
            self.numStepsC.MinValue = 2
            self.numStepsC.Value = 3
            self.numStepsC.ValueChanged += self.stairGen
            self.numStepsC.ValueChanged += self.handrailGen

            # Tread label
            self.treadLabel = forms.Label(Text='Tread (mm):')
            # Tread length control
            self.treadC = forms.NumericStepper()
            self.treadC.DecimalPlaces = 0
            self.treadC.Increment = 1
            self.treadC.MaxValue = 1000
            self.treadC.MinValue = 1
            self.treadC.Value = 300
            self.treadC.ValueChanged += self.stairGen
            self.treadC.ValueChanged += self.handrailGen

            # Riser Label
            self.riserLabel = forms.Label(Text='Riser (mm):')
            # Tread length control
            self.riserC = forms.NumericStepper()
            self.riserC.DecimalPlaces = 0
            self.riserC.Increment = 1
            self.riserC.MaxValue = 1000
            self.riserC.MinValue = 1
            self.riserC.Value = 150
            self.riserC.ValueChanged += self.stairGen
            self.riserC.ValueChanged += self.handrailGen

            # Flip label
            self.flipLabel = forms.Label(Text='Flip direction of stairs:')
            # Flip control
            self.flipC = forms.CheckBox()
            self.flipC.CheckedChanged += self.stairGen
            self.flipC.CheckedChanged += self.handrailGen

            ###########################################
            # Handrail Gen Label
            self.handrailGenLabel = forms.Label(Text='HANDRAIL GENERATOR')
            # self.handrailGenLabel.VerticalAlignment.Center

            # Gen Handrail label
            self.genHandrailLabel = forms.Label(Text='Generate Handrail?:')
            # Gen Handrail control
            self.genHandrailBool = forms.CheckBox()
            self.genHandrailBool.Checked = False
            self.genHandrailBool.CheckedChanged += self.handrailGen

            # Handrail Type Label
            self.handrailTypeLabel = forms.Label(Text='Handrail type:')
            # Handrail Type Dropdown
            self.handrailTypeC = forms.DropDown()
            self.handrailTypeC.DataStore = [
                '180 No Return', '180 Full Return', 'Ground Triangular Return', 'Ground Return', 'Wall Return']
            self.handrailTypeC.SelectedIndex = 0
            self.handrailTypeC.SelectedIndexChanged += self.handrailGen

            # Handrail Height Label
            self.handrailHeightLabel = forms.Label(
                Text='Handrail height (mm):')
            # Handrail Height control
            self.handrailHeightC = forms.NumericStepper()
            self.handrailHeightC.DecimalPlaces = 0
            self.handrailHeightC.Increment = 1
            self.handrailHeightC.MaxValue = 5000
            self.handrailHeightC.MinValue = 100
            self.handrailHeightC.Value = 900
            self.handrailHeightC.ValueChanged += self.handrailGen

            # Handrail offset label
            self.handrailOffsetLabel = forms.Label(
                Text='Handrail offset from edges (mm):')
            # Handrail offset control
            self.handrailOffsetC = forms.NumericStepper()
            self.handrailOffsetC.DecimalPlaces = 0
            self.handrailOffsetC.Increment = 1
            self.handrailOffsetC.MaxValue = 5000
            self.handrailOffsetC.MinValue = 50
            self.handrailOffsetC.Value = 150
            self.handrailOffsetC.ValueChanged += self.handrailGen

            # Handrail extension Label
            self.handrailExtensionLabel = forms.Label(
                Text='Handrail extension (mm):')
            # Handrail extension Control
            self.handrailExtensionC = forms.NumericStepper()
            self.handrailExtensionC.DecimalPlaces = 0
            self.handrailExtensionC.Increment = 1
            self.handrailExtensionC.MaxValue = 5000
            self.handrailExtensionC.MinValue = 300
            self.handrailExtensionC.Value = 300
            self.handrailExtensionC.ValueChanged += self.handrailGen

            # Handrail Diameter Label
            self.handrailDiameterLabel = forms.Label(
                Text='Handrail diameter (mm):')
            # Handrail Diameter control
            self.handrailDiameterC = forms.NumericStepper()
            self.handrailDiameterC.DecimalPlaces = 0
            self.handrailDiameterC.Increment = 1
            self.handrailDiameterC.MaxValue = 50
            self.handrailDiameterC.MinValue = 30
            self.handrailDiameterC.Value = 30
            self.handrailDiameterC.ValueChanged += self.handrailGen

            # Create the default button
            self.DefaultButton = forms.Button(Text='OK')
            self.DefaultButton.Click += self.OnOKButtonClick

            # Create the abort button
            self.AbortButton = forms.Button(Text='Cancel')
            self.AbortButton.Click += self.OnCloseButtonClick

    ################################################################################

            # Create a table layout and add all the controls
            layout = forms.DynamicLayout()
            layout.Spacing = drawing.Size(5, 5)

            layout.AddRow(None)
            layout.AddRow(self.stairGenLabel)
            layout.AddRow(None)
            layout.AddRow(None)
            layout.AddRow(self.genStairLabel, self.genStairBool)
            layout.AddRow(self.numStepsLabel, self.numStepsC)
            layout.AddRow(self.treadLabel, self.treadC)
            layout.AddRow(self.riserLabel, self.riserC)
            layout.AddRow(self.flipLabel, self.flipC)
            layout.AddRow(None)
            layout.AddRow(None)
            layout.AddRow(None)
            layout.AddRow(None)
            layout.AddRow(self.handrailGenLabel)
            layout.AddRow(None)
            layout.AddRow(None)
            layout.AddRow(self.genHandrailLabel, self.genHandrailBool)
            layout.AddRow(self.handrailTypeLabel, self.handrailTypeC)
            layout.AddRow(self.handrailHeightLabel, self.handrailHeightC)
            layout.AddRow(self.handrailOffsetLabel, self.handrailOffsetC)
            layout.AddRow(self.handrailExtensionLabel, self.handrailExtensionC)
            layout.AddRow(self.handrailDiameterLabel, self.handrailDiameterC)
            layout.AddRow(self.DefaultButton, self.AbortButton)

            # Set the dialog content
            self.Content = layout
    def __init__(self, osStandards):
        self.toggleButton = forms.ToggleButton
        self.textField = forms.TextBox
        self.objfilter = sum([16,8,32,1073741824])
        self.obj = rs.GetObject("Select Object to Apply Zone Data to:", filter=self.objfilter, preselect=True)
        self.osStandards = osStandards['space_types']['90.1-2007']['ClimateZone 1-8']
        self.bldg = ''
        self.zone = ''
        self.Standards = []
        self.Title = "Zone Load Data"
        self.Padding = drawing.Padding(10)
        self.Resizeable = False
        self.fieldsDict = {
            'bldgProgram': [forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
            'zoneProgram': [forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
            'equipmentLoadPerArea': [forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
            'infilRatePerArea_Facade': [forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
            'lightingDensityPerArea':[ forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
            'numOfPeoplePerArea': [forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
            'ventilationPerArea': [forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
            'ventilationPerPerson': [forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
            'recirculatedAirPerArea': [forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
            'isConditioned': [forms.ToggleButton(Text = 'Yes'), forms.CheckBox(Text = "Lock")],
            'maxRoofAngle': [forms.TextBox(Text = None), forms.CheckBox(Text = "Lock")],
        }
        self.GetExistingValues()
        self.bldg_dropdownlist = forms.DropDown()
        self.bldg_dropdownlist.DataStore = self.osStandards  
        self.bldg_dropdownlist.DropDownClosed += self.Bldg_DD_Close
        
        self.zone_dropdownlist = forms.DropDown()
        self.zone_dropdownlist.DropDownClosed += self.Zone_DD_Close
        
        self.ApplyStandardsButton = forms.Button(Text = "Apply")
        self.ApplyStandardsButton.Click += self.OnApplyButtonClick
        
        self.DefaultButton = forms.Button(Text = "OK")
        self.DefaultButton.Click += self.OnOKButtonClick
        
        self.AbortButton = forms.Button(Text = "Cancel")
        self.AbortButton.Click += self.OnCloseButtonClick
        
        # Add Toggle Events 
        for k,v in self.fieldsDict.items():
            if isinstance(v[0], self.toggleButton):
                v[0].Click += self.ToggleClick

        #Create Layout
        layout = forms.DynamicLayout()
        layout.Spacing = drawing.Size(5,5)
        
        # Add Drop Down list
        layout.AddRow(self.bldg_dropdownlist, self.zone_dropdownlist)

        # Add Apply Standards
        layout.AddRow(self.ApplyStandardsButton)
        self.ApplyStandardsButton.Enabled = False
        
        # Add Fields
        for k,v in self.fieldsDict.items():
            self.m_label = forms.Label(Text = str(k))
            layout.AddRow(self.m_label, v[0], v[1])
            layout.AddRow(None)
            
        #Add Ok Close buttons
        layout.AddRow(self.DefaultButton, self.AbortButton)
        
        #Apply Layout to Form
        self.Content = layout
예제 #6
0
    def create_location_group(self):

        #location name layout
        self.m_loc_name_text_box = forms.TextBox()
        self.m_loc_name_text_box.PlaceholderText = "Location name"
        layout_a = EtoUtil.create_layout_from_control_matrix(
            [[self.m_loc_name_text_box]])
        #
        # lat/long layout
        lat_label = forms.Label(Text='Lat:')
        self.m_numeric_lat_updown = EtoUtil.create_numeric_stepper(decimal_places = 3,
                                                 increment = 1,
                                                 value = 0,
                                                 min = -90,
                                                 max = 90,
                                                 format_string = "{0:f3}\N{DEGREE SIGN}",
                                                 change_event_method =\
                                                  self.on_latitude_value_changed)

        long_label = forms.Label(Text='   Long:')
        self.m_numeric_long_updown = EtoUtil.create_numeric_stepper(decimal_places = 3,
                                                 increment = 1,
                                                 value = 0,
                                                 min = -90,
                                                 max = 90,
                                                 format_string = "{0:f3}\N{DEGREE SIGN}",
                                                 change_event_method =\
                                                  self.on_longitude_value_changed)

        layout_b = EtoUtil.create_layout_from_control_matrix([[
            lat_label, self.m_numeric_lat_updown, long_label,
            self.m_numeric_long_updown
        ]], drawing.Padding(5, 15, 5, 0))
        #
        # time zone layout
        timezone_label = forms.Label(Text='Time zone:')
        self.m_timezone_dropdown = forms.DropDown()
        time_zones = [
            '(UTC -12:00)', '(UTC -11:00)', '(UTC -10:00)', '(UTC -09:00)',
            '(UTC -08:00)', '(UTC -07:00)', '(UTC -06:00)', '(UTC -05:00)',
            '(UTC -04:00)', '(UTC -03:00)', '(UTC -02:00)', '(UTC -01:00)',
            '(UTC 00:00)', '(UTC 01:00)', '(UTC 02:00)', '(UTC 03:00)',
            '(UTC 04:00)', '(UTC 05:00)', '(UTC 06:00)', '(UTC 07:00)',
            '(UTC 08:00)', '(UTC 09:00)', '(UTC 10:00)', '(UTC 11:00)',
            '(UTC 12:00)'
        ]
        self.m_timezone_dropdown.DataStore = time_zones
        self.m_timezone_dropdown.SelectedIndex = 12
        self.m_timezone_dropdown.DropDownClosed += self.on_timezone_drop_down_closed
        layout_c = EtoUtil.create_layout_from_control_matrix(
            [[timezone_label], [self.m_timezone_dropdown]])
        #
        # elevation layout
        elev_label = forms.Label(Text='Elevation:')
        elev_label.Size = drawing.Size(140, 10)
        self.m_elev_updown = EtoUtil.create_numeric_stepper(decimal_places = 3,
                                                 increment = 1,
                                                 value = 0,
                                                 change_event_method =\
                                                  self.on_elevation_value_changed)
        layout_d = EtoUtil.create_layout_from_control_matrix(
            [[elev_label, self.m_elev_updown]])

        #Import location from epw layout
        epw_file_label = forms.Label(Text='Import location from epw file:')
        self.m_epw_file_picker = EtoUtil.create_file_picker(
            title="Select epw file",
            filter='epw',
            file_path_changed_event_method=self.on_epw_file_path_changed)
        self.m_epw_file = ""

        layout_e = EtoUtil.create_layout_from_control_matrix(
            [[epw_file_label], [self.m_epw_file_picker]])

        #
        # return group with created layout
        group_layout = EtoUtil.create_layout_from_control_matrix([[layout_a],
                                                                  [layout_b],
                                                                  [layout_c],
                                                                  [layout_d],
                                                                  [layout_e]])

        return EtoUtil.create_group_from_layout('Location', group_layout)