def test_combine(self): """in-place addition on delegates maps to Delegate.Combine""" import System global log def f(sender, args): global log log += 'f' def g(sender, args): global log log += 'g' fe = System.EventHandler(f) ge = System.EventHandler(g) fege = fe fege += ge log = '' fege(None, None) self.assertEqual(log, 'fg') log = '' fe(None, None) self.assertEqual(log, 'f') log = '' ge(None, None) self.assertEqual(log, 'g') fege -= ge log = '' fege(None, None) self.assertEqual(log, 'f')
def init(self): """Initialize the form. Returns ------- None """ textbox = TextBox() textbox.Text = str(self.value) textbox.Location = Point(10, 10) textbox.Width = 40 textbox.TextChanged += System.EventHandler(self.on_textchanged) trackbar = TrackBar() trackbar.Minimum = self.minval trackbar.Maximum = self.maxval trackbar.SmallChange = self.step trackbar.LargeChange = self.step trackbar.TickFrequency = self.step trackbar.Value = self.value trackbar.Width = 460 trackbar.Location = Point(60, 10) trackbar.Scroll += System.EventHandler(self.on_scroll) self.Controls.Add(textbox) self.Controls.Add(trackbar) self.ClientSize = Size(10 + textbox.Width + 10 + trackbar.Width + 10, trackbar.Height + 10) self.textbox = textbox self.trackbar = trackbar
def test_delegate___call__(self): import System global received def f(*args): global received received = args x = System.EventHandler(f) x.__call__('abc', None) self.assertEqual(received, ('abc', None)) x.__call__(sender = 42, e = None) self.assertEqual(received, (42, None)) self.assertTrue('__call__' in dir(x))
def InitializeComponent(self): self.buttonCallPython = System.Windows.Forms.Button() self.SuspendLayout() self.buttonCallPython.Location = System.Drawing.Point(12, 12) self.buttonCallPython.Name = "buttonCallPython" self.buttonCallPython.Size = System.Drawing.Size(75, 23) self.buttonCallPython.TabIndex = 0 self.buttonCallPython.Text = "Call Python" self.buttonCallPython.UseVisualStyleBackColor = True self.buttonCallPython.Click += System.EventHandler( self.ButtonCallPython_Click) self.AutoScaleDimensions = System.Drawing.SizeF(6.0, 13.0) self.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font self.ClientSize = System.Drawing.Size(245, 44) self.Controls.Add(self.buttonCallPython) self.MaximizeBox = False self.MinimizeBox = False self.Name = "MainForm" self.Text = "TestWinforms" self.ResumeLayout(False)
def InitializeComponent(self): self.ocf4cr.dbg("Showing SettingsForm.") # General self.generalGroupBox = System.Windows.Forms.GroupBox() self.maxWinNumeric = System.Windows.Forms.NumericUpDown() self.maxWinNumericLabel = System.Windows.Forms.Label() self.multipleGroupBox = System.Windows.Forms.GroupBox() self.ignoreMultipleRadioButton = System.Windows.Forms.RadioButton() self.enableMultipleWindowsRadioButton = System.Windows.Forms.RadioButton( ) self.enableOnlyFirstBookRadioButton = System.Windows.Forms.RadioButton( ) # Explorer.exe self.explorerExeGroupBox = System.Windows.Forms.GroupBox() self.explorerSeparateCheckbox = System.Windows.Forms.CheckBox() # Custom Command self.customCommandGroupBox = System.Windows.Forms.GroupBox() self.customCommandLabel1 = System.Windows.Forms.Label() self.customCommandLabel2 = System.Windows.Forms.Label() self.enableCustomCommandCheckbox = System.Windows.Forms.CheckBox() self.customCommandPartsGroupBox = System.Windows.Forms.GroupBox() self.commandExecutableLabel = System.Windows.Forms.Label() self.commandExecutableTextbox = System.Windows.Forms.TextBox() self.openCommandExecDialog = System.Windows.Forms.OpenFileDialog() self.browseCommandExecButton = System.Windows.Forms.Button() self.commandArgumentsLabel = System.Windows.Forms.Label() self.commandArgumentsTextbox = System.Windows.Forms.TextBox() # Buttons self.saveButton = System.Windows.Forms.Button() self.defaultsButton = System.Windows.Forms.Button() self.cancelButton = System.Windows.Forms.Button() # Suspend our layouts self.generalGroupBox.SuspendLayout() self.explorerExeGroupBox.SuspendLayout() self.multipleGroupBox.SuspendLayout() self.SuspendLayout() # # generalGroupBox # self.generalGroupBox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.generalGroupBox.Controls.Add(self.maxWinNumeric) self.generalGroupBox.Controls.Add(self.maxWinNumericLabel) self.generalGroupBox.Controls.Add(self.multipleGroupBox) self.generalGroupBox.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point) self.generalGroupBox.Location = System.Drawing.Point(12, 12) self.generalGroupBox.Name = "generalGroupBox" self.generalGroupBox.Size = System.Drawing.Size(550, 135) self.generalGroupBox.TabIndex = 0 self.generalGroupBox.Text = lang.enUs("generalSettings") # # maxWinNumeric # self.maxWinNumeric.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left self.maxWinNumeric.Location = System.Drawing.Point(6, 19) self.maxWinNumeric.Name = "maxWinNumeric" self.maxWinNumeric.Size = System.Drawing.Size(59, 20) self.maxWinNumeric.TabIndex = 1 self.maxWinNumeric.Minimum = 0 self.maxWinNumeric.TextAlign = System.Windows.Forms.HorizontalAlignment.Right self.maxWinNumeric.Value = self.settings.get("maxWindows") self.maxWinNumeric.ValueChanged += System.EventHandler( self.handleMaxWinNumericValueChanged) # # maxWinNumericLabel # self.maxWinNumericLabel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left self.maxWinNumericLabel.AutoSize = True self.maxWinNumericLabel.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.maxWinNumericLabel.Location = System.Drawing.Point(67, 22) self.maxWinNumericLabel.Name = "maxWinNumericLabel" self.maxWinNumericLabel.Size = System.Drawing.Size(253, 13) self.maxWinNumericLabel.TabIndex = 2 self.maxWinNumericLabel.Text = lang.enUs( "maxWinNumericLabel") + self.langDefault("maxWindows") # # multipleGroupBox # self.multipleGroupBox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.multipleGroupBox.Controls.Add(self.ignoreMultipleRadioButton) self.multipleGroupBox.Controls.Add( self.enableMultipleWindowsRadioButton) self.multipleGroupBox.Controls.Add(self.enableOnlyFirstBookRadioButton) self.multipleGroupBox.Cursor = System.Windows.Forms.Cursors.Default self.multipleGroupBox.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point) self.multipleGroupBox.Location = System.Drawing.Point(6, 45) self.multipleGroupBox.Name = "multipleGroupBox" self.multipleGroupBox.Size = System.Drawing.Size(538, 84) self.multipleGroupBox.TabIndex = 3 self.multipleGroupBox.Text = lang.enUs("multipleSelections") # # ignoreMultipleRadioButton # self.ignoreMultipleRadioButton.AutoSize = True if self.settings.get("ignoreMultiSelected"): self.ignoreMultipleRadioButton.Checked = True self.ignoreMultipleRadioButton.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.ignoreMultipleRadioButton.Location = System.Drawing.Point(6, 17) self.ignoreMultipleRadioButton.Name = "ignoreMultipleRadioButton" self.ignoreMultipleRadioButton.Size = System.Drawing.Size(268, 17) self.ignoreMultipleRadioButton.TabIndex = 4 self.ignoreMultipleRadioButton.Text = lang.enUs("ignoreMultiple") if self.settings.defaultValues["ignoreMultiSelected"]: self.ignoreMultipleRadioButton.Text += " (" + lang.enUs( "default") + ")" self.ignoreMultipleRadioButton.UseVisualStyleBackColor = True self.ignoreMultipleRadioButton.CheckedChanged += System.EventHandler( self.handleIgnoreMultipleRadioButtonCheckedChanged) # # enableMultipleWindowsRadioButton # self.enableMultipleWindowsRadioButton.AutoSize = True if self.settings.get("enableMultiWinForMultiSelected"): self.enableMultipleWindowsRadioButton.Checked = True self.enableMultipleWindowsRadioButton.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.enableMultipleWindowsRadioButton.Location = System.Drawing.Point( 6, 40) self.enableMultipleWindowsRadioButton.Name = "enableMultipleWindowsRadioButton" self.enableMultipleWindowsRadioButton.Size = System.Drawing.Size( 320, 17) self.enableMultipleWindowsRadioButton.TabIndex = 5 self.enableMultipleWindowsRadioButton.Text = lang.enUs( "enableMultipleWindows") if self.settings.defaultValues["enableMultiWinForMultiSelected"]: self.enableMultipleWindowsRadioButton.Text += " (" + lang.enUs( "default") + ")" self.enableMultipleWindowsRadioButton.UseVisualStyleBackColor = True self.enableMultipleWindowsRadioButton.CheckedChanged += System.EventHandler( self.handleEnableMultipleWindowsRadioButtonCheckedChanged) # # enableOnlyFirstBookRadioButton # self.enableOnlyFirstBookRadioButton.AutoSize = True if self.settings.get("onlyUseFirstDir"): self.enableOnlyFirstBookRadioButton.Checked = True self.enableOnlyFirstBookRadioButton.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.enableOnlyFirstBookRadioButton.Location = System.Drawing.Point( 6, 63) self.enableOnlyFirstBookRadioButton.Name = "enableOnlyFirstBookRadioButton" self.enableOnlyFirstBookRadioButton.Size = System.Drawing.Size(314, 17) self.enableOnlyFirstBookRadioButton.TabIndex = 6 self.enableOnlyFirstBookRadioButton.Text = lang.enUs( "enableOnlyFirstBook") if self.settings.defaultValues["onlyUseFirstDir"]: self.enableOnlyFirstBookRadioButton.Text += " (" + lang.enUs( "default") + ")" self.ignoreMultipleRadioButton.UseVisualStyleBackColor = True self.enableOnlyFirstBookRadioButton.UseVisualStyleBackColor = True self.enableOnlyFirstBookRadioButton.CheckedChanged += System.EventHandler( self.handleEnableOnlyFirstBookRadioButtonCheckedChanged) # # explorerExeGroupBox # self.explorerExeGroupBox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.explorerExeGroupBox.Controls.Add(self.explorerSeparateCheckbox) self.explorerExeGroupBox.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point) self.explorerExeGroupBox.Location = System.Drawing.Point(12, 153) self.explorerExeGroupBox.Name = "explorerExeGroupBox" self.explorerExeGroupBox.Size = System.Drawing.Size(550, 46) self.explorerExeGroupBox.TabIndex = 7 self.explorerExeGroupBox.Text = lang.enUs("explorerExe") # # explorerSeparateCheckbox # self.explorerSeparateCheckbox.AutoSize = True self.explorerSeparateCheckbox.Checked = self.settings.get( "explorerSeparateProcess") self.explorerSeparateCheckbox.Cursor = System.Windows.Forms.Cursors.Default self.explorerSeparateCheckbox.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.explorerSeparateCheckbox.Location = System.Drawing.Point(6, 19) self.explorerSeparateCheckbox.Name = "explorerSeparateCheckbox" self.explorerSeparateCheckbox.Size = System.Drawing.Size(362, 17) self.explorerSeparateCheckbox.TabIndex = 8 self.explorerSeparateCheckbox.Text = lang.enUs("explorerExeSeparate") if self.settings.defaultValues["explorerSeparateProcess"]: self.explorerSeparateCheckbox.Text += " (" + lang.enUs( "defaultChecked") + ")" else: self.explorerSeparateCheckbox.Text += " (" + lang.enUs( "defaultUnchecked") + ")" self.explorerSeparateCheckbox.UseVisualStyleBackColor = True self.explorerSeparateCheckbox.CheckedChanged += System.EventHandler( self.handleExplorerSeparateCheckboxCheckedChanged) # # customCommandGroupBox # self.explorerExeGroupBox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.customCommandGroupBox.Controls.Add( self.customCommandPartsGroupBox) self.customCommandGroupBox.Controls.Add( self.enableCustomCommandCheckbox) self.customCommandGroupBox.Controls.Add(self.customCommandLabel2) self.customCommandGroupBox.Controls.Add(self.customCommandLabel1) self.customCommandGroupBox.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point) self.customCommandGroupBox.Location = System.Drawing.Point(12, 205) self.customCommandGroupBox.Name = "customCommandGroupBox" self.customCommandGroupBox.Size = System.Drawing.Size(550, 291) self.customCommandGroupBox.TabIndex = 9 self.customCommandGroupBox.Text = lang.enUs("customCommandGroupBox") # # customCommandLabel1 # self.customCommandLabel1.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.customCommandLabel1.Location = System.Drawing.Point(6, 16) self.customCommandLabel1.Name = "customCommandLabel1" self.customCommandLabel1.Size = System.Drawing.Size(538, 70) self.customCommandLabel1.TabIndex = 10 self.customCommandLabel1.Text = lang.enUs("customCommandLabel1") # # customCommandLabel2 # self.customCommandLabel2.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.customCommandLabel2.Location = System.Drawing.Point(16, 88) self.customCommandLabel2.Name = "customCommandLabel2" self.customCommandLabel2.Size = System.Drawing.Size(528, 72) self.customCommandLabel2.TabIndex = 11 self.customCommandLabel2.Text = lang.enUs("customCommandLabel2") # # enableCustomCommandCheckbox # self.enableCustomCommandCheckbox.AutoSize = True self.enableCustomCommandCheckbox.Checked = self.settings.get( "enableCustomCommand") self.enableCustomCommandCheckbox.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point) self.enableCustomCommandCheckbox.Location = System.Drawing.Point( 6, 163) self.enableCustomCommandCheckbox.Name = "enableCustomCommandCheckbox" self.enableCustomCommandCheckbox.Size = System.Drawing.Size(147, 17) self.enableCustomCommandCheckbox.TabIndex = 12 self.enableCustomCommandCheckbox.Text = lang.enUs( "enableCustomCommand") if self.settings.defaultValues["enableCustomCommand"]: self.enableCustomCommandCheckbox.Text += " (" + lang.enUs( "defaultChecked") + ")" else: self.enableCustomCommandCheckbox.Text += " (" + lang.enUs( "defaultUnchecked") + ")" self.enableCustomCommandCheckbox.UseVisualStyleBackColor = True self.enableCustomCommandCheckbox.CheckedChanged += System.EventHandler( self.handleEnableCustomCommandCheckboxCheckChanged) # # customCommandPartsGroupBox # self.explorerExeGroupBox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.customCommandPartsGroupBox.Controls.Add( self.browseCommandExecButton) self.customCommandPartsGroupBox.Controls.Add( self.commandExecutableTextbox) self.customCommandPartsGroupBox.Controls.Add( self.commandArgumentsLabel) self.customCommandPartsGroupBox.Controls.Add( self.commandArgumentsTextbox) self.customCommandPartsGroupBox.Controls.Add( self.commandExecutableLabel) self.customCommandPartsGroupBox.Location = System.Drawing.Point(6, 186) self.customCommandPartsGroupBox.Name = "customCommandPartsGroupBox" self.customCommandPartsGroupBox.Size = System.Drawing.Size(538, 99) self.customCommandPartsGroupBox.TabIndex = 13 self.customCommandPartsGroupBox.Text = lang.enUs("command") # # commandExecutableLabel # self.commandExecutableLabel.AutoSize = True self.commandExecutableLabel.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.commandExecutableLabel.Location = System.Drawing.Point(3, 16) self.commandExecutableLabel.Name = "commandExecutableLabel" self.commandExecutableLabel.Size = System.Drawing.Size(355, 13) self.commandExecutableLabel.TabIndex = 14 self.commandExecutableLabel.Text = lang.enUs("commandExecutableLabel") # # commandExecutableTextbox # self.commandExecutableTextbox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.commandExecutableTextbox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest self.commandExecutableTextbox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.FileSystem self.commandExecutableTextbox.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.commandExecutableTextbox.Location = System.Drawing.Point(6, 32) self.commandExecutableTextbox.Name = "commandExecutableTextbox" self.commandExecutableTextbox.Size = System.Drawing.Size(445, 20) self.commandExecutableTextbox.TabIndex = 15 self.commandExecutableTextbox.TextChanged += System.EventHandler( self.handleCommandExecutableTextboxTextChanged) self.commandExecutableTextbox.Text = str( self.settings.get("customExec")) # # openCommandExecDialog # self.openCommandExecDialog.FileName = "openFileDialog1" self.openCommandExecDialog.InitialDirectory = self.ocf4cr.rootDirectory.ToString( ) self.openCommandExecDialog.FileOk += System.ComponentModel.CancelEventHandler( self.handleOpenCommandExecDialogFileOk) self.openCommandExecDialog.Filter = lang.enUs( "openCommandExecDialogFilter") self.openCommandExecDialog.FilterIndex = 6 self.openCommandExecDialog.Multiselect = False # # browseCommandExecButton # self.browseCommandExecButton.Location = System.Drawing.Point(457, 30) self.browseCommandExecButton.Name = "browseCommandExecButton" self.browseCommandExecButton.Size = System.Drawing.Size(75, 23) self.browseCommandExecButton.TabIndex = 16 self.browseCommandExecButton.Text = lang.enUs("browseDotDotDot") self.browseCommandExecButton.UseVisualStyleBackColor = True self.browseCommandExecButton.Click += System.EventHandler( self.handleBrowseCommandExecButtonClick) # # commandArgumentsLabel # self.commandArgumentsLabel.AutoSize = True self.commandArgumentsLabel.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.commandArgumentsLabel.Location = System.Drawing.Point(3, 55) self.commandArgumentsLabel.Name = "commandArgumentsLabel" self.commandArgumentsLabel.Size = System.Drawing.Size(371, 13) self.commandArgumentsLabel.TabIndex = 17 self.commandArgumentsLabel.Text = lang.enUs("commandArgumentsLabel") # # commandArgumentsTextbox # self.commandArgumentsTextbox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.commandArgumentsTextbox.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.commandArgumentsTextbox.Location = System.Drawing.Point(6, 71) self.commandArgumentsTextbox.Name = "commandArgumentsTextbox" self.commandArgumentsTextbox.Size = System.Drawing.Size(526, 20) self.commandArgumentsTextbox.TabIndex = 18 self.commandArgumentsTextbox.TextChanged += System.EventHandler( self.handleCommandArgumentsTextboxTextChanged) self.commandArgumentsTextbox.Text = str( self.settings.get("customArgs")) ## ## saveButton ## self.saveButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.saveButton.Enabled = False self.saveButton.Location = System.Drawing.Point(10, 508) self.saveButton.Name = "saveButton" self.saveButton.Size = System.Drawing.Size(555, 24) self.saveButton.TabIndex = 19 self.saveButton.Text = lang.enUs("save") self.saveButton.UseVisualStyleBackColor = True self.saveButton.Click += System.EventHandler( self.handleSaveButtonClick) ## ## defaultsButton ## self.defaultsButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.defaultsButton.Enabled = False self.defaultsButton.Location = System.Drawing.Point(10, 537) self.defaultsButton.Name = "defaultsButton" self.defaultsButton.Size = System.Drawing.Size(555, 24) self.defaultsButton.TabIndex = 20 self.defaultsButton.Text = lang.enUs("defaults") self.defaultsButton.UseVisualStyleBackColor = True self.defaultsButton.Click += System.EventHandler( self.handleDefaultsButtonClick) ## ## cancelButton ## self.defaultsButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel self.cancelButton.Location = System.Drawing.Point(10, 566) self.cancelButton.Name = "settingsCancelButton" self.cancelButton.Size = System.Drawing.Size(555, 24) self.cancelButton.TabIndex = 21 self.cancelButton.Text = lang.enUs("cancel") self.cancelButton.UseVisualStyleBackColor = True self.cancelButton.Click += System.EventHandler( self.handleCancelButtonClick) ## ## SettingsForm ## self.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font self.CancelButton = self.cancelButton self.Size = System.Drawing.Size(590, 640) self.Controls.Add(self.generalGroupBox) self.Controls.Add(self.saveButton) self.Controls.Add(self.defaultsButton) self.Controls.Add(self.cancelButton) self.Controls.Add(self.explorerExeGroupBox) self.Controls.Add(self.customCommandGroupBox) self.Icon = self.ocf4cr.windowIconResource self.MaximizeBox = False self.MaximumSize = System.Drawing.Size(3000, 640) self.MinimizeBox = False self.MinimumSize = System.Drawing.Size(590, 640) self.Name = "SettingsForm" self.ShowInTaskbar = True self.Margin = Padding(0, 0, 0, 0) self.Padding = Padding(0, 0, 0, 0) self.Text = lang.enUs("windowTitleSettings") self.multipleGroupBox.ResumeLayout(False) self.multipleGroupBox.PerformLayout() self.generalGroupBox.ResumeLayout(False) self.generalGroupBox.PerformLayout() self.customCommandGroupBox.ResumeLayout(False) self.customCommandGroupBox.PerformLayout() self.customCommandPartsGroupBox.ResumeLayout(False) self.customCommandPartsGroupBox.PerformLayout() self.explorerExeGroupBox.ResumeLayout(False) self.explorerExeGroupBox.PerformLayout() self.CenterToScreen() self.ResumeLayout(False) self.PerformLayout()
def InitializeComponent(self): '''Windows Form Designer generated code''' self.lblServerName = SysForms.Label() self.lblServerNameComment = SysForms.Label() self.txtServerName = SysForms.TextBox() self.btnDisconnect = SysForms.Button() self.btnConnect = SysForms.Button() self.lblCommandString = SysForms.Label() self.txtCommand = SysForms.TextBox() self.btnSendCommand = SysForms.Button() self.lblCommandReply = SysForms.Label() self.lblCommandReplyValue = SysForms.Label() self.SuspendLayout() # # lblServerName # self.lblServerName.Location = SysDrawing.Point(16, 8) self.lblServerName.Name = "lblServerName" self.lblServerName.Size = SysDrawing.Size(72, 16) self.lblServerName.TabIndex = 24 self.lblServerName.Text = "Server Name" # # lblServerNameComment # self.lblServerNameComment.Location = SysDrawing.Point(136, 32) self.lblServerNameComment.Name = "lblServerNameComment" self.lblServerNameComment.Size = SysDrawing.Size(208, 16) self.lblServerNameComment.TabIndex = 28 self.lblServerNameComment.Text = "(User may enter pc name or IP address)" # # txtServerName # self.txtServerName.Location = SysDrawing.Point(96, 8) self.txtServerName.Name = "txtServerName" self.txtServerName.Size = SysDrawing.Size(280, 20) self.txtServerName.TabIndex = 27 self.txtServerName.Text = "" # # btnDisconnect # self.btnDisconnect.Location = SysDrawing.Point(464, 8) self.btnDisconnect.Name = "btnDisconnect" self.btnDisconnect.TabIndex = 26 self.btnDisconnect.Text = "Disconnect" self.btnDisconnect.Click += System.EventHandler(self.btnDisconnect_Click) # # btnConnect # self.btnConnect.Location = SysDrawing.Point(384, 8) self.btnConnect.Name = "btnConnect" self.btnConnect.TabIndex = 25 self.btnConnect.Text = "Connect" self.btnConnect.Click += System.EventHandler(self.btnConnect_Click) # # lblCommandString # self.lblCommandString.Location = SysDrawing.Point(16, 80) self.lblCommandString.Name = "lblCommandName" self.lblCommandString.Size = SysDrawing.Size(90, 16) self.lblCommandString.TabIndex = 29 self.lblCommandString.Text = "Command String" # # txtCommand # self.txtCommand.Location = SysDrawing.Point(110, 80) self.txtCommand.Name = "txtCommand" self.txtCommand.Size = SysDrawing.Size(280, 20) self.txtCommand.TabIndex = 30 self.txtCommand.Text = "-PostEvent \"Test Event\" 0 0" # # btnSendCommand # self.btnSendCommand.Location = SysDrawing.Point(400, 80) self.btnSendCommand.Name = "btnSendCommand" self.btnSendCommand.TabIndex = 31 self.btnSendCommand.Size = SysDrawing.Size(100, 20) self.btnSendCommand.Text = "Send Command" self.btnSendCommand.Click += System.EventHandler(self.btnSendCommand_Click) # # lblCommandReply # self.lblCommandReply.Location = SysDrawing.Point(16, 120) self.lblCommandReply.Name = "lblCommandReply" self.lblCommandReply.Size = SysDrawing.Size(100, 16) self.lblCommandReply.TabIndex = 32 self.lblCommandReply.Text = "Command Reply: " # # lblCommandReplyValue # self.lblCommandReplyValue.Location = SysDrawing.Point(118, 120) self.lblCommandReplyValue.Name = "lblCommandReplyValue" self.lblCommandReplyValue.Size = SysDrawing.Size(300, 16) self.lblCommandReplyValue.TabIndex = 33 self.lblCommandReplyValue.Text = "" # # NetComExampleCommandsForm # self.AutoScaleBaseSize = SysDrawing.Size(5, 13) self.ClientSize = SysDrawing.Size(552, 150) self.Controls.Add(self.lblServerName) self.Controls.Add(self.lblServerNameComment) self.Controls.Add(self.txtServerName) self.Controls.Add(self.btnDisconnect) self.Controls.Add(self.btnConnect) self.Controls.Add(self.lblCommandString) self.Controls.Add(self.txtCommand) self.Controls.Add(self.btnSendCommand) self.Controls.Add(self.lblCommandReply) self.Controls.Add(self.lblCommandReplyValue) self.FormBorderStyle = SysForms.FormBorderStyle.FixedDialog self.Name = "NetComExampleCommandsForm" self.Text = "NetCom Example - Commands" self.ResumeLayout(False)
def InitializeComponent(self): '''Windows Form Designer generated code''' self.lblServerName = SysForms.Label() self.grpStreamProps = SysForms.GroupBox() self.btnCloseStream = SysForms.Button() self.btnOpenStream = SysForms.Button() self.btnObjectRefresh = SysForms.Button() self.lblObjectCountNum = SysForms.Label() self.lblObjectCount = SysForms.Label() self.lblObjectTypeString = SysForms.Label() self.lblObjectType = SysForms.Label() self.cmbDASObjects = SysForms.ComboBox() self.lblDASObjects = SysForms.Label() self.lblServerNameComment = SysForms.Label() self.txtServerName = SysForms.TextBox() self.btnDisconnect = SysForms.Button() self.btnConnect = SysForms.Button() self.grpRecordLog = SysForms.GroupBox() self.lbRecordLog = SysForms.ListBox() self.grpStreamProps.SuspendLayout() self.grpRecordLog.SuspendLayout() self.SuspendLayout() # # lblServerName # self.lblServerName.Location = SysDrawing.Point(16, 8) self.lblServerName.Name = "lblServerName" self.lblServerName.Size = SysDrawing.Size(72, 16) self.lblServerName.TabIndex = 24 self.lblServerName.Text = "Server Name" # # grpStreamProps # self.grpStreamProps.Controls.Add(self.btnCloseStream) self.grpStreamProps.Controls.Add(self.btnOpenStream) self.grpStreamProps.Controls.Add(self.btnObjectRefresh) self.grpStreamProps.Controls.Add(self.lblObjectCountNum) self.grpStreamProps.Controls.Add(self.lblObjectCount) self.grpStreamProps.Controls.Add(self.lblObjectTypeString) self.grpStreamProps.Controls.Add(self.lblObjectType) self.grpStreamProps.Controls.Add(self.cmbDASObjects) self.grpStreamProps.Controls.Add(self.lblDASObjects) self.grpStreamProps.Location = SysDrawing.Point(16, 64) self.grpStreamProps.Name = "grpStreamProps" self.grpStreamProps.Size = SysDrawing.Size(520, 88) self.grpStreamProps.TabIndex = 29 self.grpStreamProps.TabStop = False self.grpStreamProps.Text = "Stream Properties" # # btnCloseStream # self.btnCloseStream.Location = SysDrawing.Point(192, 56) self.btnCloseStream.Name = "btnCloseStream" self.btnCloseStream.Size = SysDrawing.Size(88, 23) self.btnCloseStream.TabIndex = 8 self.btnCloseStream.Text = "Close Stream" self.btnCloseStream.Click += System.EventHandler( self.btnCloseStream_Click) # # btnOpenStream # self.btnOpenStream.Location = SysDrawing.Point(104, 56) self.btnOpenStream.Name = "btnOpenStream" self.btnOpenStream.Size = SysDrawing.Size(80, 23) self.btnOpenStream.TabIndex = 7 self.btnOpenStream.Text = "Open Stream" self.btnOpenStream.Click += System.EventHandler( self.btnOpenStream_Click) # # btnObjectRefresh # self.btnObjectRefresh.Location = SysDrawing.Point(16, 56) self.btnObjectRefresh.Name = "btnObjectRefresh" self.btnObjectRefresh.Size = SysDrawing.Size(80, 23) self.btnObjectRefresh.TabIndex = 6 self.btnObjectRefresh.Text = "Refresh List" self.btnObjectRefresh.Click += System.EventHandler( self.btnObjectRefresh_Click) # # lblObjectCountNum # self.lblObjectCountNum.BorderStyle = SysForms.BorderStyle.Fixed3D self.lblObjectCountNum.Location = SysDrawing.Point(472, 29) self.lblObjectCountNum.Name = "lblObjectCountNum" self.lblObjectCountNum.Size = SysDrawing.Size(32, 23) self.lblObjectCountNum.TabIndex = 5 # # lblObjectCount # self.lblObjectCount.Location = SysDrawing.Point(400, 32) self.lblObjectCount.Name = "lblObjectCount" self.lblObjectCount.Size = SysDrawing.Size(72, 16) self.lblObjectCount.TabIndex = 4 self.lblObjectCount.Text = "Object Count" # # lblObjectTypeString # self.lblObjectTypeString.BorderStyle = SysForms.BorderStyle.Fixed3D self.lblObjectTypeString.Location = SysDrawing.Point(296, 29) self.lblObjectTypeString.Name = "lblObjectTypeString" self.lblObjectTypeString.Size = SysDrawing.Size(88, 23) self.lblObjectTypeString.TabIndex = 3 # # lblObjectType # self.lblObjectType.Location = SysDrawing.Point(224, 32) self.lblObjectType.Name = "lblObjectType" self.lblObjectType.Size = SysDrawing.Size(72, 16) self.lblObjectType.TabIndex = 2 self.lblObjectType.Text = "Object Type" # # cmbDASObjects # self.cmbDASObjects.DropDownStyle = SysForms.ComboBoxStyle.DropDownList self.cmbDASObjects.Location = SysDrawing.Point(104, 30) self.cmbDASObjects.Name = "cmbDASObjects" self.cmbDASObjects.Size = SysDrawing.Size(112, 21) self.cmbDASObjects.TabIndex = 1 self.cmbDASObjects.SelectedIndexChanged += System.EventHandler( self.cmbDASObjects_SelectedIndexChanged) # # lblDASObjects # self.lblDASObjects.Location = SysDrawing.Point(16, 32) self.lblDASObjects.Name = "lblDASObjects" self.lblDASObjects.Size = SysDrawing.Size(88, 16) self.lblDASObjects.TabIndex = 0 self.lblDASObjects.Text = "DAS Objects" # # lblServerNameComment # self.lblServerNameComment.Location = SysDrawing.Point(136, 32) self.lblServerNameComment.Name = "lblServerNameComment" self.lblServerNameComment.Size = SysDrawing.Size(208, 16) self.lblServerNameComment.TabIndex = 28 self.lblServerNameComment.Text = "(User may enter pc name or IP address)" # # txtServerName # self.txtServerName.Location = SysDrawing.Point(96, 8) self.txtServerName.Name = "txtServerName" self.txtServerName.Size = SysDrawing.Size(280, 20) self.txtServerName.TabIndex = 27 self.txtServerName.Text = "" # # btnDisconnect # self.btnDisconnect.Location = SysDrawing.Point(464, 8) self.btnDisconnect.Name = "btnDisconnect" self.btnDisconnect.TabIndex = 26 self.btnDisconnect.Text = "Disconnect" self.btnDisconnect.Click += System.EventHandler( self.btnDisconnect_Click) # # btnConnect # self.btnConnect.Location = SysDrawing.Point(384, 8) self.btnConnect.Name = "btnConnect" self.btnConnect.TabIndex = 25 self.btnConnect.Text = "Connect" self.btnConnect.Click += System.EventHandler(self.btnConnect_Click) # # grpRecordLog # self.grpRecordLog.Controls.Add(self.lbRecordLog) self.grpRecordLog.Location = SysDrawing.Point(16, 168) self.grpRecordLog.Name = "grpRecordLog" self.grpRecordLog.Size = SysDrawing.Size(520, 240) self.grpRecordLog.TabIndex = 30 self.grpRecordLog.TabStop = False self.grpRecordLog.Text = "Record Log" # # lbRecordLog # self.lbRecordLog.Location = SysDrawing.Point(8, 16) self.lbRecordLog.Name = "lbRecordLog" self.lbRecordLog.Size = SysDrawing.Size(504, 212) self.lbRecordLog.TabIndex = 0 # # NetComExampleStreamsForm # self.AutoScaleBaseSize = SysDrawing.Size(5, 13) self.ClientSize = SysDrawing.Size(552, 422) self.Controls.Add(self.lblServerName) self.Controls.Add(self.grpStreamProps) self.Controls.Add(self.lblServerNameComment) self.Controls.Add(self.txtServerName) self.Controls.Add(self.btnDisconnect) self.Controls.Add(self.btnConnect) self.Controls.Add(self.grpRecordLog) self.FormBorderStyle = SysForms.FormBorderStyle.FixedDialog self.Name = "NetComExampleStreamsForm" self.Text = "NetCom Example - Streams" self.grpStreamProps.ResumeLayout(False) self.grpRecordLog.ResumeLayout(False) self.ResumeLayout(False)
def InitializeComponent(self, dirList): self.labelSelectedCounted = System.Windows.Forms.Label() self.labelMessage = System.Windows.Forms.Label() self.labelMultipleWarning = System.Windows.Forms.Label() self.selectAllButton = System.Windows.Forms.Button() self.selectNoneButton = System.Windows.Forms.Button() self.directoryCheckboxes = System.Windows.Forms.CheckedListBox() self.openButton = System.Windows.Forms.Button() self.openSettingsButton = System.Windows.Forms.Button() self.cancelButton = System.Windows.Forms.Button() for dirName in dirList: self._checkList.append(System.Windows.Forms.CheckBox()) self.SuspendLayout() # # labelMessage # self.labelMessage.AutoSize = False self.labelMultipleWarning.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.labelMessage.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point) self.labelMessage.Location = System.Drawing.Point(12, 9) self.labelMessage.Name = "labelMessage" self.labelMessage.Size = System.Drawing.Size(700, 32) self.labelMessage.Text = lang.enUs("multipleSelected") self.labelMessage.TabStop = False # # selectAllButton # self.selectAllButton.Location = System.Drawing.Point(12, 40) self.selectAllButton.Name = "selectAllButton" self.selectAllButton.Size = System.Drawing.Size(200, 23) self.selectAllButton.Text = lang.enUs("selectMax") self.selectAllButton.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left self.selectAllButton.Click += System.EventHandler( self.clickSelectAllButton) # # selectNoneButton # self.selectNoneButton.Location = System.Drawing.Point(515, 40) self.selectNoneButton.Name = "selectNoneButton" self.selectNoneButton.Size = System.Drawing.Size(200, 23) self.selectNoneButton.Text = lang.enUs("selectNone") self.selectNoneButton.Enabled = False self.selectNoneButton.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right self.selectNoneButton.Click += System.EventHandler( self.clickSelectNoneButton) # # labelSelectedCounted # self.labelSelectedCounted.Name = "labelSelectedCounted" self.labelSelectedCounted.AutoSize = False self.labelSelectedCounted.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.labelSelectedCounted.ForeColor = System.Drawing.Color.FromName( "Black") self.labelSelectedCounted.Location = System.Drawing.Point(208, 44) self.labelSelectedCounted.Size = System.Drawing.Size(300, 17) self.labelSelectedCounted.Text = lang.enUs("selectAllCount").replace( '@count@', "0").replace('@max@', str(self._maxWindows)) self.labelSelectedCounted.TextAlign = System.Drawing.ContentAlignment.TopCenter # # directoryCheckboxes # self.directoryCheckboxes.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.directoryCheckboxes.FormattingEnabled = True self.directoryCheckboxes.CheckOnClick = True self.directoryCheckboxes.Location = System.Drawing.Point(12, 67) self.directoryCheckboxes.Name = "directoryCheckboxes" self.directoryCheckboxes.Size = System.Drawing.Size(703, 237) self.directoryCheckboxes.TabIndex = 1 self.directoryCheckboxes.ItemCheck += System.Windows.Forms.ItemCheckEventHandler( self.directoryCheckboxesItemCheck) for dirName in self._dirList: self.directoryCheckboxes.Items.Add(dirName, False) # # labelMultipleWarning # self.labelMultipleWarning.AutoSize = False self.labelMultipleWarning.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.labelMultipleWarning.Font = System.Drawing.Font( "Microsoft Sans Serif", 8.25, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point) self.labelMultipleWarning.ForeColor = System.Drawing.Color.FromName( "Red") self.labelMultipleWarning.Location = System.Drawing.Point(12, 305) self.labelMultipleWarning.Name = "labelMessage" self.labelMultipleWarning.Size = System.Drawing.Size(700, 32) self.labelMultipleWarning.Text = lang.enUs("multipleWarning") self.labelMultipleWarning.Padding = Padding(50, 0, 50, 0) self.labelMultipleWarning.TextAlign = System.Drawing.ContentAlignment.TopCenter self.labelMultipleWarning.TabStop = False # # openButton # self.openButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.openButton.Location = System.Drawing.Point(12, 345) self.openButton.Name = "openButton" self.openButton.Size = System.Drawing.Size(703, 23) self.openButton.TabIndex = 2 self.openButton.Text = lang.enUs("openSelected") self.openButton.UseVisualStyleBackColor = True self.openButton.Click += System.EventHandler(self.clickOpenButton) # # openSettingsButton # self.openSettingsButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.openSettingsButton.Location = System.Drawing.Point(12, 373) self.openSettingsButton.Name = "openSettingsButton" self.openSettingsButton.Size = System.Drawing.Size(703, 23) self.openSettingsButton.TabIndex = 5 self.openSettingsButton.Text = "Open Settings" self.openSettingsButton.UseVisualStyleBackColor = True self.openSettingsButton.Click += System.EventHandler( self.clickOpenSettingsButton) # # cancelButton # self.cancelButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right self.cancelButton.Location = System.Drawing.Point(12, 401) self.cancelButton.Name = "cancelButton" self.cancelButton.Size = System.Drawing.Size(703, 23) self.cancelButton.TabIndex = 3 self.cancelButton.Text = lang.enUs("cancel") self.cancelButton.UseVisualStyleBackColor = True self.cancelButton.Click += System.EventHandler(self.clickCloseButton) # # Form1 # self.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font self.ClientSize = System.Drawing.Size(730, 434) self.Controls.Add(self.labelMessage) self.Controls.Add(self.labelMultipleWarning) self.Controls.Add(self.directoryCheckboxes) self.Controls.Add(self.openSettingsButton) self.Controls.Add(self.openButton) self.Controls.Add(self.cancelButton) self.CancelButton = self.cancelButton self.Controls.Add(self.selectNoneButton) self.Controls.Add(self.selectAllButton) self.Controls.Add(self.labelSelectedCounted) self.Name = "Form1" self.Text = lang.enUs("windowTitle") self.MaximizeBox = False self.MinimizeBox = False self.MinimumSize = System.Drawing.Size(730, 434) self.MaximumSize = System.Drawing.Size(2500, 2000) self.ControlBox = True self.Icon = self.ocf4cr.windowIconResource self.CenterToScreen() self.ResumeLayout(False) self.PerformLayout()
def cmdmeth(self, i, cmdevent=cmdevent): def caller(sender, e, i=i): i() getattr(self.control, cmdevent).__iadd__(_sys.EventHandler(caller))