def ConfigureW(self, info): with pygin.Console(): print("------------") print("Very configure. Wow.") print("Config Menu id: " + str(info.Guid)) print("------------") return True
def DoConsoleStuff(self, info, BreakCode): WindowType = self.AdvControl(far.AdvancedControlCommands.GetWindowType) with pygin.Console(): print("------------") print(self.GetMsg(lng.TheMessage)) print("Plugin Menu id: " + str(info.Guid)) print("BreakCode is " + str(BreakCode[0])) Version = self.AdvControl( far.AdvancedControlCommands.GetFarManagerVersion) if Version is not None: print("Far version: {0}".format(Version)) if WindowType is not None: print("Current window: {0}".format(WindowType.Type.name)) PanelInfo = self.ActivePanel.PanelControl( far.FileControlCommands.GetPanelInfo) if PanelInfo is not None: print("Panel info:") pprint(vars(PanelInfo)) PanelItem = self.ActivePanel.PanelControl( far.FileControlCommands.GetCurrentPanelItem) if PanelItem is not None: print("Current panel item:") pprint(vars(PanelItem)) for Command in [ far.FileControlCommands.GetColumnTypes, far.FileControlCommands.GetColumnWidths, far.FileControlCommands.GetPanelPrefix, far.FileControlCommands.GetPanelHostFile, far.FileControlCommands.GetPanelFormat, ]: Value = self.ActivePanel.PanelControl(Command) if Value is not None: print("{0}: {1}".format(Command.name, Value)) print("------------")
def OpenW(self, info): if info.OpenFrom == far.OpenFrom.FromMacro: with pygin.Console(): for value in info.Data.Values: print(value.Type.name, ": ", value.Value, sep="") return None elif info.OpenFrom == far.OpenFrom.CommandLine: with pygin.Console(): Result = eval(info.Data.CommandLine) if Result is not None: print("Result: {0}".format(Result)) return None BreakCode = [0] ItemId = self.Menu( uuid.UUID("{F86FD79D-21A7-4CCA-BD37-D2151AE5DA4E}"), -1, -1, 0, far.MenuFlags.WrapMode, "Look, it's a menu! (opened from " + info.OpenFrom.name + ")", "A, B, C work as Enter", "MenuTopic", [ far.FarKey(ord('A'), 0), far.FarKey(ord('B'), 0), far.FarKey(ord('C'), 0), ], BreakCode, [ far.MenuItem("Do Console Stuff", 0x263A), far.MenuItem("Do Input Box (press '7')", 0, far.FarKey(ord('7'), 0)), far.MenuItem("Do Message", far.MenuItemFlags.Checked), far.MenuItem("Do Help"), ]) if ItemId == 0: self.DoConsoleStuff(info, BreakCode) elif ItemId == 1: self.AdvControl(far.AdvancedControlCommands.RedrawAll) Response = self.InputBox( uuid.UUID("{0F87C22C-4F6F-4B71-90EC-C3C89B03010B}"), "Attention", "Your opinion is very important to us:", "InputHistory", "", 1024, "InputBoxTopic", far.InputBoxFlags.Buttons) if Response is not None: Style = 0 Message = "Isn't that awesome?" else: Response = "Nothing" Style = far.MessageFlags.Warning Message = "Shame on you." self.Message(uuid.UUID("{49A144B8-C0BB-4EDF-B8AD-8F3590BA9C64}"), Style, "Message1Topic", "Results", ["You have entered:", "\1", Response, "\1", Message], ["Indeed"]) elif ItemId == 2: fmf = far.MessageFlags self.Message(uuid.UUID("{49A144B8-C0BB-4EDF-B8AD-8F3590BA9C64}"), fmf.Warning | fmf.LeftAlign, "Message2Topic", "Behold!", [ "Lorem ipsum dolor sit amet,", "consectetur adipiscing elit,", "sed do eiusmod tempor incididunt", "ut labore et dolore magna aliqua." ], ["Left", "Right"]) elif ItemId == 3: self.ShowHelp("Contents", far.HelpFlags.Guid) else: pass # for panel: # return id(Instance) # for nothing return None