Menu

[r169]: / drplugins / ShowLineinBrowser.py  Maximize  Restore  History

Download this file

58 lines (45 with data), 1.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#------------------------------------
# Programmer: Antonio Barbosa
# E-mail: ab@jn.pt
# Note: Initial Release 19 Fev 2006
#
#Plugin
#ShowLineinBrowser
#This plugin is only a Test: shows current line
import wx
import drScrolledMessageDialog
from drSourceBrowser import drSourceBrowserPanel
def OnAbout(DrFrame):
Version = "0.0.1"
NameAndVersion = "ShowLineinBrowser:\n\nVersion: " + Version + "\n"
AboutString = NameAndVersion + "By Antonio Barbosa"
drScrolledMessageDialog.ShowMessage(DrFrame, AboutString, "About")
def OnHelp(DrFrame):
HelpString = "Shows current edit line in the browser tree"
drScrolledMessageDialog.ShowMessage(DrFrame, HelpString, "Help")
def Plugin(DrFrame):
def OnShowLineinBrowser(event):
if not DrFrame.SourceBrowser:
return
browsepanel = DrFrame.SourceBrowser
browsetree = browsepanel.classtree
currentline = DrFrame.txtDocument.GetCurrentLine()
currentpos = DrFrame.txtDocument.PositionFromLine(currentline)
i = -1
for pos in browsepanel.ItemsPos:
i += 1
if pos == currentpos:
break
elif pos > currentpos:
i -= 1
break
if i < 0:
i = 0
treeindex=browsepanel.ItemsIndex[i]
browsetree.SelectItem(treeindex, True)
DrFrame.AddPluginShortcutFunction("ShowLineinBrowser", "Show Line in Browser", OnShowLineinBrowser)
DrFrame.AddPluginPopUpMenuFunction("ShowLineinBrowser", "Show Line in Browser", OnShowLineinBrowser)
DrFrame.LoadPluginShortcuts('ShowLineinBrowser')
ID_MYLINE = DrFrame.GetNewId()
DrFrame.viewmenu.Append(ID_MYLINE, DrFrame.GetPluginMenuLabel("ShowLineinBrowser", "Show Line in Browser", "Show Line in Browser"))
DrFrame.Bind(wx.EVT_MENU, OnShowLineinBrowser, id=ID_MYLINE)