def createLayerToolbar(self):
    """
    TOWRITE
    """
    toolbarLayer = self.toolbarLayer
    actionHash = self.actionHash
    layerSelector = self.layerSelector
    qDebug("MainWindow createLayerToolbar()")

    toolbarLayer.setObjectName("toolbarLayer")
    toolbarLayer.addAction(actionHash["ACTION_makelayercurrent"])
    toolbarLayer.addAction(actionHash["ACTION_layers"])

    icontheme = self.getSettingsGeneralIconTheme()  # QString

    layerSelector.setFocusProxy(self.prompt)
    # NOTE: Qt4.7 wont load icons without an extension...
    # TODO: Create layer pixmaps by concatenating several icons
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "0")
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "1")
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "2")
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "3")
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "4")
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "5")
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "6")
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "7")
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "8")
    layerSelector.addItem(QIcon("icons/" + icontheme + "/" + "linetypebylayer" + ".png"), "9")
    toolbarLayer.addWidget(layerSelector)
    self.connect(layerSelector, SIGNAL("currentIndexChanged(int)"), self, SLOT("layerSelectorIndexChanged(int)"))

    toolbarLayer.addAction(actionHash["ACTION_layerprevious"])

    self.connect(toolbarLayer, SIGNAL("topLevelChanged(bool)"), self, SLOT("floatingChangedToolBar(bool)"))
Beispiel #2
0
 def vulcanize(self):
     """
     TOWRITE
     """
     qDebug("TextSingleObject vulcanize()")
     self.updateRubber()
     self.setObjectRubberMode(OBJ_RUBBER_OFF)
Beispiel #3
0
    def __init__(self, parent=None):
        """
        Default class constructor.

        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QGraphicsItem`_
        """
        super(BaseObject, self).__init__(parent)

        qDebug("BaseObject Constructor()")

        self.objPen = QPen()        # QPen objPen;
        self.lwtPen = QPen()        # QPen lwtPen;
        self.objLine = QLineF()     # QLineF objLine;
        self.objRubberMode = int()  # int objRubberMode;
        self.objRubberPoints = {}   # QHash<QString, QPointF> objRubberPoints;
        self.objRubberTexts = {}    # QHash<QString, QString> objRubberTexts;
        self.objID = int()          # qint64 objID;

        self.objPen.setCapStyle(Qt.RoundCap)
        self.objPen.setJoinStyle(Qt.RoundJoin)
        self.lwtPen.setCapStyle(Qt.RoundCap)
        self.lwtPen.setJoinStyle(Qt.RoundJoin)

        self.objID = QDateTime.currentMSecsSinceEpoch()
Beispiel #4
0
 def enableLwt(self):
     """"""
     qDebug("StatusBarButton enableLwt()")
     gview = self.mainWin.activeView()
     if gview:
         if not gview.isLwtEnabled():
             gview.toggleLwt(True)
    def __init__(self, parent, caption, dir, filter):
        """
        Default class constructor.

        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        :param `caption`: The dialog caption.
        :type `caption`: QString
        :param `dir`: The dialog directory.
        :type `dir`: QString
        :param `filter`: The dialog filter.
        :type `filter`: QString
        """
        super(PreviewDialog, self).__init__(parent, caption, dir, filter)

        qDebug("PreviewDialog Constructor")

        # TODO: get actual thumbnail image from file, lets also use a size of 128x128 for now...
        # TODO: make thumbnail size adjustable thru settings dialog
        # TODO/PORT: Need access to gIconDir
        imgWidget = ImageWidget("icons/default/nopreview.png", self)

        #TODO/PORT# QLayout* lay = layout()
        #TODO/PORT# if(qobject_cast<QGridLayout*>(lay))
        #TODO/PORT#     QGridLayout* grid = qobject_cast<QGridLayout*>(lay);
        #TODO/PORT#     grid->addWidget(imgWidget, 0, grid->columnCount(), grid->rowCount(), 1)

        self.setModal(True)
        self.setOption(QFileDialog.DontUseNativeDialog)
        self.setViewMode(QFileDialog.Detail)
        self.setFileMode(QFileDialog.ExistingFiles)
Beispiel #6
0
 def disableLwt(self):
     """"""
     qDebug("StatusBarButton disableLwt()")
     gview = self.mainWin.activeView()
     if gview:
         if gview.isLwtEnabled():
             gview.toggleLwt(False)
Beispiel #7
0
    def promptInputPrevNext(self, prev):
        """
        TOWRITE

        :param `prev`: TOWRITE
        :type `prev`: bool
        """
        if self.promptInputList:  # if(promptInputList.isEmpty())
            if prev:
                QMessageBox.critical(self, self.tr("Prompt Previous Error"), self.tr("The prompt input is empty! Please report this as a bug!"))
            else:
                QMessageBox.critical(self, self.tr("Prompt Next Error"), self.tr("The prompt input is empty! Please report this as a bug!"))
            qDebug("The prompt input is empty! Please report this as a bug!")

        else:
            if prev:
                self.promptInputNum -= 1  # promptInputNum--;
            else:
                self.promptInputNum += 1  # promptInputNum++;
            maxNum = len(self.promptInputList)  # int maxNum = promptInputList.size();
            if self.promptInputNum < 0:
                self.promptInputNum = 0
                self.mainWin.prompt.setCurrentText("")
            elif self.promptInputNum >= maxNum:
                self.promptInputNum = maxNum
                self.mainWin.prompt.setCurrentText("")
            else:
                self.mainWin.prompt.setCurrentText(self.promptInputList[self.promptInputNum])
Beispiel #8
0
    def __init__(self, parent=None):
        """Default class constructor."""
        super(CmdPromptInput, self).__init__(parent)

        qDebug("CmdPromptInput Constructor")
        self.setObjectName("Command Prompt Input")

        self.defaultPrefix = self.tr("Command: ")
        self.prefix = self.defaultPrefix
        self.curText = self.prefix

        self.lastCmd = "help"
        self.curCmd = "help"
        self.cmdActive = False

        self.rapidFireEnabled = False

        self.isBlinking = False

        self.setText(self.prefix)
        self.setFrame(False)
        self.setMaxLength(266)
        self.setMaximumSize(5000, 25)
        self.setDragEnabled(False)

        # self.cursorPositionChanged.connect(self.checkCursorPosition) # (int, int)
        # self.textEdited.connect(self.checkEditedText) # (str)
        # self.textChanged.connect(self.checkChangedText)
        # self.selectionChanged.connect(self.checkSelection)

        #TODO# self.aliasHash = new QHash<QString, QString>

        # self.installEventFilter(self)
        self.setFocus(Qt.OtherFocusReason)
    def __init__(self, startX, startY, midX, midY, endX, endY, rgb, parent):
        #OVERLOADED IMPL?# ArcObject::ArcObject(ArcObject* obj, QGraphicsItem* parent) : BaseObject(parent)
        """
        Default class constructor.

        :param `startX`: TOWRITE
        :type `startX`: qreal
        :param `startY`: TOWRITE
        :type `startY`: qreal
        :param `midX`: TOWRITE
        :type `midX`: qreal
        :param `midY`: TOWRITE
        :type `midY`: qreal
        :param `endX`: TOWRITE
        :type `endX`: qreal
        :param `endY`: TOWRITE
        :type `endY`: qreal
        :param `rgb`: TOWRITE
        :type `rgb`: QRgb
        :param `parent`: TOWRITE
        :type `parent`: `QGraphicsItem`_
        """
        super(ArcObject, self).__init__(parent)

        qDebug("ArcObject Constructor()")
        self.init(startX, startY, midX, midY, endX, endY, rgb, Qt.SolidLine)  # TODO: getCurrentLineType
 def enableLwt(self):
     """"""
     qDebug("StatusBarButton enableLwt()")
     gview = self.mainWin.activeView()
     if gview:
         if not gview.isLwtEnabled():
             gview.toggleLwt(True)
Beispiel #11
0
 def checkSelection(self):
     """
     Handle the `selectionChanged` SIGNAL for :class:`CmdPromptInput`.
     """
     qDebug("CmdPromptInput::checkSelection")
     if self.hasSelectedText():
         self.deselect()
Beispiel #12
0
    def __init__(self, x1, y1, x2, y2, rgb, parent=None):
        #OVERLOADED IMPL?# DimLeaderObject::DimLeaderObject(DimLeaderObject* obj, QGraphicsItem* parent) : BaseObject(parent)
        """
        Default class constructor.

        :param `x1`: TOWRITE
        :type `x1`: qreal
        :param `y1`: TOWRITE
        :type `y1`: qreal
        :param `x2`: TOWRITE
        :type `x2`: qreal
        :param `y2`: TOWRITE
        :type `y2`: qreal
        :param `rgb`: TOWRITE
        :type `rgb`: QRgb
        :param `parent`: TOWRITE
        :type `parent`: `QGraphicsItem`_
        """
        super(DimLeaderObject, self).__init__(parent)

        qDebug("DimLeaderObject Constructor()")

        self.curved = bool()
        self.filled = bool()
        self.lineStylePath = QPainterPath()
        self.arrowStylePath = QPainterPath()
        self.arrowStyleAngle = float()  # qreal
        self.arrowStyleLength = float()  # qreal
        self.lineStyleAngle = float()  # qreal
        self.lineStyleLength = float()  # qreal

        self.init(x1, y1, x2, y2, rgb,
                  Qt.SolidLine)  # TODO: getCurrentLineType
Beispiel #13
0
 def vulcanize(self):
     """
     TOWRITE
     """
     qDebug("DimLeaderObject vulcanize()")
     self.updateRubber()
     self.setObjectRubberMode(OBJ_RUBBER_OFF)
    def __init__(self, parent, caption, dir, filter):
        """
        Default class constructor.

        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        :param `caption`: The dialog caption.
        :type `caption`: QString
        :param `dir`: The dialog directory.
        :type `dir`: QString
        :param `filter`: The dialog filter.
        :type `filter`: QString
        """
        super(PreviewDialog, self).__init__(parent, caption, dir, filter)

        qDebug("PreviewDialog Constructor")

        # TODO: get actual thumbnail image from file, lets also use a size of 128x128 for now...
        # TODO: make thumbnail size adjustable thru settings dialog
        # TODO/PORT: Need access to gIconDir
        imgWidget = ImageWidget("icons/default/nopreview.png", self)

        #TODO/PORT# QLayout* lay = layout()
        #TODO/PORT# if(qobject_cast<QGridLayout*>(lay))
        #TODO/PORT#     QGridLayout* grid = qobject_cast<QGridLayout*>(lay);
        #TODO/PORT#     grid->addWidget(imgWidget, 0, grid->columnCount(), grid->rowCount(), 1)

        self.setModal(True)
        self.setOption(QFileDialog.DontUseNativeDialog)
        self.setViewMode(QFileDialog.Detail)
        self.setFileMode(QFileDialog.ExistingFiles)
    def __init__(self, x1, y1, x2, y2, rgb, parent=None):
        #OVERLOADED IMPL?# DimLeaderObject::DimLeaderObject(DimLeaderObject* obj, QGraphicsItem* parent) : BaseObject(parent)
        """
        Default class constructor.

        :param `x1`: TOWRITE
        :type `x1`: qreal
        :param `y1`: TOWRITE
        :type `y1`: qreal
        :param `x2`: TOWRITE
        :type `x2`: qreal
        :param `y2`: TOWRITE
        :type `y2`: qreal
        :param `rgb`: TOWRITE
        :type `rgb`: QRgb
        :param `parent`: TOWRITE
        :type `parent`: `QGraphicsItem`_
        """
        super(DimLeaderObject, self).__init__(parent)

        qDebug("DimLeaderObject Constructor()")

        self.curved = bool()
        self.filled = bool()
        self.lineStylePath = QPainterPath()
        self.arrowStylePath = QPainterPath()
        self.arrowStyleAngle = float()   # qreal
        self.arrowStyleLength = float()  # qreal
        self.lineStyleAngle = float()    # qreal
        self.lineStyleLength = float()   # qreal

        self.init(x1, y1, x2, y2, rgb, Qt.SolidLine)  # TODO: getCurrentLineType
Beispiel #16
0
    def __init__(self, parent=None):
        """Default class constructor."""
        super(CmdPromptInput, self).__init__(parent)

        qDebug("CmdPromptInput Constructor")
        self.setObjectName("Command Prompt Input")

        self.defaultPrefix = self.tr("Command: ")
        self.prefix = self.defaultPrefix
        self.curText = self.prefix

        self.lastCmd = "help"
        self.curCmd = "help"
        self.cmdActive = False

        self.rapidFireEnabled = False

        self.isBlinking = False

        self.setText(self.prefix)
        self.setFrame(False)
        self.setMaxLength(266)
        self.setMaximumSize(5000, 25)
        self.setDragEnabled(False)

        # self.cursorPositionChanged.connect(self.checkCursorPosition) # (int, int)
        # self.textEdited.connect(self.checkEditedText) # (str)
        # self.textChanged.connect(self.checkChangedText)
        # self.selectionChanged.connect(self.checkSelection)

        #TODO# self.aliasHash = new QHash<QString, QString>

        # self.installEventFilter(self)
        self.setFocus(Qt.OtherFocusReason)
Beispiel #17
0
    def __init__(self, strng, x, y, rgb, parent=None):
        #OVERLOADED IMPL?# TextSingleObject::TextSingleObject(TextSingleObject* obj, QGraphicsItem* parent) : BaseObject(parent)
        """
        Default class constructor.

        :param `strng`: TOWRITE
        :type `strng`: QString
        :param `x`: TOWRITE
        :type `x`: qreal
        :param `y`: TOWRITE
        :type `y`: qreal
        :param `rgb`: TOWRITE
        :type `rgb`: QRgb
        :param `parent`: TOWRITE
        :type `parent`: `QGraphicsItem`_
        """
        super(TextSingleObject, self).__init__(parent)

        qDebug("TextSingleObject Constructor()")

        self.objText = str()
        self.objTextFont = str()
        self.objTextJustify = str()
        self.objTextSize = float()  # qreal
        self.objTextBold = bool()
        self.objTextItalic = bool()
        self.objTextUnderline = bool()
        self.objTextStrikeOut = bool()
        self.objTextOverline = bool()
        self.objTextBackward = bool()
        self.objTextUpsideDown = bool()
        self.objTextPath = QPainterPath()

        self.init(str, x, y, rgb, Qt.SolidLine)  # TODO: getCurrentLineType
 def disableLwt(self):
     """"""
     qDebug("StatusBarButton disableLwt()")
     gview = self.mainWin.activeView()
     if gview:
         if gview.isLwtEnabled():
             gview.toggleLwt(False)
Beispiel #19
0
 def checkSelection(self):
     """
     Handle the `selectionChanged` SIGNAL for :class:`CmdPromptInput`.
     """
     qDebug("CmdPromptInput::checkSelection")
     if self.hasSelectedText():
         self.deselect()
    def __init__(self, strng, x, y, rgb, parent=None):
        #OVERLOADED IMPL?# TextSingleObject::TextSingleObject(TextSingleObject* obj, QGraphicsItem* parent) : BaseObject(parent)
        """
        Default class constructor.

        :param `strng`: TOWRITE
        :type `strng`: QString
        :param `x`: TOWRITE
        :type `x`: qreal
        :param `y`: TOWRITE
        :type `y`: qreal
        :param `rgb`: TOWRITE
        :type `rgb`: QRgb
        :param `parent`: TOWRITE
        :type `parent`: `QGraphicsItem`_
        """
        super(TextSingleObject, self).__init__(parent)

        qDebug("TextSingleObject Constructor()")

        self.objText = str()
        self.objTextFont = str()
        self.objTextJustify = str()
        self.objTextSize = float() # qreal
        self.objTextBold = bool()
        self.objTextItalic = bool()
        self.objTextUnderline = bool()
        self.objTextStrikeOut = bool()
        self.objTextOverline = bool()
        self.objTextBackward = bool()
        self.objTextUpsideDown = bool()
        self.objTextPath = QPainterPath()

        self.init(str, x, y, rgb, Qt.SolidLine)  # TODO: getCurrentLineType
 def vulcanize(self):
     """
     TOWRITE
     """
     qDebug("EllipseObject vulcanize()")
     self.updateRubber()
     self.setObjectRubberMode(OBJ_RUBBER_OFF)
def createFileMenu(self):  # void MainWindow::createFileMenu()
    """
    TOWRITE
    """
    actionHash = self.actionHash
    qDebug("MainWindow createFileMenu()")
    self.menuBar().addMenu(self.fileMenu)
    self.fileMenu.addAction(actionHash["ACTION_new"])
    self.fileMenu.addSeparator()
    self.fileMenu.addAction(actionHash["ACTION_open"])

    self.fileMenu.addMenu(self.recentMenu)
    self.connect(self.recentMenu, SIGNAL("aboutToShow()"), self, SLOT("recentMenuAboutToShow()"))
    # Do not allow the Recent Menu to be torn off. It's a pain in the ass to maintain.
    self.recentMenu.setTearOffEnabled(False)

    self.fileMenu.addSeparator()
    self.fileMenu.addAction(actionHash["ACTION_save"])
    self.fileMenu.addAction(actionHash["ACTION_saveas"])
    self.fileMenu.addSeparator()
    self.fileMenu.addAction(actionHash["ACTION_print"])
    self.fileMenu.addSeparator()
    self.fileMenu.addAction(actionHash["ACTION_windowclose"])
    self.fileMenu.addSeparator()
    self.fileMenu.addAction(actionHash["ACTION_designdetails"])
    self.fileMenu.addSeparator()

    self.fileMenu.addAction(actionHash["ACTION_exit"])
    self.fileMenu.setTearOffEnabled(False)
Beispiel #23
0
    def __init__(self, parent=None):
        """
        Default class constructor.

        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        """
        super(CmdPromptInput, self).__init__(parent)

        qDebug("CmdPromptInput Constructor")
        self.setObjectName("Command Prompt Input")

        self.defaultPrefix = self.tr("Command: ")
        self.prefix = self.defaultPrefix
        self.curText = self.prefix

        self.lastCmd = "help"
        self.curCmd = "help"
        self.cmdActive = False

        self.rapidFireEnabled = False

        self.isBlinking = False

        self.setText(self.prefix)
        self.setFrame(False)
        self.setMaxLength(266)
        self.setMaximumSize(5000, 25)
        self.setDragEnabled(False)

        self.connect(self, SIGNAL("cursorPositionChanged(int, int)"), self, SLOT("checkCursorPosition(int, int)"))
        self.connect(self, SIGNAL("textEdited(QString)"), self, SLOT("checkEditedText(QString)"))
        self.connect(self, SIGNAL("textChanged(QString)"), self, SLOT("checkChangedText(QString)"))
        self.connect(self, SIGNAL("selectionChanged()"), self, SLOT("checkSelection()"))

        self.aliasHash = {}  # new QHash<QString, QString>

        self.installEventFilter(self)
        self.setFocus(Qt.OtherFocusReason)

        self.applyFormatting()

        # self.setCompleter(EmbroiderCommanderAutoCompleter(self))

        #### self.completer = QCompleter(['LINE', 'HEART', 'DOLPHIN', 'CIRCLE', 'STAR', 'six', 'seven', 'eight', 'nine', 'ten'], self)
        #### self.completer.setCompletionMode(QCompleter.PopupCompletion)
        #### self.completer.setCaseSensitivity(Qt.CaseInsensitive)
        #### self.setCompleter(self.completer)

        self.curText          = str()   # QString curText;
        self.defaultPrefix    = str()   # QString defaultPrefix;
        self.prefix           = str()   # QString prefix;

        self.lastCmd          = str()   # QString lastCmd;
        self.curCmd           = str()   # QString curCmd;
        self.cmdActive        = str()   # bool cmdActive;

        self.rapidFireEnabled = bool()  # bool rapidFireEnabled;
        self.isBlinking       = bool()  # bool isBlinking;
Beispiel #24
0
    def moveEvent(self, event):
        """
        Handles the ``moveEvent`` event for :class:`MDIArea`.

        :param `event`: A `QMoveEvent`_ to be processed.
        """
        # Dragging while MouseButton is down.
        qDebug("QMdiArea moveEvent")
Beispiel #25
0
    def sizeHint(self):
        """
        TOWRITE

        :rtype: QSize
        """
        qDebug("MdiWindow sizeHint()")
        return QSize(450, 300)
Beispiel #26
0
 def loadQml(self, path, id):
     self._rootId = id
     # if path[1] == ':':
     #     path = path[2:].replace('\\', '/')
     qDebug('setSource {}: {}'.format(id, path))
     self._view.setSource(path)
     self._view.showFullScreen()
     qDebug('source set')
Beispiel #27
0
    def closeEvent(self, QCloseEvent):
        """
        Handles the ``closeEvent`` for :class:`MdiWindow`.

        :param `event`: A `QCloseEvent`_ to be processed.
        """
        qDebug("MdiWindow closeEvent()")
        self.sendCloseMdiWin.emit(self)
Beispiel #28
0
    def moveEvent(self, event):
        """
        Handles the ``moveEvent`` event for :class:`MDIArea`.

        :param `event`: A `QMoveEvent`_ to be processed.
        """
        # Dragging while MouseButton is down.
        qDebug("QMdiArea moveEvent")
Beispiel #29
0
 def blink(self):
     """
     TOWRITE
     """
     self.blinkState = not self.blinkState
     if self.blinkState:
         qDebug("CmdPrompt blink1")
     else:
         qDebug("CmdPrompt blink0")
def createWindowMenu(self):  #void MainWindow::createWindowMenu()
    """
    TOWRITE
    """
    qDebug("MainWindow createWindowMenu()")
    self.menuBar().addMenu(self.windowMenu)
    self.connect(self.windowMenu, SIGNAL("aboutToShow()"), self, SLOT("windowMenuAboutToShow()"))
    # Do not allow the Window Menu to be torn off. It's a pain in the ass to maintain.
    self.windowMenu.setTearOffEnabled(False)
Beispiel #31
0
    def make_dialog(self, settings):
        if self.dlg:
            self.cancel_dialog()

        dtype = settings.pop('dtype')
        qDebug('dialog of type {}'.format(dtype))
        if 'buttons' not in settings:
            settings['buttons'] = [{Dialog.BUTTON_LABEL: Dialog.LABEL_OK}]
        self.dlg = Dialog(self.get_dialog_id(), dtype, **settings)
Beispiel #32
0
 def blink(self):
     """
     TOWRITE
     """
     self.blinkState = not self.blinkState
     if self.blinkState:
         qDebug("CmdPrompt blink1")
     else:
         qDebug("CmdPrompt blink0")
def createSettingsMenu(self):  # void MainWindow::createSettingsMenu()
    """
    TOWRITE
    """
    actionHash = self.actionHash
    qDebug("MainWindow createSettingsMenu()")
    self.menuBar().addMenu(self.settingsMenu)
    self.settingsMenu.addAction(actionHash["ACTION_settingsdialog"])
    self.settingsMenu.addSeparator()
    self.settingsMenu.setTearOffEnabled(True)
Beispiel #34
0
    def __init__(self, parent=None):
        """Default class constructor."""
        super(CmdPromptHandle, self).__init__(parent)

        qDebug("CmdPromptHandle Constructor")
        self.setObjectName("Command Prompt Handle")

        self.handlePressed.connect(parent.pressResizeHistory)  # (int)
        self.handleReleased.connect(parent.releaseResizeHistory)  # (int)
        self.handleMoved.connect(parent.moveResizeHistory)  # (int)
Beispiel #35
0
    def __init__(self, parent=None):
        """Default class constructor."""
        super(CmdPromptHandle, self).__init__(parent)

        qDebug("CmdPromptHandle Constructor")
        self.setObjectName("Command Prompt Handle")

        self.handlePressed.connect(parent.pressResizeHistory) # (int)
        self.handleReleased.connect(parent.releaseResizeHistory) # (int)
        self.handleMoved.connect(parent.moveResizeHistory) # (int)
Beispiel #36
0
    def __init__(self, parent=None):
        """Default class constructor."""
        super(CmdPromptSplitter, self).__init__(parent)

        qDebug("CmdPromptSplitter Constructor")
        self.setObjectName("Command Prompt Splitter")

        self.setOrientation(Qt.Vertical)
        # NOTE: Add two empty widgets just so we have a handle to grab
        self.addWidget(QWidget(self))
        self.addWidget(QWidget(self))
Beispiel #37
0
    def addCommand(self, alias, cmd):
        """
        TOWRITE

        :param `alias`: TOWRITE
        :type `alias`: QString
        :param `cmd`: TOWRITE
        :type `cmd`: QString
        """
        aliasHash.insert(alias.toLower(), cmd.toLower())
        qDebug("Command Added: %s, %s" % (qPrintable(alias), qPrintable(cmd)))
Beispiel #38
0
    def toggleLwt(self, on):
        """
        TOWRITE

        :param `on`: TOWRITE
        :type `on`: bool
        """
        qDebug("StatusBarButton toggleLwt()")
        gview = self.mainWin.activeView()
        if gview:
            gview.toggleLwt(on)
Beispiel #39
0
    def __init__(self, parent=None):
        """Default class constructor."""
        super(CmdPromptSplitter, self).__init__(parent)

        qDebug("CmdPromptSplitter Constructor")
        self.setObjectName("Command Prompt Splitter")

        self.setOrientation(Qt.Vertical)
        # NOTE: Add two empty widgets just so we have a handle to grab
        self.addWidget(QWidget(self))
        self.addWidget(QWidget(self))
Beispiel #40
0
    def addCommand(self, alias, cmd):
        """
        TOWRITE

        :param `alias`: TOWRITE
        :type `alias`: QString
        :param `cmd`: TOWRITE
        :type `cmd`: QString
        """
        aliasHash.insert(alias.toLower(), cmd.toLower())
        qDebug("Command Added: %s, %s" % (qPrintable(alias), qPrintable(cmd)))
    def toggleLwt(self, on):
        """
        TOWRITE

        :param `on`: TOWRITE
        :type `on`: bool
        """
        qDebug("StatusBarButton toggleLwt()")
        gview = self.mainWin.activeView()
        if gview:
            gview.toggleLwt(on)
Beispiel #42
0
    def addCommand(self, alias, cmd):
        """
        TOWRITE

        :param `alias`: TOWRITE
        :type `alias`: QString
        :param `cmd`: TOWRITE
        :type `cmd`: QString
        """
        self.aliasHash[alias.lower()] = cmd.lower()
        qDebug("Command Added: %s, %s" % (str(alias), str(cmd)))
    def vulcanize(self):
        """
        TOWRITE
        """
        qDebug("PolylineObject vulcanize()")
        self.updateRubber()

        self.setObjectRubberMode(OBJ_RUBBER_OFF)

        if not self.normalPath.elementCount():
            QMessageBox.critical(0, QObject.tr("Empty Polyline Error"), QObject.tr("The polyline added contains no points. The command that created this object has flawed logic."))
def createAllMenus(self):  # void MainWindow::createAllMenus()
    """
    TOWRITE
    """
    qDebug("MainWindow createAllMenus()")
    self.createFileMenu()
    self.createEditMenu()
    self.createViewMenu()
    self.createSettingsMenu()
    self.createWindowMenu()
    self.createHelpMenu()
def createPromptToolbar(self):
    """
    TOWRITE
    """
    toolbarPrompt = self.toolbarPrompt
    prompt = self.prompt
    qDebug("MainWindow createPromptToolbar()")

    toolbarPrompt.setObjectName("toolbarPrompt")
    toolbarPrompt.addWidget(prompt)
    toolbarPrompt.setAllowedAreas(Qt.TopToolBarArea | Qt.BottomToolBarArea)
    self.connect(toolbarPrompt, SIGNAL("topLevelChanged(bool)"), prompt, SLOT("floatingChanged(bool)"))
    def __init__(self, parent=None):
        """
        Default class constructor.

        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        """
        super(CmdPrompt, self).__init__(parent)

        qDebug("CmdPrompt Constructor")
        self.setObjectName("Command Prompt")

        self.promptInput = promptInput = CmdPromptInput(self)
        self.promptHistory = CmdPromptHistory()
        self.promptDivider = QFrame(self)
        promptVBoxLayout = QVBoxLayout(self)

        self.promptSplitter = CmdPromptSplitter(self)

        self.setFocusProxy(promptInput)
        self.promptHistory.setFocusProxy(promptInput)

        self.promptDivider.setLineWidth(1)
        self.promptDivider.setFrameStyle(QFrame.HLine)
        QWIDGETSIZE_MAX = 1  # TODO/FIXME. What is QWIDGETSIZE_MAX???
        self.promptDivider.setMaximumSize(QWIDGETSIZE_MAX, 1)

        promptVBoxLayout.addWidget(self.promptSplitter)
        promptVBoxLayout.addWidget(self.promptHistory)
        promptVBoxLayout.addWidget(self.promptDivider)
        promptVBoxLayout.addWidget(promptInput)

        promptVBoxLayout.setSpacing(0)
        promptVBoxLayout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(promptVBoxLayout)

        #TODO# self.styleHash = QHash<QString, QString>()
        #TODO# self.styleHash.insert("color",                      "#000000") # Match -------|
        #TODO# self.styleHash.insert("background-color",           "#FFFFFF") #              |
        #TODO# self.styleHash.insert("selection-color",            "#FFFFFF") #              |
        #TODO# self.styleHash.insert("selection-background-color", "#000000") # Match -------|
        #TODO# self.styleHash.insert("font-family",              "Monospace")
        #TODO# self.styleHash.insert("font-style",                  "normal")
        #TODO# self.styleHash.insert("font-size",                     "12px")

        # self.updateStyle()

        self.blinkState = False
        self.blinkTimer = QTimer(self)
        self.blinkTimer.timeout.connect(self.blink)

        self.show()
Beispiel #47
0
    def floatingChanged(self, isFloating):  #TODO
        """
        TOWRITE

        :param `isFloating`: TOWRITE
        :type `isFloating`: bool
        """
        qDebug("CmdPrompt floatingChanged(%d)", isFloating)
        if isFloating:
            self.promptSplitter.hide()
        else:
            self.promptSplitter.show()
Beispiel #48
0
    def endCommand(self):
        """
        TOWRITE
        """
        qDebug("CmdPromptInput endCommand")
        self.lastCmd = self.curCmd
        self.cmdActive = False
        self.rapidFireEnabled = False
        #TODO# emit stopBlinking()

        self.prefix = self.defaultPrefix
        self.clear()
Beispiel #49
0
    def endCommand(self):
        """
        TOWRITE
        """
        qDebug("CmdPromptInput endCommand")
        self.lastCmd = self.curCmd
        self.cmdActive = False
        self.rapidFireEnabled = False
        #TODO# emit stopBlinking()

        self.prefix = self.defaultPrefix
        self.clear()
def createViewToolbar(self):
    """
    TOWRITE
    """
    toolbarView = self.toolbarView
    actionHash = self.actionHash
    qDebug("MainWindow createViewToolbar()")

    toolbarView.setObjectName("toolbarView")
    toolbarView.addAction(actionHash["ACTION_day"])
    toolbarView.addAction(actionHash["ACTION_night"])

    self.connect(toolbarView, SIGNAL("topLevelChanged(bool)"), self, SLOT("floatingChangedToolBar(bool)"))
Beispiel #51
0
    def appendHistory(self, txt):  # TODO
        """
        TOWRITE

        :param `txt`: TOWRITE
        :type `txt`: QString
        """
        if (txt.isNull()):  #TODO#

            #TODO# emit appendTheHistory(self.promptInput.curText, self.promptInput.prefix.length())
            return

        qDebug("CmdPrompt - appendHistory()")
Beispiel #52
0
    def processInput(self, rapidChar=''):
        """
        TOWRITE

        :param `rapidChar`: TOWRITE
        :type `rapidChar`: QChar
        """
        qDebug("CmdPromptInput::processInput")

        self.updateCurrentText(self.curText)

        cmdtxt = self.curText  # QString
        cmdtxt = cmdtxt[len(self.prefix):]
        if not self.rapidFireEnabled:
            cmdtxt = cmdtxt.lower()

        if self.cmdActive:
            if self.rapidFireEnabled:
                if rapidChar == Qt.Key_Enter or rapidChar == Qt.Key_Return:
                    self.appendHistory.emit(self.curText, len(self.prefix))
                    self.runCommand.emit(self.curCmd, "RAPID_ENTER")
                    self.curText = ""  # .clear()
                    self.clear()
                    return
                elif rapidChar == Qt.Key_Space:
                    self.updateCurrentText(self.curText + " ")
                    self.runCommand.emit(self.curCmd, cmdtxt + " ")
                    return
                else:
                    self.runCommand.emit(self.curCmd, cmdtxt)
                    return
            else:
                self.appendHistory.emit(self.curText, len(self.prefix))
                self.runCommand.emit(self.curCmd, cmdtxt)
        else:
            if cmdtxt in self.aliasHash:
                self.cmdActive = True
                self.lastCmd = self.curCmd
                self.curCmd = self.aliasHash[cmdtxt]
                self.appendHistory.emit(self.curText, len(self.prefix))
                self.startCommand.emit(self.curCmd)
            elif not cmdtxt:
                self.cmdActive = True
                self.appendHistory.emit(self.curText, len(self.prefix))
                # Rerun the last successful command
                self.startCommand.emit(self.lastCmd)
            else:
                self.appendHistory.emit(self.curText + "<br/><font color=\"red\">Unknown command \"" + cmdtxt + "\". Press F1 for help.</font>", len(self.prefix))

        if not self.rapidFireEnabled:
            self.clear()
Beispiel #53
0
    def appendHistory(self, txt):
        """
        TOWRITE

        :param `txt`: TOWRITE
        :type `txt`: QString
        """
        if not txt:

            self.appendTheHistory.emit(self.promptInput.curText, len(self.promptInput.prefix))
            return

        qDebug("CmdPrompt - appendHistory()")
        self.appendTheHistory(txt, len(self.promptInput.prefix))
def createEditToolbar(self):
    """
    TOWRITE
    """
    toolbarEdit = self.toolbarEdit
    actionHash = self.actionHash
    qDebug("MainWindow createEditToolbar()")

    toolbarEdit.setObjectName("toolbarEdit")
    toolbarEdit.addAction(actionHash["ACTION_cut"])
    toolbarEdit.addAction(actionHash["ACTION_copy"])
    toolbarEdit.addAction(actionHash["ACTION_paste"])

    self.connect(toolbarEdit, SIGNAL("topLevelChanged(bool)"), self, SLOT("floatingChangedToolBar(bool)"))
    def __init__(self, theScene, parent=None):
        """
        Default class constructor.

        :param `theScene`: TOWRITE
        :type `theScene`: `QGraphicsScene`_
        :param `parent`: TOWRITE
        :type `parent`: `QObject`_
        """
        super(SaveObject, self).__init__(parent)

        qDebug("SaveObject Constructor()")
        self.gscene = theScene
        self.formatType = EMBFORMAT_UNSUPPORTED