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()
Example #2
0
    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()
Example #3
0
    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()
Example #5
0
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)
Example #6
0
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))
Example #7
0
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))
Example #8
0
def alignRight():
    surroundWith(qApp.mainWidget(), 'div', 'align="right"')
Example #9
0
def decFont():
    surroundWith(qApp.mainWidget(), 'font', 'size="-1"')
Example #10
0
def incFont():
    surroundWith(qApp.mainWidget(), 'font', 'size="+1"')
Example #11
0
def insertBR():
    self = qApp.mainWidget()
    line, index = self.sourceEditor.getCursorPosition()
    self.sourceEditor.insertAt("<BR>\n", line, index)
    self.sourceEditor.setCursorPosition(line+1, 0)
Example #12
0
def alignCenter():
    surroundWith(qApp.mainWidget(), 'div', 'align="center"')
Example #13
0
def alignLeft():
    surroundWith(qApp.mainWidget(), 'div', 'align="left"')
Example #14
0
def makeUnderscore():
    surroundWith(qApp.mainWidget(), 'u')
Example #15
0
def makeItalic():
    surroundWith(qApp.mainWidget(), 'i')
Example #16
0
def makeBold():
    surroundWith(qApp.mainWidget(), 'b')
Example #17
0
def makePara():
    surroundWith(qApp.mainWidget(), 'p')