def initializeInstance(self): # Remove BlissFramework application lockfile #self.guiConfiguration=qt.qApp.mainWidget().configuration if BlissFramework.get_gui_version() == "qt3": from qt import qApp self.guiConfiguration = qApp.mainWidget().configuration elif BlissFramework.get_gui_version() == "qt4": from PyQt4.QtGui import QApplication self.guiConfiguration = QApplication.activeWindow().configuration else: logging.getLogger("HWR").error('InstanceServer: % gui version not supported' % \ BlissFramework.get_gui_version()) lockfilename=os.path.join(tempfile.gettempdir(), '.%s.lock' % BlissFramework.loggingName) try: os.unlink(lockfilename) except: pass self.emit('instanceInitializing', ()) if self.isLocal(): self.startServer() else: self.connectToServer()
def initializeInstance(self): # Remove BlissFramework application lockfile #self.guiConfiguration=qt.qApp.mainWidget().configuration if BlissFramework.get_gui_version() == "qt3": from qt import qApp self.guiConfiguration = qApp.mainWidget().configuration elif BlissFramework.get_gui_version() == "qt4": from PyQt4.QtGui import QApplication self.guiConfiguration = QApplication.activeWindow().configuration else: logging.getLogger("HWR").error('InstanceServer: % gui version not supported' % \ BlissFramework.get_gui_version()) lockfilename = os.path.join(tempfile.gettempdir(), '.%s.lock' % BlissFramework.loggingName) try: os.unlink(lockfilename) except: pass self.emit('instanceInitializing', ()) if self.isLocal(): self.startServer() else: self.connectToServer()
def initializeInstance(self): # Remove BlissFramework application lockfile #self.guiConfiguration=qt.qApp.mainWidget().configuration if qt_variant == 'PyQt5': from PyQt5.QtWidgets import QApplication for widget in QApplication.allWidgets(): if hasattr(widget, "configuration"): self.guiConfiguration = widget.configuration break elif qt_variant == 'PyQt4': from PyQt4.QtGui import QApplication for widget in QApplication.allWidgets(): if hasattr(widget, "configuration"): self.guiConfiguration = widget.configuration break else: from qt import qApp self.guiConfiguration = qApp.mainWidget().configuration lockfilename = os.path.join(tempfile.gettempdir(), '.%s.lock' % BlissFramework.loggingName) try: os.unlink(lockfilename) except: pass self.emit('instanceInitializing', ()) if self.isLocal(): self.startServer() else: self.connectToServer()
def initializeInstance(self): # Remove BlissFramework application lockfile #self.guiConfiguration=qt.qApp.mainWidget().configuration if qt_variant == 'PyQt5': from PyQt5.QtWidgets import QApplication for widget in QApplication.allWidgets(): if hasattr(widget, "configuration"): self.guiConfiguration = widget.configuration break elif qt_variant == 'PyQt4': from PyQt4.QtGui import QApplication for widget in QApplication.allWidgets(): if hasattr(widget, "configuration"): self.guiConfiguration = widget.configuration break else: from qt import qApp self.guiConfiguration = qApp.mainWidget().configuration lockfilename=os.path.join(tempfile.gettempdir(), '.%s.lock' % BlissFramework.loggingName) try: os.unlink(lockfilename) except: pass self.emit('instanceInitializing', ()) if self.isLocal(): self.startServer() else: self.connectToServer()
def makeOrderedList(): self = qApp.mainWidget() text = unicode(self.sourceEditor.selectedText()) self.sourceEditor.removeSelectedText() lines = ["<li>%s</li>" % line for line in text.split("\n")] newtext = "<ol>\n%s\n</ol>" % ( "\n".join(lines) ) line, index = self.sourceEditor.getCursorPosition() self.sourceEditor.insertAt(newtext, line, index)
def insertImage(): self = qApp.mainWidget() imagedialog = ImageForm_Impl(self) if imagedialog.exec_loop(): imagetag = imagedialog.imagetag() if imagetag: line, index = self.sourceEditor.getCursorPosition() self.sourceEditor.insertAt(imagetag, line, index) self.sourceEditor.setCursorPosition(line, index+len(imagetag))
def insertUrl(): self = qApp.mainWidget() text = unicode(self.sourceEditor.selectedText()) urldialog = UrlDialog_Impl(self) urldialog.initValues(text) if urldialog.exec_loop(): urltag = urldialog.urltag() if urltag: self.sourceEditor.removeSelectedText() line, index = self.sourceEditor.getCursorPosition() self.sourceEditor.insertAt(urltag, line, index) self.sourceEditor.setCursorPosition(line, index+len(urltag))
def alignRight(): surroundWith(qApp.mainWidget(), 'div', 'align="right"')
def decFont(): surroundWith(qApp.mainWidget(), 'font', 'size="-1"')
def incFont(): surroundWith(qApp.mainWidget(), 'font', 'size="+1"')
def insertBR(): self = qApp.mainWidget() line, index = self.sourceEditor.getCursorPosition() self.sourceEditor.insertAt("<BR>\n", line, index) self.sourceEditor.setCursorPosition(line+1, 0)
def alignCenter(): surroundWith(qApp.mainWidget(), 'div', 'align="center"')
def alignLeft(): surroundWith(qApp.mainWidget(), 'div', 'align="left"')
def makeUnderscore(): surroundWith(qApp.mainWidget(), 'u')
def makeItalic(): surroundWith(qApp.mainWidget(), 'i')
def makeBold(): surroundWith(qApp.mainWidget(), 'b')
def makePara(): surroundWith(qApp.mainWidget(), 'p')