def __init__(self, curveId):
    offset = 10
    self.Text = "Annotate Curve"
    crvlabel = Label(Text="Curve ID = "+str(curveId), AutoSize=True)
    self.Controls.Add(crvlabel)
    width = crvlabel.Right
    pt = Point(crvlabel.Left,crvlabel.Bottom + offset)
    labelstart = Label(Text="Text at start", AutoSize=True)
    labelstart.Location = pt
    self.Controls.Add(labelstart)
    pt.X = labelstart.Right + offset
    inputstart = TextBox(Text="Start")
    inputstart.Location = pt
    self.Controls.Add(inputstart)
    if( inputstart.Right > width ):
      width = inputstart.Right
    self.m_inputstart = inputstart

    pt.X  = labelstart.Left
    pt.Y  = labelstart.Bottom + offset*3
    buttonApply = Button(Text="Apply", DialogResult=DialogResult.OK)
    buttonApply.Location = pt
    self.Controls.Add(buttonApply)
    pt.X = buttonApply.Right + offset
    buttonCancel = Button(Text="Cancel", DialogResult=DialogResult.Cancel)
    buttonCancel.Location = pt
    self.Controls.Add(buttonCancel)
    if( buttonCancel.Right > width ):
      width = buttonCancel.Right
    self.ClientSize = Size(width, buttonCancel.Bottom)
    self.AcceptButton = buttonApply
    self.CancelButton = buttonCancel
Example #2
0
	def __init__(self, plan):
		self.Text = "Choose the apropriate ROI"
		
		structure_set = plan.GetStructureSet()
		self.roi_names = sorted([rg.OfRoi.Name for rg in structure_set.RoiGeometries if rg.PrimaryShape != None])
		self.roi_colors = [rg.OfRoi.Color for rg in structure_set.RoiGeometries if rg.PrimaryShape != None]
		
		self.Width = 160*4 + 50
		self.Height = 55*int(ceil(len(self.roi_names)/4.)) + 150
		
		print self.roi_colors
		
		self.setupCheckButtons()
		
		# Add button to press OK and close the Form
		button = Button()
		button.Text = "OK"
		button.AutoSize = True
		button.Location = Point(self.Width - 105, self.Height - 100)
		button.Click += self.ok_button_clicked
		
		# Add button to press Stop and close the Form
		button2 = Button()
		button2.Text = "Stop"
		button2.AutoSize = True
		button2.Location = Point(self.Width - 210, self.Height - 100)
		button2.Click += self.stop_button_clicked
		
		self.Controls.Add(button)
		self.Controls.Add(button2)
		
		self.Controls.Add(self.checkPanel)
Example #3
0
    def __init__(self):
        self.Text = "Spreadsheet to HTML"
        self.Width = 220
        self.Height = 90
        self.FormBorderStyle = FormBorderStyle.Fixed3D

        self.openDialog = OpenFileDialog()
        self.openDialog.Title = "Choose a Python Spreadsheet File"
        self.openDialog.Filter = 'Python files (*.py)|*.py|All files (*.*)|*.*'

        self.folderDialog = FolderBrowserDialog()
        self.folderDialog.ShowNewFolderButton = True
        self.folderDialog.Description = "Choose a directory to save the HTML files in."

        l = Label()
        l.AutoSize = True
        l.Location = Point(50, 5)
        l.Text = "Choose a Spreadsheet"

        b = Button(Text="Choose")
        b.Click += self.convert
        b.Location = Point(70, 30)

        self.Controls.Add(l)
        self.Controls.Add(b)
Example #4
0
def ShowInputBox():
    """
    <Script>
    <Author>AUG</Author>
    <Description>This script will open an input box for the user to define an integer</Description>
    </Script>
    """

    if sys.platform != 'cli':
        import pythoncom
        pythoncom.CoInitialize()

    f.Text = 'Select Factor'
    f.Width = 300
    f.Height = 60

    tb.Text = value.ToString()
    tb.Dock = DockStyle.Left

    bt = Button()
    bt.Click += OnKeyPress
    bt.Text = "OK"
    bt.Dock = DockStyle.Right

    f.Controls.Add(tb)
    f.Controls.Add(bt)
    f.ShowDialog()
    def __init__(self, title, author):
        # Create the form
        self.Name = "Create Window"
        self.Text = title
        self.Size = Size(500, 150)
        self.CenterToScreen()

        self.value = ""

        # Create label for input title
        labelDiv = Label(Text=author + ":")
        labelDiv.Parent = self
        labelDiv.Size = Size(250, 250)
        labelDiv.Location = Point(30, 20)

        # Create TextBox for input
        self.textboxDiv = TextBox()
        self.textboxDiv.Parent = self
        self.textboxDiv.Text = "Date 1"
        self.textboxDiv.Size = Size(150, 150)
        self.textboxDiv.Location = Point(300, 20)

        # Create button
        button = Button()
        button.Parent = self
        button.Text = "Ok"
        button.Location = Point(300, 60)

        # Register event
        button.Click += self.ButtonClicked
Example #6
0
    def __init__(self):
        self.m_testport = 'COM3'  #: Port on test system
        self.m_test_meter = "300001162"  #: Test V4 meter
        ekm_set_log(ekm_print_log)
        print "\n****\nInitializing v3 and v4 for db test"

        self.Text = 'Sample EKM Iron Python App'

        self.label = Label()
        self.label.Text = "0.0"
        self.label.Location = Point(50, 50)
        self.label.Height = 30
        self.label.Width = 200

        self.count = 0

        button = Button()
        button.Text = "Read Meter: " + self.m_test_meter
        button.Location = Point(50, 100)
        button.Width = 180

        button.Click += self.buttonPressed

        self.Controls.Add(self.label)
        self.Controls.Add(button)
    def __init__(self, chracters):
        self.existingchracters = chracters
        self.TextBox = TextBox()
        self.TextBox.Size = Size(250, 20)
        self.TextBox.Location = Point(15, 12)
        self.TextBox.TabIndex = 1
        self.TextBox.MaxLength = 1

        self.OK = Button()
        self.OK.Text = "OK"
        self.OK.Size = Size(75, 23)
        self.OK.Location = Point(109, 38)
        self.OK.DialogResult = DialogResult.OK
        self.OK.Click += self.CheckTextBox

        self.Cancel = Button()
        self.Cancel.Size = Size(75, 23)
        self.Cancel.Text = "Cancel"
        self.Cancel.Location = Point(190, 38)
        self.Cancel.DialogResult = DialogResult.Cancel

        self.Size = Size(300, 100)
        self.Text = "Please enter the character"
        self.Controls.Add(self.OK)
        self.Controls.Add(self.Cancel)
        self.Controls.Add(self.TextBox)
        self.AcceptButton = self.OK
        self.CancelButton = self.Cancel
        self.FormBorderStyle = FormBorderStyle.FixedDialog
        self.StartPosition = FormStartPosition.CenterParent
        self.Icon = System.Drawing.Icon(ICON)
        self.ActiveControl = self.TextBox
    def add_save_button_panel(self):
        # create save button panel
        self.save_button_panel = FlowLayoutPanel()
        self.save_button_panel.Parent = self.dialog_window
        self.save_button_panel.BackColor = BUTTON_PANEL_COLOR
        self.save_button_panel.Dock = DockStyle.Bottom
        self.save_button_panel.Padding = Padding(10)
        self.save_button_panel.WrapContents = False
        self.save_button_panel.AutoSize = True
        self.save_button_panel.Font = BODY_FONT

        # add save button
        self.save_button = Button()
        self.save_button.Parent = self.save_button_panel
        self.save_button.Text = "Save"
        self.save_button.Click += self.on_save_button_click
        self.save_button.BackColor = BUTTON_COLOR
        self.save_button.AutoSize = True

        # save button is activated when user presses Enter
        self.dialog_window.AcceptButton = self.save_button

        # add close button
        self.close_button = Button()
        self.close_button.Parent = self.save_button_panel
        self.close_button.Text = "Close"
        self.close_button.DialogResult = DialogResult.Cancel
        self.close_button.BackColor = BUTTON_COLOR
        self.close_button.AutoSize = True
Example #9
0
    def __init__(self):
        self.Text = __title__
        textbox = TextBox()
        textbox.Location = Point(0, 0)
        textbox.Text = "Please input reports text or any list of IDs to select elements"
        textbox.AutoSize = False
        textbox.Size = Size(400, 200)
        textbox.Multiline = True
        textbox.Name = 'value'
        self.Controls.Add(textbox)

        saveSelection = CheckBox()
        saveSelection.Location = Point(260, 205)
        saveSelection.Text = "Save selection"
        saveSelection.Name = 'saveSelection'
        if not __shiftclick__:
            saveSelection.Checked = True
        self.Controls.Add(saveSelection)

        button_update = Button()
        button_update.Text = "Select"
        button_x = 8
        button_y = 240
        button_update.Location = Point(button_x, button_y)
        button_update.Click += self.form_update
        self.Controls.Add(button_update)
        self.Height = button_y + 70
        self.Width = 400
        self.MaximizeBox = False
        self.MinimizeBox = False
        self.FormBorderStyle = FormBorderStyle.FixedDialog
Example #10
0
    def __init__(self, plan):
        # Set the size of the form
        self.Size = Size(500, 200)
        # Set title of the form
        self.Text = 'Approximate fiducial location'

        # Add a label
        label = Label()
        label.Text = 'Type the approximate fiducial location in mm'
        label.Location = Point(15, 15)
        label.AutoSize = True
        self.Controls.Add(label)

        # Add a TextBox
        self.textbox = TextBox()
        self.textbox.Location = Point(15, 60)
        self.textbox.Width = 150
        self.Controls.Add(self.textbox)

        # Add button to press OK and close the form
        button = Button()
        button.Text = 'OK'
        button.AutoSize = True
        button.Location = Point(15, 100)
        button.Click += self.ok_button_clicked
        self.Controls.Add(button)
Example #11
0
    def __init__(self):
        """ComboBoxSample class init function."""

        # setup title
        self.Text = "ComboBox Style Changes"
        self.Width = 400
        self.Height = 500
        self.is_x10 = False

        # setup buttons
        self.dropdownlistbutton = Button()
        self.dropdownlistbutton.Text = "DropDownList"
        self.dropdownlistbutton.Width = 110
        self.dropdownlistbutton.Location = Point(5, 5)
        self.dropdownlistbutton.Click += self.change_to_dropdownlist

        self.dropdownbutton = Button()
        self.dropdownbutton.Text = "DropDown"
        self.dropdownbutton.Width = 110
        self.dropdownbutton.Location = Point(135, 5)
        self.dropdownbutton.Click += self.change_to_dropdown
        self.dropdownbutton.BackColor = Color.Lime

        self.simplebutton = Button()
        self.simplebutton.Text = "Simple"
        self.simplebutton.Width = 110
        self.simplebutton.Location = Point(265, 5)
        self.simplebutton.Click += self.change_to_simple

        self.xtenbutton = Button()
        self.xtenbutton.Text = "Toggle x10"
        self.xtenbutton.Width = 110
        self.xtenbutton.Location = Point(5, 55)
        self.xtenbutton.Click += self.toggle_x10

        # setup label
        self.label = Label()
        self.label.Text = "You select "
        self.label.Location = Point(5, 100)

        # setup combobox
        self.combobox = ComboBox()
        self.combobox.DropDownStyle = ComboBoxStyle.DropDown
        self.combobox.SelectionChangeCommitted += self.select
        self.combobox.TextChanged += self.select
        self.combobox.Width = 390
        self.combobox.Location = Point(0, 130)

        # add items in ComboBox
        for i in range(10):
            self.combobox.Items.Add(str(i))
        self.combobox.SelectedIndex = 1

        # add controls
        self.Controls.Add(self.combobox)
        self.Controls.Add(self.label)
        self.Controls.Add(self.dropdownlistbutton)
        self.Controls.Add(self.dropdownbutton)
        self.Controls.Add(self.simplebutton)
        self.Controls.Add(self.xtenbutton)
Example #12
0
    def __init__(self):
        self.m_apiInstance = None
        self.m_disp = None
        self.m_handler = None
        self.m_disposed = False
        #self.m_lock = Object()
        self.m_req = None
        self.m_ps = None
        self.Text = 'DavTrader'
        self.Name = 'DavTrader'
        self.STORE = 'hdtest3.h5'  # Note: another option is to keep the actual file open
        self.CACHE = {}

        self.loginBtn = Button()
        self.loginBtn.Name = 'connect'
        self.loginBtn.Text = 'Connect'
        self.loginBtn.Location = Point(10, 10)
        self.loginBtn.Click += self.loginBtn_eventhandler

        self.DisposeBtn = Button()
        self.DisposeBtn.Name = 'disconnect'
        self.DisposeBtn.Text = 'Disconnect'
        self.DisposeBtn.Location = Point(100, 10)
        self.DisposeBtn.Click += self.DisposeBtn_eventhandler

        self.statusbar = StatusBar()
        self.statusbar.Parent = self

        self.Controls.Add(self.loginBtn)
        self.Controls.Add(self.DisposeBtn)
    def __init__(self):
        self.Text = 'Buttons'
        
        self.Size = Size(WIDTH, HEIGHT)

        ok = Button()

        PANEL_HEIGHT = ok.Height + PANEL_SPACE

        panel = Panel()
        panel.Height = PANEL_HEIGHT
        panel.Dock = DockStyle.Bottom
        panel.Parent = self

        x = ok.Width * 2 + BUTTONS_SPACE
        y = (PANEL_HEIGHT - ok.Height) / 2

        ok.Text = "Ok"
        ok.Parent = panel
        ok.Location = Point(WIDTH-x, y)
        ok.Anchor = AnchorStyles.Right

        close = Button()
  
        x = close.Width

        close.Text = "Close"
        close.Parent = panel
        close.Location = Point(WIDTH-x-CLOSE_SPACE, y)
        close.Anchor = AnchorStyles.Right


        self.CenterToScreen()    
Example #14
0
     def __init__(self):
         self.m_testport = 'COM3'  #: Port on test system
         self.m_test_meter = "300001162"     #: Test V4 meter
         ekm_set_log(ekm_print_log)
         print "\n****\nInitializing v3 and v4 for db test"

         self.Text = 'Sample EKM Iron Python App'

         self.label = Label()
         self.label.Text = "0.0"
         self.label.Location = Point(50, 50)
         self.label.Height = 30
         self.label.Width = 200

         self.count = 0

         button = Button()
         button.Text = "Read Meter: " + self.m_test_meter
         button.Location = Point(50, 100)
         button.Width = 180

         button.Click += self.buttonPressed

         self.Controls.Add(self.label)
         self.Controls.Add(button)
Example #15
0
 def __init__(self, watcher=None):
     #
     self.__watcher = watcher
     self.Text = "FileWatcher configuration"
     self.__table = TableLayoutPanel()
     self.MinimumSize = Size(520, 360)
     self.Size = Size(640, 360)
     self.MaximizeBox = False
     self.Icon = Icon("watcher.ico")
     p = Panel()
     p.Padding = Padding(10, 0, 10, 10)
     exitBut = Button(Text="E&xit")
     p.Height = exitBut.Height + 10
     p.Controls.Add(exitBut)
     exitBut.Dock = DockStyle.Right
     p.Dock = DockStyle.Bottom
     def exit(s, e):
         self.Dispose()
     exitBut.Click += exit
     self.Controls.Add(p)
     self.Controls.Add(self.__table)
     label = Label(Text="Watch Directories")
     self.__table.Controls.Add(label)
     self.__list = ListBox()
     self.__list.Width = 500
     self.__table.Dock = DockStyle.Fill
     try:
         for wd in watcher.controller.watchDirectories.itervalues():
             self.__list.Items.Add(wd)
     except Exception, e:
         self.__list.Items.Add(str(e))
    def add_button_panel(self):
        # create button panel
        self.button_panel = FlowLayoutPanel()
        self.button_panel.Parent = self.dialog_window
        self.button_panel.BackColor = BUTTON_PANEL_COLOR
        self.button_panel.Dock = DockStyle.Bottom
        self.button_panel.Padding = Padding(10, 0, 10, 10)
        self.button_panel.WrapContents = False
        self.button_panel.AutoSize = True
        self.button_panel.Font = BODY_FONT
        self.button_panel.FlowDirection = FlowDirection.LeftToRight

        # add yes button
        self.yes_button = Button()
        self.yes_button.Parent = self.button_panel
        self.yes_button.Text = "Yes, Stop the Stimulation"
        self.yes_button.Click += self.on_yes_button_click
        self.yes_button.BackColor = BUTTON_COLOR
        self.yes_button.AutoSize = True

        # add cancel button
        self.cancel_button = Button()
        self.cancel_button.Parent = self.button_panel
        self.cancel_button.Text = "Cancel"
        self.cancel_button.Click += self.on_cancel_button_click
        self.cancel_button.BackColor = BUTTON_COLOR
        self.cancel_button.Font = ERROR_FONT
        self.cancel_button.AutoSize = True

        # cancel button is activated when user presses Enter
        self.dialog_window.AcceptButton = self.cancel_button
Example #17
0
        def __init__(self):
            self.Text = "SolverStudio: NEOS Warning"
            self.FormBorderStyle = FormBorderStyle.FixedDialog
            self.Height = 235
            self.Width = 310
            # self.Warning = Label()
            # self.Warning.Text = "Models solved using via NEOS will be available in the public domain for perpetuity."
            # self.Warning.Location = Point(10,10)
            # self.Warning.Height  = 30
            # self.Warning.Width = 380

            self.myOK = Button()
            self.myOK.Text = "Continue"
            self.myOK.Width = 100
            self.myOK.Location = Point(self.Width / 2 - self.myOK.Width - 30,
                                       self.Height - 65)
            self.myOK.Click += self.AddChoice

            self.myCancel = Button()
            self.myCancel.Text = "Cancel"
            self.myCancel.Width = 100
            self.myCancel.Location = Point(self.Width / 2 + 30,
                                           self.Height - 65)

            self.check1 = CheckBox()
            self.check1.Text = "Never show NEOS warnings again."
            self.check1.Location = Point(12, 80)
            self.check1.Width = 250
            self.check1.Height = 130

            self.link1 = LinkLabel()
            self.link1.Location = Point(10, 10)
            self.link1.Width = self.Width - 15
            self.link1.Height = 120
            self.link1.LinkClicked += self.OpenTCs
            self.link1.VisitedLinkColor = Color.Blue
            self.link1.LinkBehavior = LinkBehavior.HoverUnderline
            self.link1.LinkColor = Color.Navy
            msg = "By using NEOS via SolverStudio you agree to the NEOS-Server terms and conditions, and accept that your model will become publicly available.\n\n"
            msg += "Some solvers require an email address, which you can set using the GAMS menu. "
            email = SolverStudio.GetRegistrySetting("NEOS", "Email", "")
            if email == "":
                msg += "You have not provided an email address, and so some solvers may fail."
            else:
                msg += "Your email address (" + email + ") will be sent to NEOS."
            # msg += "\n\nContinue?"
            self.link1.Text = msg
            self.link1.LinkArea = LinkArea(60, 20)

            self.AcceptButton = self.myOK
            self.CancelButton = self.myCancel

            self.Controls.Add(self.myOK)
            self.Controls.Add(self.myCancel)
            self.Controls.Add(self.link1)
            # self.Controls.Add(self.Warning)
            self.Controls.Add(self.check1)
            # self.CenterToScreen()
            self.StartPosition = FormStartPosition.CenterParent
    def __init__(self):
        self.Text = 'Hello World'

        button = Button()
        button.Text = "Click Me"
        button.Location = Point(50, 100)
        button.Click += self.buttonPress
        self.Controls.Add(button)
 def __build_skipbutton(self):
    ''' builds and return the skip button for this form '''
    
    button = Button()
    button.DialogResult = DialogResult.Ignore
    button.Location = Point(110, 362)
    button.Size = Size(90, 24)
    button.Text = i18n.get("SeriesFormSkip")
    return button
 def __build_okbutton(self):
    ''' builds and returns the ok button for this form '''
    
    button = Button()
    button.DialogResult = DialogResult.OK
    button.Location = Point(15, 362)
    button.Size = Size(90, 24)
    button.Text = i18n.get("SeriesFormOK")
    return button
 def __build_restore_button(self):
    ''' builds and returns the restore button for this form '''
    
    button = Button()
    button.Click += self.__fired_restore_defaults
    button.Location = Point(10, 343)
    button.Size = Size(170, 23)
    button.Text = i18n.get("ConfigFormRestore")
    return button
Example #22
0
    def __build_okbutton(self):
        """ builds and returns the ok button for this form """

        button = Button()
        button.DialogResult = DialogResult.OK
        button.Location = Point(223, 362) if self.__config.show_covers_b else Point(10, 362)
        button.Size = Size(90, 24)
        button.Text = i18n.get("IssueFormOK")
        return button
Example #23
0
    def __build_skipbutton(self):
        """ builds and returns the skip button for this form """

        button = Button()
        button.DialogResult = DialogResult.Ignore
        button.Location = Point(318, 362) if self.__config.show_covers_b else Point(105, 362)
        button.Size = Size(90, 24)
        button.Text = i18n.get("IssueFormSkip")
        return button
    def __build_restore_button(self):
        ''' builds and returns the restore button for this form '''

        button = Button()
        button.Click += self.__fired_restore_defaults
        button.Location = Point(10, 343)
        button.Size = Size(170, 23)
        button.Text = i18n.get("ConfigFormRestore")
        return button
 def __build_cancel_button(self):
    ''' builds and returns the cancel button for this form '''
    
    button = Button()
    button.DialogResult = DialogResult.Cancel
    button.Location = Point(315, 343)
    button.Size = Size(90, 23)
    button.Text = i18n.get("ConfigFormCancel")
    return button
Example #26
0
    def __build_backbutton(self):
        """ builds and returns the back button for this form """

        button = Button()
        button.DialogResult = DialogResult.Retry
        button.Location = Point(595, 362)
        button.Size = Size(125, 24)
        button.Text = i18n.get("IssueFormGoBack")
        return button
 def __build_okbutton(self):
    ''' builds and returns the ok button for this form '''
    
    button = Button()
    button.DialogResult = DialogResult.OK
    button.Location = Point(228, 343)
    button.Size = Size(80, 23)
    button.Text = i18n.get("ConfigFormOK")
    return button
 def __build_searchbutton(self):
    ''' builds and return the 'search again' button for this form '''
    
    button = Button()
    button.DialogResult = DialogResult.Retry
    button.Location = Point(275, 362) \
       if self.__config.show_covers_b else Point(485, 362) 
    button.Size = Size(115, 24)
    button.Text = i18n.get("SeriesFormAgain")
    return button
 def __build_issuesbutton(self):
    ''' builds and return the 'show issues' button for this form '''
    
    button = Button()
    button.DialogResult = DialogResult.Yes
    button.Location = Point(395, 362) \
       if self.__config.show_covers_b else Point(605, 362) 
    button.Size = Size(115, 24)
    button.Text = i18n.get("SeriesFormIssues")
    return button
        def setupOKButtons(self):
            self.OKbuttonPanel = self.miniPanel(0, 750)
            
            cancelButton = Button()
            cancelButton.Text = "Cancel"
            cancelButton.Location = Point(25,25)
            self.CancelButton = cancelButton
            cancelButton.Click += self.cancelClicked

            self.OKbuttonPanel.Controls.Add(cancelButton)
 def __build_settingsbutton(self):
    ''' Builds and returns the settings button for this form. '''
   
    button = Button()
    button.Click += self.__show_configform
    button.Location = Point(208, 68)
    button.Size = Size(100, 23)
    button.Text = i18n.get("WelcomeFormSettings")
    button.UseVisualStyleBackColor = True
    return button
Example #32
0
 def __init__(self, itemlist):
     
     height = len(itemlist)*17
     self.Text = "Select the categories to export"
     self.Size = Size(300, height + 80)
     
     self.check = CheckedListBox()
     self.check.Parent = self
     self.check.Location = Point(5, 5)
     self.check.Size = Size(270, height)
     
     # load the list of relevant categories found in the project
     list_items = List[Object](itemlist)
     self.check.Items.AddRange(list_items.ToArray())
     self.check.CheckOnClick = True
     
     # set checked by default
     for i in range(len(itemlist)):
         self.check.SetItemChecked(i , True)
         
     okay = Button()
     okay.Parent = self
     okay.Text = 'OK'
     okay.Location = Point(50, height+10)
     okay.Width = 140
     okay.Click += self.onValidate
     
     cancel = Button()
     cancel.Parent = self
     cancel.Text = 'Cancel'
     cancel.Location = Point(okay.Right, height+10)
     cancel.Click += self.onCancel
     
     self.CenterToScreen()
Example #33
0
    def __init__(self):
        self.Text = "Button"
        self.CenterToScreen()
        self.Size = Size(200, 150)

        btn = Button()
        btn.Parent = self
        btn.Text = "Quit"
        btn.Location = Point(50, 50)
        btn.Click += self.OnClick
        btn.MouseEnter += self.OnEnter
Example #34
0
 def __init__(self):
     self.Text = "Button"
     self.CenterToScreen()
     self.Size = Size(200, 150)
     
     btn = Button()
     btn.Parent = self
     btn.Text = "Quit"
     btn.Location = Point(50, 50)
     btn.Click += self.OnClick
     btn.MouseEnter += self.OnEnter
Example #35
0
    def __init__(self):
        self.Text = __title__
        textbox = TextBox()
        textbox.Location = Point(0, 0)
        textbox.Text = "Please input reports text or any list of IDs to select elements"
        textbox.AutoSize = False
        textbox.Size = Size(400, 200)
        textbox.Multiline = True
        textbox.Name = 'value'
        self.Controls.Add(textbox)     

        all_items = RadioButton()
        all_items.Location = Point(10, 205)
        all_items.Text = "All"
        all_items.Name = 'all'
        all_items.Width = 50
        all_items.Checked = True
        self.Controls.Add(all_items) 

        even = RadioButton()
        even.Location = Point(60, 205)
        even.Text = "Even only"
        even.Name = 'even_only'
        even.Width = 80
        self.Controls.Add(even) 

        odd = RadioButton()
        odd.Location = Point(140, 205)
        odd.Text = "Odd only"
        odd.Name = 'odd_only'
        self.Controls.Add(odd) 

        saveSelection = CheckBox()
        saveSelection.Location = Point(260, 205)
        saveSelection.Text = "Save selection"
        saveSelection.Name = 'saveSelection'
        if not __shiftclick__:
            saveSelection.Checked = True
        self.Controls.Add(saveSelection) 

        button_update = Button()
        button_update.Text = "Select"
        button_x = 8
        button_y = 240
        button_update.Location = Point(button_x, button_y)
        button_update.Click += self.form_update
        self.Controls.Add(button_update)
        self.Height = button_y + 70
        self.Width = 400
        self.MaximizeBox = False
        self.MinimizeBox = False
        self.FormBorderStyle = FormBorderStyle.FixedDialog
Example #36
0
    def __init__(self):
        self.Text = 'Select multiple parameters for deletion'

        button = Button()  # Button created
        button.Text = "Delete Parameters"  # with this name
        button.Dock = DockStyle.Bottom  # it is docked to bottom of the form
        button.Click += self.OnClick  # CLick event is rissent and uses OnClick function
        self.Controls.Add(button)  # this control adds button

        name = ColumnHeader(
        )  # these 3 are column header names for 3 parameter properties I am going to use. -1 means longest value will be used for length
        name.Text = 'Parameter'
        name.Width = -1
        paramgr = ColumnHeader()
        paramgr.Text = 'Parameter Group'
        paramgr.Width = -1
        parfor = ColumnHeader()
        parfor.Text = 'Parameter Formula'
        parfor.Width = 140

        self.SuspendLayout()  # not sure if this must be used, but it works

        lv = ListView()  # this makes a Listview
        lv.Parent = self
        lv.FullRowSelect = False
        lv.CheckBoxes = True
        lv.GridLines = True
        lv.AllowColumnReorder = True
        lv.View = View.Details
        lv.Columns.AddRange(
            (name, paramgr,
             parfor))  # columns have been created for column headers above
        lv.ColumnClick += self.OnColumnClick  # ColumnCLick event enables sorting from OnColumnClick function

        for par in paramsList:  # this adds parameter properties to listview columns asn subitems
            item = ListViewItem()
            item.Text = par.Definition.Name  # first item is parameter name
            item.SubItems.Add(par.Definition.ParameterGroup.ToString()
                              )  # second is parameter group to string
            if par.Formula:  # if formula exists at all
                item.SubItems.Add(par.Formula.ToString())  # show it as string
            else:  # if it does not exist
                item.SubItems.Add("-")  # add anything
            lv.Items.Add(item)  # add item to ListViewItems

        lv.Dock = DockStyle.Fill  # fill in Form with this lisview (buttin is docked to bottom as seen above)
        lv.ItemCheck += self.OnSelected  # ItemCheck event is called with OnSelected function

        self.ResumeLayout()  # not sure if this must be used, but it works

        self.Size = Size(450, 400)  # dimension of the Form
        self.CenterToScreen()  # Form is being centered to screen
Example #37
0
def create_form():
    f = Form()
    f.Text = "HelloIronPython"

    btn = Button()
    btn.Text = "ClickMe"

    f.Controls.Add(btn)

    btn.Top = (f.ClientSize.Height - btn.Height) / 2
    btn.Left = (f.ClientSize.Width - btn.Width) / 2

    Application.Run(f)
Example #38
0
def create_form():
    f=Form()
    f.Text="HelloIronPython"

    btn=Button()
    btn.Text="ClickMe"

    f.Controls.Add(btn)

    btn.Top=(f.ClientSize.Height-btn.Height)/2
    btn.Left=(f.ClientSize.Width-btn.Width)/2

    Application.Run(f)
 def __build_cancelbutton(self):
    ''' Builds and returns the cancel button for this form. '''
    
    button = Button()
    button.Text=""  # gets updated by the 'update' method
    def cancel(sender, args):
       button.Enabled = False
       self.Close()
    button.Click+=cancel
    button.Location = Point(78, 572)
    button.Size = Size(190, 23)
    button.Anchor = AnchorStyles.Bottom
    return button
Example #40
0
    def __init__(self):
        self.Title="Timer"
        self.timer1=Timer()
        self.timer1.Interval=1000
        self.timer1.Tick+=self.timer1_tick
        label1=Label()
        label1.AutoSize=True
        label1.Location=Point(41,22)
        label1.Text="00:00:00"
        label1.Font=Font("MS UI Gothic",24.0,FontStyle.Regular)
        self.label1=label1
        self.Controls.Add(self.label1)

        clientwidth=255

        b1=Button()
        b1.Location=Point((clientwidth-b1.Width*2)/3,68)
        b1.Text="Click"
        b1.Click+=self.start_Click
        self.Controls.Add(b1)

        b2=Button()
        b2.Location=Point((clientwidth-b1.Width*2)*2/3+b1.Width,68)
        b2.Text="Stop"

        b2.Click+=self.stop_Click
        self.Controls.Add(b2)
        self.ClientSize=Size(clientwidth,103)
        self.Text="Stop Watch"
        self.StartPosition=FormStartPosition.CenterScreen
        def setupOKButtons(self):
            self.OKbuttonPanel = self.newPanel(0, 600)

            okButton = Button()
            okButton.Text = "OK"
            okButton.Location = Point(25, 50)
            self.AcceptButton = okButton
            okButton.Click += self.okClicked

            cancelButton = Button()
            cancelButton.Text = "Cancel"
            cancelButton.Location = Point(okButton.Left + okButton.Width + 10,
                                          okButton.Top)
            self.CancelButton = cancelButton
            cancelButton.Click += self.cancelClicked

            self.Status = Label()
            self.Status.Text = ""
            self.Status.Location = Point(200, 50)
            self.Status.AutoSize = True
            self.Status.Font = Font("Arial", 12, FontStyle.Bold)
            self.Status.ForeColor = Color.Black

            self.OKbuttonPanel.Controls.Add(okButton)
            self.OKbuttonPanel.Controls.Add(cancelButton)
            self.OKbuttonPanel.Controls.Add(self.Status)

            for CT in patient.Examinations:
                self.scancombo.Items.Add(CT.Name)
            try:
                self.scancombo.SelectedIndex = self.scancombo.FindStringExact(
                    "CT 1")
            except:
                self.scancombo.SelectedIndex = 0
Example #42
0
 def init(self):
     # table
     table = make_table('main', False)
     table.Size = Size(580, 700)
     table.Location = Point(10, 10)
     table.ColumnCount = 2
     table.Columns[0].Name = 'Key'
     table.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable
     table.Columns[0].ReadOnly = True
     table.Columns[0].DefaultCellStyle.SelectionBackColor = Color.FromArgb(238, 238, 238)
     table.Columns[0].DefaultCellStyle.BackColor = Color.FromArgb(238, 238, 238)
     table.Columns[1].Name = 'Value'
     table.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable
     keys = sorted(self.settings.keys())
     for key in keys:
         table.Rows.Add(key, self.settings[key])
     self.table = table
     # buttons
     ok = Button()
     ok.Text = 'OK'
     ok.DialogResult = DialogResult.OK
     cancel = Button()
     cancel.Text = 'Cancel'
     cancel.DialogResult = DialogResult.Cancel
     buttons = FlowLayoutPanel()
     buttons.FlowDirection = FlowDirection.RightToLeft
     # buttons.BorderStyle = BorderStyle.None
     buttons.Controls.Add(cancel)
     buttons.Controls.Add(ok)
     buttons.Size = Size(580, 30)
     buttons.Location = Point(10, 720)
     # layout
     self.ClientSize = Size(600, 800)
     self.Controls.Add(table)
     self.Controls.Add(buttons)
Example #43
0
    def __init__(self):
        self.Text = "Tooltips"
        self.CenterToScreen()
        self.Size = Size(200, 150)

        tooltip = ToolTip()
        tooltip.SetToolTip(self, "This is a Form")

        button = Button()
        button.Parent = self
        button.Text = "Button"
        button.Location = Point(50, 70)

        tooltip.SetToolTip(button, "This is a Button")
    def __init__(self):
        self.Text = 'Drag & Drop'

        button = Button()
        button.Parent = self
        button.Text = 'Button'
        button.MouseDown += self.OnMousDown
        button.MouseUp += self.OnMousUp
        button.MouseMove += self.OnMousMove

        button.Location = Point(20, 20)

        self.isDragging = False
        self.CenterToScreen()
Example #45
0
    def __init__(self):
        self.Text = "Tooltips"
        self.CenterToScreen()
        self.Size = Size(200, 150)

        tooltip = ToolTip()
        tooltip.SetToolTip(self, "This is a Form")

        button = Button()
        button.Parent = self
        button.Text = "Button"
        button.Location = Point(50, 70)

        tooltip.SetToolTip(button, "This is a Button")
Example #46
0
	def __init__(self):
		self.Text = "SolverStudio NEOS Email Address"
		self.FormBorderStyle = FormBorderStyle.FixedDialog    
		self.Height= 140
		self.Width = 460

		self.label = Label()
		self.label.Text = "Some commercial solvers on NEOS, such as CPLEX, require a valid email address. Please enter the Email address, if any, you wish to send to NEOS when you solve:"
		self.label.Location = Point(10,10)
		self.label.Height  = 35
		self.label.Width = 430

		self.KeyText = TextBox()
		self.KeyText.Location = Point(10,46)
		self.KeyText.Width = 430
		self.KeyText.Height  = 20
		self.KeyText.Text = SolverStudio.GetRegistrySetting("NEOS","Email","")
		self.KeyText.AcceptsReturn = False;

		self.bOK=Button()
		self.bOK.Text = "OK"
		self.bOK.Location = Point(270,76)
		# self.bOK.Width = 100
		self.bOK.Click += self.SetEmail

		self.link1 = LinkLabel()
		self.link1.Location = Point(10, 78)
		self.link1.Width = 250
		self.link1.Height = 40
		self.link1.LinkClicked += self.OpenTCs
		self.link1.VisitedLinkColor = Color.Blue;
		self.link1.LinkBehavior = LinkBehavior.HoverUnderline;
		self.link1.LinkColor = Color.Navy;
		self.link1.Text = "View NEOS terms and conditions"
		self.link1.LinkArea = LinkArea(5,25)

		self.bCancel=Button()
		self.bCancel.Text = "Cancel"
		self.bCancel.Location = Point(363,76)

		self.AcceptButton = self.bOK
		self.CancelButton = self.bCancel

		self.Controls.Add(self.label)
		self.Controls.Add(self.KeyText)	# Add first to get focus
		self.Controls.Add(self.link1)
		self.Controls.Add(self.bOK)
		self.Controls.Add(self.bCancel)
		self.CenterToScreen()
Example #47
0
    def setupPanel2(self):
        self.panel2 = Panel()
        # self.panel2.Text = "Panel"
        self.panel2.Width = self.Width
        self.panel2.Height = 120
        self.panel2.Location = Point(0, 120)
        self.panel2.BorderStyle = BorderStyle.FixedSingle

        self.p2title1 = Label()
        self.p2title1.Text = "Create Lumped Port"
        self.p2title1.Location = Point(25, 22)
        self.p2title1.Height = 25
        self.p2title1.AutoSize = True

        self.p2label1 = Label()
        self.p2label1.Text = "Ground Metal Name: "
        self.p2label1.Location = Point(25, 50)
        self.p2label1.Height = 25
        self.p2label1.Width = 150

        self.p2button1 = Button()
        self.p2button1.Text = 'Create'
        self.p2button1.Location = Point(25, 75)
        self.p2button1.Width = 100
        self.p2button1.Click += self.p2update

        self.p2button2 = Button()
        self.p2button2.Text = 'Reset'
        self.p2button2.Location = Point(180, 75)
        self.p2button2.Width = 100
        self.p2button2.Click += self.p2reset

        self.p2list1 = ComboBox()
        self.p2list1.Text = '——Select'
        self.p2list1.Location = Point(180, 47)
        self.p2list1.Width = 100
        self.p2list1.Height = 35
        self.DropDownHeight = 50
        self.p2list1.Click += self.p2listUpdate

        self.AcceptButton = self.p2button1
        self.CancelButton = self.p2button2

        self.panel2.Controls.Add(self.p2title1)
        self.panel2.Controls.Add(self.p2label1)
        self.panel2.Controls.Add(self.p2button1)
        self.panel2.Controls.Add(self.p2button2)
        self.panel2.Controls.Add(self.p2list1)
Example #48
0
 def __init__(self):
     self.Size = Size(200, 200)
     self.FormBorderStyle = FormBorderStyle.Sizable
     self._btn = Button()
     self._btn.Parent = self
     self._btn.Location = Point(0, 0)
     self._btn.Size = Size(20, 20)
Example #49
0
    def __init__(self):
        self.Text = "SolverStudio"
        self.FormBorderStyle = FormBorderStyle.FixedDialog
        self.Height = 360
        self.Width = 370

        self.label = Label()
        self.label.Text = ""
        self.label.Location = Point(10, 10)
        self.label.Height = 20
        self.label.Width = 200

        self.bOK = Button()
        self.bOK.Text = "OK"
        self.bOK.Location = Point(150, 300)
        self.bOK.Click += self.OK

        self.Results = TextBox()
        self.Results.Multiline = True
        self.Results.ScrollBars = ScrollBars.Vertical
        self.Results.Location = Point(10, 40)
        self.Results.Width = 350
        self.Results.Height = 250

        self.AcceptButton = self.bOK

        self.Controls.Add(self.label)
        self.Controls.Add(self.bOK)
        self.Controls.Add(self.Results)
        self.CenterToScreen()
Example #50
0
    def __init__(self):
        self.Text = 'Tooltips'
        self.CenterToScreen()
        xsize, ysize = 300, 200
        self.Size = Size(xsize, ysize)

        tooltip = ToolTip()
        tooltip.SetToolTip(self, "This is a Form")

        button = Button()
        button.Parent = self
        button.Text = "Button"
        xloc, yloc = 50, 70
        button.Location = Point(xloc, yloc)

        tooltip.SetToolTip(button, "This is a Button")
Example #51
0
    def __init__(self):
        self.Text = 'Tooltips'
        self.CenterToScreen()
        xsize,ysize=300,200
        self.Size = Size(xsize, ysize)

        tooltip = ToolTip()
        tooltip.SetToolTip(self, "This is a Form")

        button = Button()
        button.Parent = self
        button.Text = "Button"
        xloc,yloc=50,70
        button.Location = Point(xloc,yloc)

        tooltip.SetToolTip(button, "This is a Button")
Example #52
0
    def __init__(self):
        """ProgressBarSample class init function."""

        # setup title
        self.Text = "ProgressBar control"
        self.Width = 260
        self.Height = 100

        # setup label
        self.label = Label()
        self.label.Text = "It is %d percent of 100%%" % 0
        self.label.Width = 150
        self.label.Location = Point(0, 0)

        # setup button
        self.button = Button()
        self.button.Text = "Click"
        self.button.Location = Point(170, 0)
        self.button.Click += self.start_progress

        # setup progressbar
        self.progressbar = ProgressBar()
        self.progressbar.Width = 250
        self.progressbar.Visible = True
        self.progressbar.Minimum = 0
        self.progressbar.Maximum = 100
        self.progressbar.Value = 0
        self.progressbar.Step = 20
        self.progressbar.Location = Point(0, 50)

        # add controls
        self.Controls.Add(self.label)
        self.Controls.Add(self.button)
        self.Controls.Add(self.progressbar)
    def __init__(self):
        self.Text = 'Drag & Drop'
        self.AllowDrop = True

        button = Button()
        button.Parent = self
        textBox = TextBox()
        textBox.Parent = self
 
        button.AllowDrop = True
        button.Location = Point(150, 50)
        button.DragDrop += self.OnDragDrop
        button.DragEnter += self.OnDragEnter

        textBox.Location = Point(15, 50)
        textBox.MouseDown += self.OnMousDown

        self.ClientSize = Size(250, 200)
        self.CenterToScreen()
Example #54
0
    def __init__(self):
        self.Text = 'Hello World App'

        self.label = Label()
        self.label.Text = "Please Click Me"
        self.label.Location = Point(50, 50)
        self.label.Height = 30
        self.label.Width = 200

        #self.count = 0

        button = Button()
        button.Text = "Click Me"
        button.Location = Point(50, 100)

        button.Click += self.buttonPressed

        self.Controls.Add(self.label)
        self.Controls.Add(button)
    def __init__(self):
        self.Text = 'Anchor'        
        self.Size = Size(210, 210)
              
        btn1 = Button()
        btn1.Text = "Button"
        btn1.Parent = self
        btn1.Location = Point(30, 30)

        btn2 = Button()
        btn2.Text = "Button"
        btn2.Parent = self
        btn2.Location = Point(30, 80)
        btn2.Anchor = AnchorStyles.Right
        
        self.CenterToScreen()
Example #56
0
    def __init__(self):
        self.Text = "OpenDialog"
        self.Height = 140
        self.Width = 376
        self.MinimizeBox = False
        self.MaximizeBox = False
        self.CenterToScreen()

        
        self.label = Label()
        self.label.Text = "you can type *.png or *.jpg to find your purpose file, we put *.png for your help"
        self.label.Location = Point(0, 0)
        self.label.Height = 30
        self.label.Width = 380

        button = Button()
        button.Text = "Continue"
        button.Location = Point(0, 30)
        button.Height = 70
        button.Width = 360

        button.Click += self.buttonPressed

        self.Controls.Add(self.label)
        self.Controls.Add(button)
        self.Show()

        

        dialog = OpenFileDialog()
        dialog.Filter = "PNG or BMP or Tif files(*.png,*.bmp,*.tif)|*.png;*.tif;*.bmp"

        if dialog.ShowDialog(self) == DialogResult.OK:

                #data = dialog.FileNames
            f = open("Text/path.txt","w")
            f.write(dialog.FileName + "\n")
            f.close()
        else:    
            f = open("Text/path.txt","w")
            f.write("cancel\n")
            f.close()                
Example #57
0
    def initialiseButtons(self):
        buttonPanel = Panel()
        buttonPanel.Height = 23
        buttonPanel.Dock = DockStyle.Bottom
        buttonPanel.Width = 170

        acceptButton = Button()
        acceptButton.Text = "OK"
        acceptButton.DialogResult = DialogResult.OK
        acceptButton.Width = 75
        acceptButton.Dock = DockStyle.Left
        self.AcceptButton = acceptButton
        buttonPanel.Controls.Add(acceptButton)

        cancelButton = Button()
        cancelButton.Text = "Cancel"
        cancelButton.DialogResult = DialogResult.Cancel
        cancelButton.Width = 75
        cancelButton.Dock = DockStyle.Right
        self.CancelButton = cancelButton
        buttonPanel.Controls.Add(cancelButton)

        self.Controls.Add(buttonPanel)
Example #58
0
   def __build_okbutton(self):
      ''' Builds and returns the ok button for this form. '''

      button = Button()
      button.DialogResult = DialogResult.OK
      button.Location = Point(105, 58)
      button.Size = Size(90, 23)
      button.Text = i18n.get("MessageBoxOk")
      button.UseVisualStyleBackColor = True
      return button
 def __build_cancelbutton(self):
    ''' builds and returns the cancel button for this form '''
    
    button = Button()
    button.DialogResult = DialogResult.Cancel
    button.Location = Point(335, 170 if self.__fail_label_is_visible else 70)
    button.Size = Size(90, 23)
    button.Text = i18n.get("SearchFormCancel")
    button.UseVisualStyleBackColor = True
    return button