def openCustomCommandWithList(self, dirList): if not self.settings.get("enableCustomCommand") or self.settings.get("customArgs") == "": self.dbg("Custom commands are disabled or custom args are empty. Skipping trying to open with @list@. "+self.settings.get("customArgs")) return False if not System.IO.File.Exists(self.settings.get("customExec")): MessageBox.Show(lang.enUs("customCommandNotFound")+"\n\n\""+self.settings.get("customExec")+"\"", lang.enUs("windowTitle")+" "+lang.enUs("error"), MessageBoxButtons.OK, MessageBoxIcon.Error) # We want to halt, so we pretend we did something. return True if self.settings.get("customArgs").find("@list@") > -1: parsedCommand = self.buildOpenerCommand() listLen = len(dirList) maxWin = self.settings.get("maxWindows") if maxWin > 0 and listLen > maxWin: self.dbg("Using "+str(maxWin)+" of "+str(listLen)+" directories for a single command") dirPile = '"'+'" "'.join(dirList[0:maxWin])+'"' else: self.dbg("Using "+str(listLen)+" directories for a single command") dirPile = '"'+'" "'.join(dirList)+'"' parsedArgs = self.settings.get("customArgs").replace("@list@", dirPile) try: self.dbg("Running \""+parsedCommand+"\" "+parsedArgs) Process.Start(parsedCommand, parsedArgs) except: errType, errValue, errTrace = sys.exc_info() MessageBox.Show(lang.enUs("failedCommand")+"\n\n"+parsedCommand+" "+parsedArgs+"\n\n"+str(errValue), lang.enUs("windowTitle"), MessageBoxButtons.OK, MessageBoxIcon.Warning) return True return False
def handleOcf4crButtonClicked(self, books): self.log("Triggered main icon handler") if not books: MessageBox.Show(lang.enUs("nobooks"), lang.enUs("windowTitle"), MessageBoxButtons.OK, MessageBoxIcon.Information) return self.dirList = self.getDirectoriesList(books) if not self.dirList: MessageBox.Show(lang.enUs("nodirs"), lang.enUs("windowTitle"), MessageBoxButtons.OK, MessageBoxIcon.Information) return self.settings.loadSettingsFromFile() self.dirCount = len(self.dirList) if self.openCustomCommandWithList(self.dirList): return; if self.dirCount > 1 and not self.settings.get("onlyUseFirstDir"): if self.settings.get("ignoreMultiSelected"): self.dbg("Ignored multiple selection according to settings") return self.log("Showing multiple form") self.showMultipleForm(self.dirList) return self.log("Opening single directory \""+self.dirList[0]+"\"") self.openDirWithCommand(self.dirList[0], False)
def openMultipleDirsWithCommand(self, dirList): if not isinstance(dirList, list): MessageBox.Show(lang.enUs("invalidList")+str(type(dirList)), lang.enUs("windowTitle"), MessageBoxButtons.OK, MessageBoxIcon.Warning) else: opened = 0 maxOpened = self.settings.get("maxWindows") for dirName in dirList: sleep(self.runCommandDelay) self.openDirWithCommand(dirName, True) opened += 1 if maxOpened > 0 and opened >= maxOpened: self.dbg("Opened "+str(opened)+" windows of max "+str(maxOpened)) return
def saveSettingsFile(self): try: stringsToWrite = [ "################################################################################", "# Open Containing Folder for ComicRack Settings", "################################################################################", "# If you wish to comment out a setting, you can use a pound mark (\"#\") at the", "# beginning of the line. You really should use the UI for these though.", "################################################################################", "", ] for setting, value in self.activeSettings.items(): stringsToWrite.append(str(setting)+"="+str(value)) if stringsToWrite[len(stringsToWrite)-1] != "": # an empty newline at the end stringsToWrite.append("") self.ocf4cr.dbg("Writing settings to \""+self.settingsPath+"\"") File.WriteAllText(self.settingsPath, "\n".join(stringsToWrite)) return True except: errType, errValue, errTrace = sys.exc_info() MessageBox.Show(lang.enUs("failedSavingSettings")+"\n"+str(errType)+"\n"+str(errValue)+"\n"+str(errTrace), lang.enUs("windowTitle"), MessageBoxButtons.OK, MessageBoxIcon.Warning) return False
def updateMaxStrings(self, checkedCount): unlimited = self._maxWindows < 1 if unlimited: self._maxString = lang.enUs("unlimited") else: self._maxString = str(self._maxWindows) self.labelSelectedCounted.Text = lang.enUs("selectAllCount").replace( '@count@', str(int(checkedCount))).replace('@max@', self._maxString) self.selectNoneButton.Enabled = checkedCount > 0 self.selectAllButton.Enabled = checkedCount < self._maxWindows and checkedCount < len( self.directoryCheckboxes.Items) if unlimited or self._maxWindows >= len( self.directoryCheckboxes.Items): self.selectAllButton.Text = lang.enUs("selectAll") else: self.selectAllButton.Text = lang.enUs("selectMax")
def __init__(self, ocf4cr, dirList): self._dirList = dirList self._checkList = [] self._maxString = lang.enUs("unlimited") self._selectingAll = False self.ocf4cr = ocf4cr self._maxWindows = self.ocf4cr.settings.get("maxWindows") self.ocf4cr.settings.loadSettingsFromFile() self.InitializeComponent(dirList) self.updateMaxStrings(0)
def openDirWithCommand(self, dirPath, noWarnings): if self.openCustomCommandWithList(self.dirList): return; parsedCommand = self.buildOpenerCommand() parsedArgs = self.buildSingleCommandArgs(dirPath) try: self.dbg("Running \""+parsedCommand+"\" "+parsedArgs) Process.Start(parsedCommand, parsedArgs) except: errType, errValue, errTrace = sys.exc_info() MessageBox.Show(lang.enUs("failedCommand")+"\n\n"+parsedCommand+" "+parsedArgs+"\n\n"+str(errValue), lang.enUs("windowTitle"), MessageBoxButtons.OK, MessageBoxIcon.Warning)
def langDefault(self, setting): if not setting in self.settings.defaultValues: return "" return " (" + lang.enUs("defaultPlug").replace( '@value@', str(self.settings.defaultValues[setting])) + ")"
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, 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()