-
Notifications
You must be signed in to change notification settings - Fork 7
/
sandbox.py
71 lines (56 loc) · 2.13 KB
/
sandbox.py
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# peppy Copyright (c) 2006-2008 Rob McMullen
# Licenced under the GPLv2; see http://peppy.flipturn.org for more info
"""Graphviz DOT Language editing support.
L{Graphviz<http://graphviz.org/>} is a high quality open source
program to automatically layout directed and undirected graphs from a
text description of the node and edge relationships. The description
language is called L{DOT<http://graphviz.org/doc/info/lang.html>} and
in most cases is generated by a program. It is rare to write one by
hand, but when you have to, this mode is helpful.
"""
import os
import time
import wx
from peppy.yapsy.plugins import *
from peppy.menu import *
from peppy.major import *
class SlowProgressBarTest(SelectAction):
name = "Slow test of the progress bar"
tooltip = "Test the progress bar"
default_menu = "&Help/Tests"
delay = .2
def action(self, index=-1, multiplier=1):
wx.CallAfter(self.statusbarTest)
def statusbarTest(self):
mode = self.frame.getActiveMajorMode()
if mode is not None:
mode.buffer.setBusy(True)
statusbar = mode.statusbar
statusbar.startProgress("Testing...", 100, True)
for i in range(100):
if statusbar.isCancelled():
break
statusbar.updateProgress(i)
wx.Yield()
time.sleep(self.delay)
statusbar.stopProgress()
mode.buffer.setBusy(False)
class FastProgressBarTest(SlowProgressBarTest):
name = "Fast test of the progress bar"
default_menu = "&Help/Tests"
delay = .01
class ShowStyles(SelectAction):
name = "Show Line Style"
tooltip = "Show the styling information of the current line"
default_menu = "&Help/Tests"
key_bindings = {'default': 'M-S',}
@classmethod
def worksWithMajorMode(self, mode):
return hasattr(mode, 'showStyle')
def action(self, index=-1, multiplier=1):
self.mode.showStyle()
class SandboxPlugin(IPeppyPlugin):
"""Plugin to register sandbox tests.
"""
def getActions(self):
return [SlowProgressBarTest, FastProgressBarTest, ShowStyles]