File: XiteQt.py

package info (click to toggle)
mysql-workbench 6.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 113,932 kB
  • ctags: 87,814
  • sloc: ansic: 955,521; cpp: 427,465; python: 59,728; yacc: 59,129; xml: 54,204; sql: 7,091; objc: 965; makefile: 638; sh: 613; java: 237; perl: 30; ruby: 6; php: 1
file content (65 lines) | stat: -rw-r--r-- 1,651 bytes parent folder | download
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
# -*- coding: utf-8 -*-
# Requires Python 2.7 or later

import ctypes, os, sys, unittest

from PySide.QtCore import *
from PySide.QtGui import *

import ScintillaCallable

sys.path.append("..")
from bin import ScintillaEditPy

scintillaDirectory = ".."
scintillaIncludeDirectory = os.path.join(scintillaDirectory, "include")
scintillaScriptsDirectory = os.path.join(scintillaDirectory, "scripts")
sys.path.append(scintillaScriptsDirectory)
import Face

class Form(QDialog):

	def __init__(self, parent=None):
		super(Form, self).__init__(parent)
		self.resize(460,300)
		# Create widget
		self.edit = ScintillaEditPy.ScintillaEdit(self)

class XiteWin():
	def __init__(self, test=""):
		self.face = Face.Face()
		self.face.ReadFromFile(os.path.join(scintillaIncludeDirectory, "Scintilla.iface"))

		self.test = test

		self.form = Form()

		scifn = self.form.edit.send(int(self.face.features["GetDirectFunction"]["Value"]), 0, 0)
		sciptr = ctypes.c_char_p(self.form.edit.send(
			int(self.face.features["GetDirectPointer"]["Value"]), 0,0))

		self.ed = ScintillaCallable.ScintillaCallable(self.face, scifn, sciptr)
		self.form.show()
		
	def DoStuff(self):
		print(self.test)
		self.CmdTest()

	def DoEvents(self):
		QApplication.processEvents()

	def CmdTest(self):
		runner = unittest.TextTestRunner()
		tests = unittest.defaultTestLoader.loadTestsFromName(self.test)
		results = runner.run(tests)
		print(results)
		sys.exit(0)

xiteFrame = None

def main(test):
	global xiteFrame
	app = QApplication(sys.argv)
	xiteFrame = XiteWin(test)
	xiteFrame.DoStuff()
	sys.exit(app.exec_())