예제 #1
0
	def __init__(self):
		Pentacle.__init__(self)
		self.win = gtk.Window()
		self.win.connect("delete_event", self.Exit)

		self.boxMain = gtk.VBox(False, 0)
		self.win.add(self.boxMain)
		self.boxMain.unset_flags(gtk.CAN_FOCUS)

		self.SetMenus()

		self.findWhat = Literal("")
		self.replaceWhat = Literal("")
		self.panesVisible = 0
		self.findPane = self.PaneFind()
		self.boxMain.pack_start(self.findPane, False, False, 0)
		self.replacePane = self.PaneFindReplace()
		self.boxMain.pack_start(self.replacePane, False, False, 0)

		for t in self.tc:
			t.CreateControl(self.win)
		self.tc[0].AddTo(self.boxMain)
		
		self.win.show_all()
		self.findPane.hide_all()
		self.replacePane.hide_all()
		self.tc[0].Focus()
예제 #2
0
 def Command(self, id):
     idStripped = id.replace(u" ", "")
     method = "Cmd" + idStripped
     cmd = None
     try:
         cmd = getattr(self, method)
     except AttributeError:
         for k, v in self.ModeNames().iteritems():
             if v.replace(u" ", u"") == idStripped:
                 self.SetOverrideMode(k)
                 self.ControlActive().Invalidate()
                 return
     if cmd:
         cmd()
     else:
         if idStripped in ["Compile", "Build", "Go"]:
             cmd = self.pdoc.options.ModeValue(
                 self.pdoc.currentMode, Literal("tools." + str(idStripped)))
             editor = "c:\\rs\\sinkworld\\tentacle\\python\\PentacleWin.py"
             print "pythonw -u %s -x \"%s %s\"" % (editor, cmd,
                                                   self.fullPath)
             os.system("pythonw -u %s -x \"%s %s\"" %
                       (editor, cmd, self.fullPath))
         else:
             for name in self.ModeFiles() + self.mru:
                 if name.replace(u" ", u"") == idStripped:
                     if "\\" in name or "/" in name:
                         self.GrabFile(name)
                         self.FocusText()
예제 #3
0
파일: Pentacle.py 프로젝트: calandoa/zxite
	def OptionsFromSuffix(self, suffix):
		opts = {}
		if self.pdoc and self.pdoc.options:
			literalSuffix = Literal(suffix)
			keys = self.pdoc.options.Keys(literalSuffix)
			for i in range(keys.Length()):
				k = keys.GetText(i)
				opts[unicode(k)[:-len(suffix)]] = unicode(self.pdoc.options.Value(k))
		return opts
예제 #4
0
파일: Pentacle.py 프로젝트: calandoa/zxite
	def CreateStyling(self, name):
		self.DeallocateStyling()

		literalName = LiteralFromUnicode(name)

		dot = literalName.Length()
		while (dot > 0) and literalName.CharAt(dot-1) != ord('.'):
			dot -= 1
		slen = literalName.Length() - dot
		literalExtension = Literal(literalName, dot, literalName.Length() - dot)
		self.ReadOptionsAndModes()
		if self.overrideMode:
			print "Override Mode", self.overrideMode, literalExtension
			self.pdoc.currentMode = self.overrideMode
			self.pdoc.CreateStyling(Literal(""))
		else:
			print "Base Mode", literalExtension
			self.pdoc.currentMode = Literal("")
			self.pdoc.CreateStyling(literalExtension)
		for t in self.tc:
			t.SetDocument(self.pdoc, self)
예제 #5
0
파일: Pentacle.py 프로젝트: calandoa/zxite
	def __init__(self):
		self.activeControl = None
		self.appName = u"Pentacle"
		self.fullPath = u""
		self.overrideMode = None
		self.win = None
		self.titleAtSavePoint = 1
		self.fontNames = LiteralSet()
		self.fontDefault = Literal("Verdana")
		self.pdoc = SinkWorld.Document(self.fontDefault, self.fontNames)
		self.tc = [SinkWorld.TentacleControl.Allocate()]
		self.tc[0].SetDocument(self.pdoc, self)
		self.ReadOptionsAndModes()
예제 #6
0
파일: Pentacle.py 프로젝트: calandoa/zxite
	def ReadOptionsAndModes(self):
		self.pdoc.ClearOptions()
		try:
			homeDir = os.environ["USERPROFILE"]
		except KeyError:
			homeDir = os.environ["HOME"]
		userOptions = os.path.join(homeDir, "user.options")
		if not self.ReadOptionsFile(None, userOptions):
			print >>stderr, "No options file:", userOptions
			system.exit(1)
		for name in glob.glob(os.path.join(homeDir, "*")):
			if name.endswith(".mode"):
				baseName = os.path.basename(name)
				baseName = baseName[:-5]
				modeName = Literal("mode." + baseName)
				self.ReadOptionsFile(modeName, name)
예제 #7
0
def LiteralFromEntry(s, w):
	return Literal(w.get_text())
예제 #8
0
def LiteralFromUnicode(u):
    return Literal(u.encode("UTF-8"))
예제 #9
0
파일: Pentacle.py 프로젝트: calandoa/zxite
	def WordAtCaret(self):
		word = Literal()
		self.ControlActive().WordAtPosition(\
			self.ControlActive().GetSelectionRange().Caret(), word)
		return word