Beispiel #1
0
def getCustomToolPropertyContent():
    # Create a Grid
    my_Grid = WPFControls.Grid()

    # Add 2 Rows and 1 Column
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())

    currRow = 0
    # Create a button
    currRow += 1
    actionButton = WPFControls.Button()
    actionButton.Content = "Generate studies"
    WPFControls.Grid.SetRow(actionButton, currRow)
    WPFControls.Grid.SetColumn(actionButton, 0)
    actionButton.Height = 30
    WPFControls.Grid.SetColumnSpan(actionButton, 2)
    actionButton.Click += HandleApplyButton  # Link a function to the Button "Click" event

    my_Grid.Children.Add(actionButton)

    # Return the Grid
    return my_Grid
    def MakeItemHeader(self, diskFile):
        # RectangleGeometry...
        r = Media.RectangleGeometry()
        r.Rect = Windows.Rect(0, 0, 15, 15)
        r.RadiusX = 3
        r.RadiusY = 3

        # Inside a GeometryDrawing (and keep it in the DiskFile)...
        g = Media.GeometryDrawing()
        g.Geometry = r
        g.Pen = Media.Pen()
        g.Pen.Brush = Media.Brushes.Black
        # We will set the brush on render
        diskFile.drawing = g

        # Inside a DrawingImage...
        d = Media.DrawingImage()
        d.Drawing = g

        # Inside an Image...
        i = Controls.Image()
        i.Source = d

        # Inside a DockPanel with the name TextBlock beside it
        dock = Controls.DockPanel()
        dock.Children.Add(i)
        t = Controls.TextBlock()
        t.Text = ' ' + diskFile.name
        dock.Children.Add(t)
        return dock
Beispiel #3
0
    def __init__(self, conduit, show=True):
        super(ConduitMonitor,self).__init__()
        self.Width=100
        self.Height=200
        self.conduit=conduit

        layout = ws.StackPanel()
        layout.Orientation = ws.Orientation.Vertical
        bt1 = ws.Button()
        bt1.Content = 'enable'
        bt1.Click += self.enable
        bt2 = ws.Button()
        bt2.Content = 'disable'
        bt2.Click += self.disable
        layout.AddChild(bt1)
        layout.AddChild(bt2)

        self.Content=layout
        self.Closed+=self.disable

        if show:
            self.conduit.Enabled = True
            Rhino.RhinoDoc.ActiveDoc.Views.Redraw()

        System.Windows.Interop.WindowInteropHelper(self).Owner = Rhino.RhinoApp.MainWindowHandle()
        self.Show()
Beispiel #4
0
def createComboBox2(parent, title, labels, selected, row, col):
    textBlock = WPFControls.TextBlock()
    textBlock.Text = title

    textBlock.Margin = System.Windows.Thickness(5.)

    WPFControls.Grid.SetRow(textBlock, row)
    WPFControls.Grid.SetColumn(textBlock, col)

    parent.Children.Add(textBlock)

    comboBox = WPFControls.ComboBox()

    comboBox.Margin = System.Windows.Thickness(5.)

    for label in labels:
        item = WPFControls.ComboBoxItem()
        item.Content = label
        comboBox.Items.Add(item)

    WPFControls.Grid.SetRow(comboBox, row)
    WPFControls.Grid.SetColumn(comboBox, col + 1)

    if selected > len(labels): selected = 0
    comboBox.SelectedIndex = str(selected)

    parent.Children.Add(comboBox)

    return comboBox
Beispiel #5
0
 def __init__(self, parent, msg):
     wpf.LoadComponent(self, 'WizardDialog.xaml')
     self.Title = "Error"
     self.SizeToContent = SizeToContent.WidthAndHeight
     #self.WindowStartupLocation = WindowStartupLocation.Manual
     self.Left = parent.Left + parent.ActualWidth / 4
     self.Top = parent.Top + parent.ActualHeight / 4
     stack = Controls.StackPanel()
     stack.Orientation = Controls.Orientation.Horizontal
     stack.HorizontalAlignment = HorizontalAlignment.Center
     stack.Margin = Thickness(10.0, 6.0, 10.0, 6.0)
     errorImage = Controls.Image()
     errorImage.Margin = Thickness(6.0, 6.0, 0.0, 10.0)
     errorImage.Source = ImageAwesome.CreateImageSource(
         FontAwesomeIcon.ExclamationCircle, Media.Brushes.Red)
     errorImage.Width = 14
     errorImage.Height = 18
     stack.Children.Add(errorImage)
     label = Controls.Label()
     #label.Style = self.FindResource("ctrl")
     #label.FontSize = 16
     label.Content = msg
     label.Margin = Thickness(0.0, 6.0, 0.0, 10.0)
     stack.Children.Add(label)
     self.Base.Children.Add(stack)
     self.button = Controls.Button()
     #self.button.Style = self.FindResource("wzdbtn")
     self.button.Click += self.buttonClick
     self.button.Content = "OK"
     self.button.Width = 70
     self.button.Height = 30
     self.button.Margin = Thickness(0.0, 6.0, 0.0, 12.0)
     self.Base.Children.Add(self.button)
     self.ShowDialog()
Beispiel #6
0
def getCustomToolPropertyContent():
    #Create a Grid
    my_Grid = WPFControls.Grid()

    #Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())

    #Create a button and set it's text to "Import"
    #Assign it to Row1, Column 0
    exportBtn = WPFControls.Button()
    exportBtn.Content = "Export BDF from part"
    WPFControls.Grid.SetRow(exportBtn, 1)
    WPFControls.Grid.SetColumn(exportBtn, 0)
    exportBtn.Height = 30

    #Link a function to the Button "Click" event
    #This function will be called every time the Button is clicked
    exportBtn.Click += ExportBDFData

    # Add the controls to the Grid
    my_Grid.Children.Add(exportBtn)

    #Return the Grid
    return my_Grid
    def LoadSSList(self, name):
        """
        Get list of snapshots for given machine name/uuid
        """

        try:
            self.SSListBox.Items.Clear()

            cmd = '"%s" showvminfo "%s"' % (self.VBoxManageTextBox.Text, name)
            cmdoutput = subprocess.check_output(cmd)

            found_snapshot_string = False
            for line in str.splitlines(cmdoutput):
                if line.strip() == "":
                    continue

                if re.match("Snapshots:", line):
                    found_snapshot_string = True
                    continue

                if found_snapshot_string:
                    mobj = re.match("\s*Name: (.*) \(UUID: (.*)\)", line)
                    if mobj:
                        lbi = Controls.ListBoxItem()
                        lbi.Content = mobj.group(1)
                        self.SSListBox.Items.Add(lbi)
                    # no more snapshots found, exit loop
                    else:
                        break

        except Exception as err:
            raise err
Beispiel #8
0
def main():
    window = System.Windows.Window()
    sv = ws.ScrollViewer()

    layout = System.Windows.Controls.StackPanel()
    layout.Orientation = ws.Orientation.Vertical

    sv.Content = layout
    window.Content = sv
    window.Width = 200
    window.Height = 300

    rui = RUI()
    #rui.Width=window.Width
    #rui.Height=window.Height
    layout.Children.Add(rui)

    bt1 = NameButton('asd', rui, (100, 100))
    bt2 = NameButton('gdfa', rui, (150, 100))
    bt1.Content = 'fffff'
    line(0, 0, 100, 100, rui)
    rui.Children.Remove(bt2)
    rui.Children.Add(bt2)
    #rect(100,50,rui)
    return window
Beispiel #9
0
def getCustomToolPropertyContent():
    #Create a Grid
    my_Grid = WPFControls.Grid()

    #Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())

    #Row 0
    #Create a label (TextBlock)
    #Set it's Text value
    #Assign it to Row 0, Column 0
    refineTextBlock = WPFControls.TextBlock()
    refineTextBlock.Text = "Mesh size (mm):"
    WPFControls.Grid.SetRow(refineTextBlock, 0)
    WPFControls.Grid.SetColumn(refineTextBlock, 0)
    global refineSizeTextBox

    #Create an empty input TextBox assign it to Row 0, Column 1
    refineSizeTextBox = WPFControls.TextBox()
    WPFControls.Grid.SetRow(refineSizeTextBox, 0)
    WPFControls.Grid.SetColumn(refineSizeTextBox, 1)

    #Create a button and set it's text to "Import"
    #Assign it to Row1, Column 0
    importBtn = WPFControls.Button()
    importBtn.Content = "Mesh partitions"
    WPFControls.Grid.SetRow(importBtn, 1)
    WPFControls.Grid.SetColumn(importBtn, 0)
    WPFControls.Grid.SetColumnSpan(importBtn, 2)
    importBtn.Height = 30

    #Link a function to the Button "Click" event
    #This function will be called every time the Button is clicked
    importBtn.Click += MeshPartitions

    # Add the controls to the Grid
    my_Grid.Children.Add(importBtn)
    my_Grid.Children.Add(refineTextBlock)
    my_Grid.Children.Add(refineSizeTextBox)

    #Return the Grid
    return my_Grid
Beispiel #10
0
def updateComboBox(comboBox, comboItems):

    for comboItem in comboItems:
        item = WPFControls.ComboBoxItem()
        item.Content = comboItem
        comboBox.Items.Add(item)

    comboBox.SelectedIndex = "0"
Beispiel #11
0
def getCustomToolPropertyContent():
    currRow = 0
    # Create a Grid
    my_Grid = WPFControls.Grid()

    # Add 1 Row and One Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())

    # Create a DataGrid
    global myDataGrid
    myDataGrid = WPFControls.DataGrid()

    # Create a button
    currRow += 20
    actionButton = WPFControls.Button()
    actionButton.Content = "Calculate selected"
    WPFControls.Grid.SetRow(actionButton, currRow)
    WPFControls.Grid.SetColumn(actionButton, 0)
    actionButton.Height = 30
    WPFControls.Grid.SetColumnSpan(actionButton, 2)
    actionButton.Click += GetSelectionInfo  # Link a function to the Button "Click" event

    # Add the DataGrid to the Grid
    my_Grid.Children.Add(myDataGrid)
    my_Grid.Children.Add(actionButton)

    # Return the Grid
    return my_Grid
Beispiel #12
0
def getCustomToolPropertyContent():
   #Create a Grid
   my_Grid = WPFControls.Grid()
   
   #Add 2 Rows and 1 Column
   my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
   my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
   my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
   my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
   my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
   
   
   #Create a button to suppress all vertices only
   cleanVertices = WPFControls.Button()
   cleanVertices.Content="Suppress vertices"
   WPFControls.Grid.SetRow(cleanVertices, 0)
   WPFControls.Grid.SetColumn(cleanVertices, 0)
   cleanVertices.Height = 30
   cleanVertices.Click+=HandleCleanVertices
   
   
   #Create a button to suppress all edges only
   cleanEdges = WPFControls.Button()
   cleanEdges.Content="Suppress edges"
   WPFControls.Grid.SetRow(cleanEdges, 0)
   WPFControls.Grid.SetColumn(cleanEdges, 1)
   cleanEdges.Height = 30
   cleanEdges.Click+=HandleCleanEdges
   
   
   
   #Create a button to suppress all vertices and edges
   cleanAll = WPFControls.Button()
   cleanAll.Content="Suppress all"
   WPFControls.Grid.SetRow(cleanAll, 1)
   WPFControls.Grid.SetColumn(cleanAll, 0)
   cleanAll.Click+=HandleCleanAll
   cleanAll.Height = 30
   WPFControls.Grid.SetColumnSpan(cleanAll, 2)
   
   
   # Add the controls to the Grid
   my_Grid.Children.Add(cleanAll)
   my_Grid.Children.Add(cleanEdges)
   my_Grid.Children.Add(cleanVertices)
   
   #Return the Grid
   return my_Grid
Beispiel #13
0
def createComboBox(parent, row, col):
    comboBox = WPFControls.ComboBox()

    comboBox.Margin = System.Windows.Thickness(5.)

    WPFControls.Grid.SetRow(comboBox, row)
    WPFControls.Grid.SetColumn(comboBox, col)

    parent.Children.Add(comboBox)

    return comboBox
 def AddItem(self, coll, diskFile):
     item = Controls.TreeViewItem()
     item.Header = self.MakeItemHeader(diskFile)
     item.Tag = diskFile
     if isinstance(diskFile, DiskDir):
         # Add this dummy item to get a "+" button. It will be removed in on_Expanded
         item.Items.Add('dummy')
         item.FontWeight = Windows.FontWeights.Bold
     else:
         item.FontWeight = Windows.FontWeights.Normal
     coll.Add(item)
Beispiel #15
0
def createTextBlock2(parent, text, row, col):
    textBlock = WPFControls.TextBlock()
    textBlock.Text = text

    textBlock.Margin = System.Windows.Thickness(5.)

    WPFControls.Grid.SetRow(textBlock, row)
    WPFControls.Grid.SetColumn(textBlock, col)
    parent.Children.Add(textBlock)

    return textBlock
Beispiel #16
0
def createCheckBox(parent, label, row, col):

    checkBox = WPFControls.CheckBox()
    checkBox.Content = label
    checkBox.Margin = System.Windows.Thickness(5.)

    WPFControls.Grid.SetRow(checkBox, row)
    WPFControls.Grid.SetColumn(checkBox, col)

    parent.Children.Add(checkBox)

    return checkBox
Beispiel #17
0
def createTextBox(parent, value, row, col):
    textBox = WPFControls.TextBox()

    textBox.Margin = System.Windows.Thickness(5.)

    WPFControls.Grid.SetRow(textBox, row)
    WPFControls.Grid.SetColumn(textBox, col)
    textBox.Text = value

    parent.Children.Add(textBox)

    return textBox
Beispiel #18
0
def createDataBox(parent, title, value, row, col):
    textBlock = WPFControls.TextBlock()
    textBlock.Text = title

    textBlock.Margin = System.Windows.Thickness(5.)

    WPFControls.Grid.SetRow(textBlock, row)
    WPFControls.Grid.SetColumn(textBlock, col)

    textBox = WPFControls.TextBox()

    textBox.Margin = System.Windows.Thickness(5.)

    WPFControls.Grid.SetRow(textBox, row)
    WPFControls.Grid.SetColumn(textBox, col + 1)
    textBox.Text = value

    parent.Children.Add(textBlock)
    parent.Children.Add(textBox)

    return textBox
Beispiel #19
0
 def __init__(self, parent):
     wpf.LoadComponent(self, 'WizardDialog.xaml')
     f = open('OpenSourceLicenseTerms.txt')
     opl = f.read()
     f.close()
     self.Title = "About"
     self.SizeToContent = SizeToContent.WidthAndHeight
     #self.WindowStartupLocation = WindowStartupLocation.Manual
     self.Left = parent.Left + parent.ActualWidth / 4
     self.Top = parent.Top + parent.ActualHeight / 4
     stack = Controls.StackPanel()
     sv = Controls.ScrollViewer()
     sv.Width = 500
     sv.Height = 300
     tb = Controls.TextBlock()
     #tb.FontSize = 16
     tb.TextWrapping = TextWrapping.Wrap
     r = Documents.Run(gVersionStr + '\n')
     r.Foreground = Media.Brushes.Blue
     tb.Inlines.Add(r)
     r = Documents.Run(
         'This software is created by JunHyeok Heo ([email protected])\n'
     )
     r.Foreground = Media.Brushes.Blue
     tb.Inlines.Add(r)
     r = Documents.Run('under MIT License.\n')
     r.Foreground = Media.Brushes.Blue
     tb.Inlines.Add(r)
     tb.Inlines.Add(opl)
     sv.AddChild(tb)
     stack.AddChild(sv)
     btn = Controls.Button()
     btn.Click += self.buttonClick
     btn.Content = "Close"
     btn.Width = 70
     btn.Height = 30
     btn.Margin = Thickness(0.0, 6.0, 0.0, 12.0)
     stack.AddChild(btn)
     self.Base.AddChild(stack)
     self.ShowDialog()
Beispiel #20
0
def ResizeColumns(sender, args):
    # Get the current width of the DataGrid
    width = myDataGrid.ActualWidth

    # Get the number of columns
    num_cols = myDataGrid.Columns.Count

    # Calculate the columns width
    col_width = myDataGrid.ActualWidth / myDataGrid.Columns.Count

    # Set the width of each columns
    for column in myDataGrid.Columns:
        column.Width = WPFControls.DataGridLength(col_width)
	def __init__(self):
		self.window = Windows.Window()
		self.window.WindowStyle = Windows.WindowStyle.None
		self.window.Width = 300
		self.window.Height = 55
		self.window.ShowInTaskbar = False
		self.window.Topmost = True

		t = Controls.TextBlock()
		t.Padding = Windows.Thickness(5,5,5,5)
		t.TextWrapping = Windows.TextWrapping.NoWrap
		t.Background = Media.Brushes.LightYellow
		self.window.Content = t
Beispiel #22
0
def getCustomToolPropertyContent():
    #Create a Grid
    my_Grid = WPFControls.Grid()

    #Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())

    #Create a button and set it's text to "Import"
    #Assign it to Row1, Column 0
    ShowSurfMeshed = WPFControls.Button()
    ShowSurfMeshed.Content = "With surface mesh only"
    WPFControls.Grid.SetRow(ShowSurfMeshed, 0)
    ShowSurfMeshed.Height = 30
    ShowSurfMeshed.Click += HandleShowSurfMeshed

    ShowVolumeMeshed = WPFControls.Button()
    ShowVolumeMeshed.Content = "With volume mesh only"
    WPFControls.Grid.SetRow(ShowVolumeMeshed, 1)
    ShowVolumeMeshed.Height = 30
    #ShowSurfMeshed.Click += HandleShowVolumeMeshed

    ShowNotMeshed = WPFControls.Button()
    ShowNotMeshed.Content = "Without any mesh"
    WPFControls.Grid.SetRow(ShowNotMeshed, 2)
    ShowNotMeshed.Height = 30
    ShowNotMeshed.Click += HandleShowWithoutMesh

    ShowMeshed = WPFControls.Button()
    ShowMeshed.Content = "With any mesh"
    WPFControls.Grid.SetRow(ShowMeshed, 3)
    ShowMeshed.Height = 30
    ShowMeshed.Click += HandleShowWithMesh

    # Add the controls to the Grid
    my_Grid.Children.Add(ShowSurfMeshed)
    my_Grid.Children.Add(ShowVolumeMeshed)
    my_Grid.Children.Add(ShowNotMeshed)
    my_Grid.Children.Add(ShowMeshed)

    #Return the Grid
    return my_Grid
def getCustomToolPropertyContent():
    # Create a Grid
    my_Grid = WPFControls.Grid()

    # Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())

    # Create a button and set it's text to "Import"
    # Assign it to Row1, Column 0
    cleanBtn = WPFControls.Button()
    cleanBtn.Content = "Show me type and path"
    WPFControls.Grid.SetRow(cleanBtn, 1)
    WPFControls.Grid.SetColumn(cleanBtn, 0)

    # Link a function to the Button "Click" event
    # This function will be called every time the Button is clicked
    cleanBtn.Click += HandlecleanBtn

    # Add the controls to the Grid
    my_Grid.Children.Add(cleanBtn)

    # Return the Grid
    return my_Grid
Beispiel #24
0
def getCustomToolPropertyContent():
    #Create a Grid
    my_Grid = WPFControls.Grid()

    #Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())

    #Create a button and set it's text to "Import"
    #Assign it to Row1, Column 0
    splitBeads = WPFControls.Button()
    splitBeads.Content = "Split at weld trajectories"
    WPFControls.Grid.SetRow(splitBeads, 1)
    WPFControls.Grid.SetColumn(splitBeads, 0)
    splitBeads.Height = 30

    #Link a function to the Button "Click" event
    #This function will be called every time the Button is clicked
    splitBeads.Click += HandlecleanBtn

    # Add the controls to the Grid
    my_Grid.Children.Add(splitBeads)

    #Return the Grid
    return my_Grid
Beispiel #25
0
def getCustomToolPropertyContent():
    #Create a Grid
    my_Grid = WPFControls.Grid()

    #Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())

    #Create a button and set it's text to "Import"
    #Assign it to Row1, Column 0
    doOrganize = WPFControls.Button()
    doOrganize.Content = "Remove empty containers"
    WPFControls.Grid.SetRow(doOrganize, 1)
    WPFControls.Grid.SetColumn(doOrganize, 0)
    doOrganize.Height = 30

    #Link a function to the Button "Click" event
    #This function will be called every time the Button is clicked
    doOrganize.Click += HandlecleanBtn

    # Add the controls to the Grid
    my_Grid.Children.Add(doOrganize)

    #Return the Grid
    return my_Grid
    def __init__(self, name, parent):
        super(RuleUI, self).__init__()
        self._parent = parent
        self._parent.Children.Add(self)
        self.Width = self._parent.Width
        self.Height = 20
        self.Margin = System.Windows.Thickness(0)
        self.Orientation = ws.Orientation.Horizontal

        lb = ws.Label()
        lb.Content = name
        lb.Padding = System.Windows.Thickness(0)
        lb.Height = 20
        self.lb = lb
        self.Children.Add(lb)

        self.bt_sel = ws.Button()
        self.bt_sel.Content = 'Sel'
        #self.bt_sel.Width=30
        self.bt_attr = ws.Button()
        self.bt_attr.Content = 'Attr'
        #self.bt_attr.Width=30
        self.Children.Add(self.bt_sel)
        self.Children.Add(self.bt_attr)
    def LoadVMList(self):
        try:
            self.VMListBox.Items.Clear()

            cmd = '"%s" list vms' % self.VBoxManageTextBox.Text
            vmslist = subprocess.check_output(cmd)

            for line in str.splitlines(vmslist):
                # vboxmanage list vms result is 'machine_name {uuid}'
                (name, uuid) = shlex.split(line)

                lbi = Controls.ListBoxItem()
                lbi.Content = name
                self.VMListBox.Items.Add(lbi)
        except Exception as err:
            raise err
Beispiel #28
0
    def __init__(self):
        super(InspectTransform, self).__init__()
        self.set_size(300, 400)
        # subject is the form being examined
        self.subject = None
        self.engine = None
        layout = ws.StackPanel()
        layout.Orientation = ws.Orientation.Vertical
        self.Content = layout

        self.bt_add = ws.Button()
        self.bt_add.Content = 'select a brep'
        self.bt_add.Click += self.addObject
        layout.AddChild(self.bt_add)
        self.bt_enable_conduit = ws.Button()
        self.bt_enable_conduit.Content = 'enable conduit'
        self.bt_enable_conduit.Click += self.enable_conduit
        layout.AddChild(self.bt_enable_conduit)
        self.bt_disable_conduit = ws.Button()
        self.bt_disable_conduit.Content = 'disable conduit'
        self.bt_disable_conduit.Click += self.disable_conduit
        layout.AddChild(self.bt_disable_conduit)

        self.rot_value = 0
        self.slice_value = 0
        self.temp_display_objects = []

        # create UI
        slider_names = ['rotate', 'slice', 'tx', 'ty', 'tz', 'sx', 'sy', 'sz']
        self.sliders = {}
        for n in slider_names:
            layH = ws.StackPanel()
            layH.Orientation = ws.Orientation.Horizontal
            layH.Height = 20
            sld = ws.Slider()
            sld.Width = 200
            lb = ws.Label()
            lb.Content = n
            lb.Width = 60
            lb.Height = 20
            layH.AddChild(lb)
            layH.AddChild(sld)
            layout.AddChild(layH)
            self.sliders[n] = sld

        self.sliders['rotate'].ValueChanged += self.rotate
        self.sliders['slice'].ValueChanged += self.slice
def add_button(control, text=None):
    if text == None:
        text = str(len(control.Children))
    button = ws.Button()
    button.Height = 20
    button.Content = text
    button.Width = control.Width
    control.AddChild(button)

    def on_click(sender, e):
        try:
            text = str(len(control.Children))
            text = 'script number {}'.format(text)
            RuleUI(text, control)
        except Exception as e:
            print(e)

    button.Click += on_click
Beispiel #30
0
def getCustomToolPropertyContent():
    #Create a Grid
    my_Grid = WPFControls.Grid()

    #Add 2 Rows and 1 Column
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
    my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())

    #Row 0
    #Create a label (TextBlock)
    #Set it's Text value
    #Assign it to Row 0, Column 0
    refineTextBlock = WPFControls.TextBlock()
    refineTextBlock.Text = "Refinement diameter (mm):"
    WPFControls.Grid.SetRow(refineTextBlock, 0)
    WPFControls.Grid.SetColumn(refineTextBlock, 0)
    global refineSizeTextBox

    #Create an empty input TextBox assign it to Row 0, Column 1
    refineSizeTextBox = WPFControls.TextBox()
    WPFControls.Grid.SetRow(refineSizeTextBox, 0)
    WPFControls.Grid.SetColumn(refineSizeTextBox, 1)

    #Create a button and set it's text to "Import"
    #Assign it to Row1, Column 0
    importBtn = WPFControls.Button()
    importBtn.Content = "Import CSV files"
    WPFControls.Grid.SetRow(importBtn, 1)
    WPFControls.Grid.SetColumn(importBtn, 0)

    #Link a function to the Button "Click" event
    #This function will be called every time the Button is clicked
    importBtn.Click += HandleimportBtn

    #Create an empty input TextBox
    global fileNameTextBox
    fileNameTextBox = WPFControls.TextBox()
    WPFControls.Grid.SetRow(fileNameTextBox, 2)
    WPFControls.Grid.SetColumn(fileNameTextBox, 1)

    selectedFilesText = WPFControls.TextBlock()
    selectedFilesText.Text = "File(s) selected:"
    WPFControls.Grid.SetRow(selectedFilesText, 2)
    WPFControls.Grid.SetColumn(selectedFilesText, 0)

    #Create a button
    #Assign it to Row1, Column 0
    goSpots = WPFControls.Button()
    goSpots.Content = "Create spot locations"
    WPFControls.Grid.SetRow(goSpots, 3)
    WPFControls.Grid.SetColumn(goSpots, 0)
    WPFControls.Grid.SetColumnSpan(goSpots, 2)
    goSpots.Height = 30

    #Link a function to the Button "Click" event
    #This function will be called every time the Butto is clicked
    goSpots.Click += HandleCreateSpots

    # Add the controls to the Grid
    my_Grid.Children.Add(importBtn)
    my_Grid.Children.Add(goSpots)
    my_Grid.Children.Add(refineTextBlock)
    my_Grid.Children.Add(refineSizeTextBox)
    my_Grid.Children.Add(fileNameTextBox)
    my_Grid.Children.Add(selectedFilesText)

    #Return the Grid
    return my_Grid