Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: third_party/twisted_8_1/twisted/conch/insults/client.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/twisted_8_1/twisted/conch/insults/client.py
diff --git a/third_party/twisted_8_1/twisted/conch/insults/client.py b/third_party/twisted_8_1/twisted/conch/insults/client.py
deleted file mode 100644
index 89c79cdaf0938bd358aad6c195edbf5e4ada05e1..0000000000000000000000000000000000000000
--- a/third_party/twisted_8_1/twisted/conch/insults/client.py
+++ /dev/null
@@ -1,138 +0,0 @@
-"""
-You don't really want to use this module. Try insults.py instead.
-"""
-
-from twisted.internet import protocol
-
-class InsultsClient(protocol.Protocol):
-
- escapeTimeout = 0.2
-
- def __init__(self):
- self.width = self.height = None
- self.xpos = self.ypos = 0
- self.commandQueue = []
- self.inEscape = ''
-
- def setSize(self, width, height):
- call = 0
- if self.width:
- call = 1
- self.width = width
- self.height = height
- if call:
- self.windowSizeChanged()
-
- def dataReceived(self, data):
- from twisted.internet import reactor
- for ch in data:
- if ch == '\x1b':
- if self.inEscape:
- self.keyReceived(ch)
- self.inEscape = ''
- else:
- self.inEscape = ch
- self.escapeCall = reactor.callLater(self.escapeTimeout,
- self.endEscape)
- elif ch in 'ABCD' and self.inEscape:
- self.inEscape = ''
- self.escapeCall.cancel()
- if ch == 'A':
- self.keyReceived('<Up>')
- elif ch == 'B':
- self.keyReceived('<Down>')
- elif ch == 'C':
- self.keyReceived('<Right>')
- elif ch == 'D':
- self.keyReceived('<Left>')
- elif self.inEscape:
- self.inEscape += ch
- else:
- self.keyReceived(ch)
-
- def endEscape(self):
- ch = self.inEscape
- self.inEscape = ''
- self.keyReceived(ch)
-
- def initScreen(self):
- self.transport.write('\x1b=\x1b[?1h')
-
- def gotoXY(self, x, y):
- """Go to a position on the screen.
- """
- self.xpos = x
- self.ypos = y
- self.commandQueue.append(('gotoxy', x, y))
-
- def writeCh(self, ch):
- """Write a character to the screen. If we're at the end of the row,
- ignore the write.
- """
- if self.xpos < self.width - 1:
- self.commandQueue.append(('write', ch))
- self.xpos += 1
-
- def writeStr(self, s):
- """Write a string to the screen. This does not wrap a the edge of the
- screen, and stops at \\r and \\n.
- """
- s = s[:self.width-self.xpos]
- if '\n' in s:
- s=s[:s.find('\n')]
- if '\r' in s:
- s=s[:s.find('\r')]
- self.commandQueue.append(('write', s))
- self.xpos += len(s)
-
- def eraseToLine(self):
- """Erase from the current position to the end of the line.
- """
- self.commandQueue.append(('eraseeol',))
-
- def eraseToScreen(self):
- """Erase from the current position to the end of the screen.
- """
- self.commandQueue.append(('eraseeos',))
-
- def clearScreen(self):
- """Clear the screen, and return the cursor to 0, 0.
- """
- self.commandQueue = [('cls',)]
- self.xpos = self.ypos = 0
-
- def setAttributes(self, *attrs):
- """Set the attributes for drawing on the screen.
- """
- self.commandQueue.append(('attributes', attrs))
-
- def refresh(self):
- """Redraw the screen.
- """
- redraw = ''
- for command in self.commandQueue:
- if command[0] == 'gotoxy':
- redraw += '\x1b[%i;%iH' % (command[2]+1, command[1]+1)
- elif command[0] == 'write':
- redraw += command[1]
- elif command[0] == 'eraseeol':
- redraw += '\x1b[0K'
- elif command[0] == 'eraseeos':
- redraw += '\x1b[OJ'
- elif command[0] == 'cls':
- redraw += '\x1b[H\x1b[J'
- elif command[0] == 'attributes':
- redraw += '\x1b[%sm' % ';'.join(map(str, command[1]))
- else:
- print command
- self.commandQueue = []
- self.transport.write(redraw)
-
- def windowSizeChanged(self):
- """Called when the size of the window changes.
- Might want to redraw the screen here, or something.
- """
-
- def keyReceived(self, key):
- """Called when the user hits a key.
- """
« no previous file with comments | « third_party/twisted_8_1/twisted/conch/insults/__init__.py ('k') | third_party/twisted_8_1/twisted/conch/insults/colors.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698