def Initialise(): #Menu.DropDownItems.Add( ToolStripMenuItem("Test",None,MenuTester) ) Menu.ToolStripMenuItem.MouseDown += Update # We now have DLL's available via the SolverStudio PATH env variable, and so don't need this check # DLLPath = CheckDLL() #try: # if DLLPath[0]==";": DLLPath=DLLPath[1:] # if not os.path.exists(DLLPath + "\\gmszlib1.dll"): # choice = MessageBox.Show("The GAMS compression library not found. Check that gmszlib1.dll still exists in the GAMSDLLs folder included in SolverStudio. If not you will need to download a new copy of SolverStudio.","SolverStudio",MessageBoxButtons.OK) #except: # choice = MessageBox.Show("The GAMS compression library not found. Check that gmszlib1.dll still exists in the GAMSDLLs folder included in SolverStudio. If not you will need to download a new copy of SolverStudio.","SolverStudio",MessageBoxButtons.OK) # Menu.Add( "View last text data file",OpenDataFile) Menu.Add( "View last GAMS input data file in GAMSIDE...",OpenInputDataInGamsIDE) Menu.AddSeparator() Menu.Add( "Import a GDX file...",ImportGDXMenuHandler) #Menu.Add( "Create a GDX file using the Model Data",SaveGDXMenuHandler) Menu.AddSeparator() global doFixChoice doFixChoice=Menu.Add( "Fix Minor Errors",FixErrorClickMenu) Menu.AddSeparator() global queueChoice queueChoice=Menu.Add( "Run in short NEOS queue",QueueClickMenu) Menu.Add( "Set Email Address for NEOS...",SetNEOSEmail) global solverMenu chooseSolverMenu = Menu.Add ("Choose Solver",emptyClickMenu) gamsSolvers, categoryDict = ChooseSolver() solverMenu = {} try: for i in gamsSolvers: solverMenu[i]=[] categoryMenu = ToolStripMenuItem(categoryDict[i],None,emptyClickMenu) solverMenu[i].append(categoryMenu) chooseSolverMenu.DropDownItems.Add(categoryMenu) solverMenu[i].append({}) for j in gamsSolvers[i]: solverMenu[i][1][j] = ToolStripMenuItem(j,None,SolverClickMenu) categoryMenu.DropDownItems.Add(solverMenu[i][1][j]) except: choice = MessageBox.Show("A NEOS category is no longer supported by GAMSonNEOS.\n\nDo you wish to update the NEOS solver list now?","SolverStudio",MessageBoxButtons.OK) if choice == DialogResult.OK: SolverStudio.RunInDialog("NEOS Solver List Update for GAMS.",UpdateSolverListWorker,True,True,True) Menu.Add( "Update NEOS Solvers...",UpdateSolverListMenuHandler) Menu.Add( "Test NEOS Connection...",TestNEOSConnection) Menu.AddSeparator() Menu.Add( "Open GAMS web page",OpenGAMSWebSite) Menu.Add( "Open GAMS online documentation",OpenGAMSOnlineDocumentation) Menu.Add( "Open GAMS download web page",OpenGAMSDownload) Menu.AddSeparator() Menu.Add( "Open the NEOS web page",OpenNEOSWebSite) Menu.AddSeparator() Menu.Add( "About GAMSNEOS Processor",About)
def Initialise(): #Menu.DropDownItems.Add( ToolStripMenuItem("Test",None,MenuTester) ) Menu.ToolStripMenuItem.MouseDown += Update NeosWarning() DLLPath = CheckDLL() try: if DLLPath[0]==";": DLLPath=DLLPath[1:] if not os.path.exists(DLLPath + "\\gmszlib1.dll"): choice = MessageBox.Show("The GAMS compression library not found. Check that gmszlib1.dll still exists in the GAMSDLLs folder included in SolverStudio. If not you will need to download a new copy of SolverStudio.","SolverStudio",MessageBoxButtons.OK) except: choice = MessageBox.Show("The GAMS compression library not found. Check that gmszlib1.dll still exists in the GAMSDLLs folder included in SolverStudio. If not you will need to download a new copy of SolverStudio.","SolverStudio",MessageBoxButtons.OK) # Menu.Add( "View last text data file",OpenDataFile) Menu.Add( "View last GAMS input data file in GAMSIDE",OpenInputDataInGamsIDE) Menu.AddSeparator() Menu.Add( "Import a GDX file",ImportGDXMenuHandler) #Menu.Add( "Create a GDX file using the Model Data",SaveGDXMenuHandler) Menu.AddSeparator() global doFixChoice doFixChoice=Menu.Add( "Fix Minor Errors",FixErrorClickMenu) global queueChoice queueChoice=Menu.Add( "Run in short queue",QueueClickMenu) global solverMenu chooseSolverMenu = Menu.Add ("Choose Solver",emptyClickMenu) gamsSolvers, categoryDict = ChooseSolver() solverMenu = {} try: for i in gamsSolvers: solverMenu[i]=[] categoryMenu = ToolStripMenuItem(categoryDict[i],None,emptyClickMenu) solverMenu[i].append(categoryMenu) chooseSolverMenu.DropDownItems.Add(categoryMenu) solverMenu[i].append({}) for j in gamsSolvers[i]: solverMenu[i][1][j] = ToolStripMenuItem(j,None,SolverClickMenu) categoryMenu.DropDownItems.Add(solverMenu[i][1][j]) except: choice = MessageBox.Show("A NEOS category is no longer supported by GAMSonNEOS.\nLaunch NEOS solver list updater.","SolverStudio",MessageBoxButtons.OK) if choice == DialogResult.OK: SolverStudio.RunInDialog("This will update the NEOS Solver List for GAMS.",UpdateSolverListWorker,True,True,True) Menu.AddSeparator() Menu.Add( "Open GAMS web page",OpenGAMSWebSite) Menu.Add( "Open GAMS online documentation",OpenGAMSOnlineDocumentation) Menu.Add( "Open GAMS download web page",OpenGAMSDownload) Menu.AddSeparator() Menu.Add( "Update NEOS Solvers",UpdateSolverListMenuHandler) Menu.Add( "Open the NEOS web page",OpenNEOSWebSite)
def EzMenu(name, menu_table): menu = ToolStripMenuItem(name) for m in menu_table: if not m.get('name') or m['name'] == '-': menu.DropDownItems.Add(ToolStripSeparator()) continue if not m.get('item'): continue # Disabled if type(m['item']) == list: menu.DropDownItems.Add(EzMenu(m['name'], m['item'])) else: item = ToolStripMenuItem(m['name'], None, m['item']) #item.Text += m['name'] #item.Click += m['item'] if m.get('icon'): item.Image = Image.FromFile(m['icon']) if m.get('check'): item.Checked = True menu.DropDownItems.Add(item) return menu
def _generate_menu_strip(self): menu_strip = MenuStrip() menu_strip.Parent = self file_item = ToolStripMenuItem("File") menu_strip.Items.Add(file_item) new_game = ToolStripMenuItem("New game") file_item.DropDownItems.Add(new_game) self._easy = ToolStripMenuItem("Easy") self._easy.Click += self._on_new_game_click new_game.DropDownItems.Add(self._easy) self._normal = ToolStripMenuItem("Normal") self._normal.Click += self._on_new_game_click new_game.DropDownItems.Add(self._normal) self._hard = ToolStripMenuItem("Hard") self._hard.Click += self._on_new_game_click new_game.DropDownItems.Add(self._hard) self._new_game_handlers = [] self.checkBox = CheckBox() self.checkBox.Text = "Nightmare" self.checkBox.Size = Size(100, 20) self.checkBox.Checked = False nightmare = ToolStripControlHost(self.checkBox) nightmare.Size = Size(100, 20) new_game.DropDownItems.Add(nightmare) self._exit = ToolStripMenuItem("Exit") self._exit.Click += self._exit_game file_item.DropDownItems.Add(self._exit)
def Initialise(): #Menu.DropDownItems.Add( ToolStripMenuItem("Test",None,MenuTester) ) Menu.ToolStripMenuItem.MouseDown += Update Menu.Add( "View Last Data File",OpenDataFile) Menu.AddSeparator() global doFixChoice doFixChoice=Menu.Add( "Fix Minor Errors",doFixClickMenu) Menu.AddSeparator() global queueChoice queueChoice=Menu.Add( "Run in short NEOS queue",QueueClickMenu) Menu.Add( "Set Email Address for NEOS...",SetNEOSEmail) chooseSolverMenu = Menu.Add ("Choose Solver",emptyClickMenu) amplSolvers, categoryDict = ReadSolversFiles() global solverMenu solverMenu = {} try: for i in amplSolvers: solverMenu[i]=[] categoryMenu = ToolStripMenuItem(categoryDict[i],None,emptyClickMenu) solverMenu[i].append(categoryMenu) chooseSolverMenu.DropDownItems.Add(categoryMenu) solverMenu[i].append({}) for j in amplSolvers[i]: solverMenu[i][1][j] = ToolStripMenuItem(j,None,SolverClickMenu) categoryMenu.DropDownItems.Add(solverMenu[i][1][j]) except: choice = MessageBox.Show("A NEOS category is no longer supported by AMPLonNEOS.\n\nDo you wish to update the NEOS solver list now?","SolverStudio",MessageBoxButtons.OK) if choice == DialogResult.OK: SolverStudio.RunInDialog("NEOS Solver List Update for AMPL.",UpdateSolverListWorker,True,True,True) Menu.Add( "Update NEOS Solvers...",UpdateSolverListMenuHandler) Menu.Add( "Test NEOS Connection...",TestNEOSConnection) Menu.AddSeparator() Menu.Add( "Open AMPL.com",VisitAMPLWebPage) Menu.Add( "Open online AMPL book",VisitAMPLBookWebPage) Menu.Add( "Open online AMPL PDF documentation",OpenAMPLpdf) # Menu.Add( "-",None) This does not work :-( Menu.Add( "Open neos-server.org",VisitNEOSWebPage) Menu.AddSeparator() Menu.Add( "About AMPL on NEOS Processor",About)
def __init__(self): """ContextMenuStripSample class init function.""" # set up form self.Text = "ContextMenuStrip control" # set up menu items sample_dir = sys.path[0] image_path = os.path.join(sample_dir, "apple-red.png") self.toolstrip_menuitem1 = ToolStripMenuItem("Apple") self.toolstrip_menuitem1.Click += self.cms_click self.toolstrip_menuitem1.Image = Bitmap.FromFile(image_path) self.toolstrip_menuitem1a = ToolStripMenuItem("Macintosh") self.toolstrip_menuitem1b = ToolStripMenuItem("Delicious") self.toolstrip_menuitem2 = ToolStripMenuItem("Banana") self.toolstrip_menuitem2.Click += self.cms_click self.toolstrip_menuitem3 = ToolStripMenuItem("Watermelon") self.toolstrip_menuitem3.Click += self.cms_click self.toolstrip_menuitem4 = ToolStripMenuItem("Orange") self.toolstrip_menuitem4.Click += self.cms_click self.toolstrip_menuitem5 = ToolStripMenuItem("Peach") self.toolstrip_menuitem5.Click += self.cms_click # set up context_menu_strip self.context_menu_strip = ContextMenuStrip() self.toolstrip_menuitem1.DropDownItems.Add(self.toolstrip_menuitem1a) self.toolstrip_menuitem1.DropDownItems.Add(self.toolstrip_menuitem1b) self.context_menu_strip.Items.Add(self.toolstrip_menuitem1) self.context_menu_strip.Items.Add(self.toolstrip_menuitem2) self.context_menu_strip.Items.Add(self.toolstrip_menuitem3) self.context_menu_strip.Items.Add(self.toolstrip_menuitem4) self.context_menu_strip.Items.Add(self.toolstrip_menuitem5) # set up label self.label = Label() self.label.Text = "Right Click on me to see ContextMenuStrip" self.label.Width = 200 self.label.Height = 50 self.label.ContextMenuStrip = self.context_menu_strip self.label.BackColor = Color.Cyan self.label.BorderStyle = BorderStyle.FixedSingle # add controls self.Controls.Add(self.label)
def Initialise(): Menu.ToolStripMenuItem.MouseDown += UpdateMenu # CheckSolversPath() #Menu.DropDownItems.Add( ToolStripMenuItem("Test",None,MenuTester) ) Menu.Add("View Last Data File", OpenDataFile) Menu.AddSeparator() global solverMenu solverMenu = {} # This does a check of solvers in the SOlvers directory, and also adds all popular solvers not in the list. chooseSolverMenu = Menu.Add("Choose Solver", emptyClickMenu) pyomoSolvers = [] for path in SolverStudio.GetSolversPaths(): pyomoSolvers = pyomoSolvers + os.listdir(path) # pyomoSolvers2 = ["Bonmin","CBC","CPlex","Couenne","GLPK", "Gurobi","IPOpt","LPSolve"] pyomoSolvers2 = ["Bonmin", "CPlex", "Couenne", "GLPK", "Gurobi", "IPOpt"] pyomoSolvers2lc = [x.lower() for x in pyomoSolvers2] for i in pyomoSolvers: if i[-4:].lower() != ".exe" and i[-4:].lower() != ".bat": continue # only show .exe and .bat files i = i.replace(".exe", "").strip() # Keep the case for showing in the menu if not i.lower() in pyomoSolvers2lc: pyomoSolvers2.append(i) pyomoSolvers3 = sorted(pyomoSolvers2, key=str.lower) for i in pyomoSolvers3: solver = ToolStripMenuItem(i, None, SolverClickMenu) solverMenu[i] = solver chooseSolverMenu.DropDownItems.Add(solver) Menu.AddSeparator() Menu.Add("Open Pyomo web site", VisitPYOMOWebPage) Menu.Add("Open Pyomo online documentation", VisitPYOMODocumentationPage) Menu.Add("Open Pyomo install page", VisitPYOMODownloadPage) Menu.AddSeparator() Menu.Add("About Pyomo Processor", About) if SolverStudio.GetPYOMOPath(False) == None: myForm = DownloadForm() myForm.ShowDialog()
def Dodaj(frm): tipka = ToolStripMenuItem(name) tipka.Tag = frm frm.addedOperationsToolStripMenuItem.DropDownItems.Add(tipka) tipka.Click += cosinus
if isinstance(child, BRRESNode) and child.HasChildren: # Export the BRRES without compression to a filename that matches the RSP implementation child.ExportUncompressed(folder + "/MenSelchrFaceB" + ("%02d" % (child.FileIndex, )) + "0.brres") # Increment the count for every successful export count += 1 if count: # If successful, print success message BrawlAPI.ShowMessage( str(count) + " BRRESs were successfully exported to " + folder, "Success") else: # Otherwise, print error message BrawlAPI.ShowError('No BRRESs were found in the open file', 'Error') # Add a button to our right click menu. In this case, adds a button to the right click menu for any ARC named "char_bust_tex_lz77" # # Arguments are (in order) as follows: # Wrapper: Denotes which wrapper the context menu items will be added to # Submenu: If not blank, adds to a submenu with this name # Description: Creates a mouseover description for the item # Conditional: When the wrapper's context menu is opened, this function is called. Allows enabling/disabling of plugin members based on specific conditions # Items: One or more toolstripmenuitems that will be added BrawlAPI.AddContextMenuItem( ARCWrapper, "", "Exports the CSPs in this ARC to Results Screen formatted BRRESs", EnableCheck, ToolStripMenuItem("Export as RSPs", None, export_to_results))
# Called by super class to check if this loader matches the data def TryParse(self, stream): src = file(stream) src.seek(5, 0) i = struct.unpack('>I', src.read(4))[0] #if yes, return an instance of our class. #if i == 0x52464E54: #RFNT # return RFNTNode() #else: # return None return None def OnInitialize(self): if self._name is None: self._name = "NW4R Font" return False def doSomething_handler(sender, event_args): bboxapi.ShowMessage("doing something", "title") # Create an instance of our node class and add it to the API loader cache node = RFNTNode() bboxapi.AddLoader(node) # Add a button to our right click menu bboxapi.AddContextMenuItem( ARCWrapper, ToolStripMenuItem("Do Something", None, doSomething_handler))
0 - link._rawValue._y) for plane in cObj._planes: plane.SwapLinks() if plane._type == CollisionPlaneType.Floor: plane._type = CollisionPlaneType.Ceiling plane.IsFallThrough = False plane.IsRightLedge = False plane.IsLeftLedge = False elif plane._type == CollisionPlaneType.Ceiling: plane._type = CollisionPlaneType.Floor BrawlAPI.SelectedNode.SignalPropertyChange() MainForm.Instance.resourceTree_SelectionChanged(None, None) # Add a button to our right click menu. In this case, adds buttons to the right click menu for any Collision Wrapper # # Arguments are (in order) as follows: # Wrapper: Denotes which wrapper the context menu items will be added to # Submenu: If not blank, adds to a submenu with this name # Description: Creates a mouseover description for the item # Conditional: When the wrapper's context menu is opened, this function is called. Allows enabling/disabling of plugin members based on specific conditions # Items: One or more toolstripmenuitems that will be added BrawlAPI.AddContextMenuItem( CollisionWrapper, 'Mirror', 'Flips Collision along the X-Axis', EnableCheck, ToolStripMenuItem('Mirror Unbound Collisions (X-Axis)', None, coll_flip_x)) BrawlAPI.AddContextMenuItem( CollisionWrapper, 'Mirror', 'Flips Collision along the Y-Axis', EnableCheck, ToolStripMenuItem('Mirror Unbound Collisions (Y-Axis)', None, coll_flip_y))
if isinstance(BrawlAPI.SelectedNode, CHR0Node): for node in BrawlAPI.SelectedNode.Children: clear_node_rotation(node) else: clear_node_rotation(BrawlAPI.SelectedNode) BrawlAPI.RefreshPreview() def clear_node_rotation(node): for x in range(0, node.FrameCount): node.RemoveKeyframeOnlyRot(x) BrawlAPI.AddContextMenuItem( CHR0Wrapper, None, 'Clears translation keyframes for all entries', None, ToolStripMenuItem('Clear Translation', None, clear_translation)) BrawlAPI.AddContextMenuItem( CHR0Wrapper, None, 'Clears rotation keyframes for all entries', None, ToolStripMenuItem('Clear Rotation', None, clear_rotation)) BrawlAPI.AddContextMenuItem( CHR0Wrapper, None, 'Clears scale keyframes for all entries', None, ToolStripMenuItem('Clear Scale', None, clear_scale)) BrawlAPI.AddContextMenuItem( CHR0EntryWrapper, None, 'Clears translation keyframes', None, ToolStripMenuItem('Clear Translation', None, clear_translation)) BrawlAPI.AddContextMenuItem( CHR0EntryWrapper, None, 'Clears rotation keyframes', None, ToolStripMenuItem('Clear Rotation', None, clear_rotation)) BrawlAPI.AddContextMenuItem( CHR0EntryWrapper, None, 'Clears scale keyframes', None, ToolStripMenuItem('Clear Scale', None, clear_scale))
# If the tag matches, return an instance of our class if tag == "RFNT": #RFNT return RFNTNode() # Otherwise, return null as a fail state return None # Called for each instance of a new node, in order to set it up properly. This is where data beyond the tag should be read and stored def OnInitialize(self): # On initialize returns true if it has children, false if it does not return False # Wrapper for font files class RFNTWrapper(PluginWrapper): # This function returns a new instance of the class. # Necessary in order to properly call necessary functions def GetInstance(self): return RFNTWrapper() # Basic test function that is called by the context menu def doSomething_handler(sender, event_args): BrawlAPI.ShowMessage("This is a test function","Title") # Create an instance of our node class and add it to the API loader cache node = RFNTNode() BrawlAPI.AddResourceParser(node) # Create an instance of our wrapper class and add it to the API wrapper cache wrapper = RFNTWrapper() BrawlAPI.AddWrapper[RFNTNode](wrapper) # Add a context menu item to our new wrapper BrawlAPI.AddContextMenuItem(RFNTWrapper, ToolStripMenuItem("Do Something", None, doSomething_handler))
"X-Translation", 0.0) transY = BrawlAPI.UserFloatInput( "Y Translation offset to apply to the UVs (Applied second)", "Y-Translation", 0.0) shiftUV(scaleX, scaleY, transX, transY) def shiftUV(scaleX, scaleY, transX, transY): i = 0 # Apply the modifiers to each UV point for vec2 in BrawlAPI.SelectedNode.Points: vec2.X = vec2.X * scaleX vec2.X = vec2.X + transX vec2.Y = vec2.Y * scaleY vec2.Y = vec2.Y + transY # Due to some quirk, necessary to set this manually to ensure saving works BrawlAPI.SelectedNode.Points[i] = vec2 i += 1 # Due to some quirk, necessary to set this manually to ensure saving works BrawlAPI.SelectedNode.Points = BrawlAPI.SelectedNode.Points # Flag node as needing saving BrawlAPI.SelectedNode.SignalPropertyChange() # Create an instance of our wrapper class and add it to the API wrapper cache wrapper = UVWrapper() BrawlAPI.AddWrapper[MDL0UVNode](wrapper) # Add a context menu item to our new wrapper BrawlAPI.AddContextMenuItem( UVWrapper, ToolStripMenuItem("Shift UVs", None, shiftUV_handler))