Ejemplo n.º 1
0
    def __init__(self, context):
        super(NodeManager, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('NodeManagerFKIE')

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-q", "--quiet", action="store_true",
                      dest="quiet",
                      help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns
        node_manager_fkie.init_settings()
        masteruri = node_manager_fkie.settings().masteruri()
        node_manager_fkie.init_globals(masteruri)
        # Create QWidget
        try:
          self._widget = MainWindow()
#          self._widget.read_view_history()
        except Exception, e:
          msgBox = QMessageBox()
          msgBox.setText(str(e))
          msgBox.exec_()
          raise
 def _showWarning(self, title, body):
     if threading.current_thread().name != "MainThread":
         rospy.logwarn("{}: {}".format(title, body))
     else:
         msg = QMessageBox()
         msg.setIcon(QMessageBox.Warning)
         msg.setWindowTitle(title)
         msg.setText(body)
         msg.setStandardButtons(QMessageBox.Ok)
         msg.exec_()
 def _showWarning(self, title, body):
     if threading.current_thread().name != "MainThread":
         rospy.logwarn("{}: {}".format(title, body))
     else:
         msg = QMessageBox()
         msg.setIcon(QMessageBox.Warning)
         msg.setWindowTitle(title)
         msg.setText(body)
         msg.setStandardButtons(QMessageBox.Ok)
         msg.exec_()
Ejemplo n.º 4
0
class DialogService(QWidget):
    '''
    Provides popup windows for information and error messages 
    '''

    #----------------------------------
    # Initializer
    #--------------

    def __init__(self, parent=None):
        super(DialogService, self).__init__(parent);
        
        # All-purpose error popup message:
        # Used by self.showErrorMsgByErrorCode(<errorCode>), 
        # or self.showErrorMsg(<string>). Returns a
        # QErrorMessage without parent, but with QWindowFlags set
	    # properly to be a dialog popup box:
        self.errorMsgPopup = QErrorMessage.qtHandler();
       	# Re-parent the popup, retaining the window flags set
        # by the qtHandler:
        self.errorMsgPopup.setParent(parent, self.errorMsgPopup.windowFlags());
        #self.errorMsgPopup.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        self.infoMsg = QMessageBox(parent=parent);
        #self.infoMsg.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
    
    #----------------------------------
    # showErrorMsg
    #--------------
    QErrorMessage
    def showErrorMsg(self,errMsg):
        '''
        Given a string, pop up an error dialog on top of the application window.
        @param errMsg: The message
        @type errMsg: string
        '''
        self.errorMsgPopup.showMessage(errMsg);
    
    #----------------------------------
    # showInfoMsg 
    #--------------

    def showInfoMsg(self, text):
        '''
        Display a message window with an OK button on top of the application window.
        @param text: text to display
        @type text: string
        '''
        self.infoMsg.setText(text);
        self.infoMsg.exec_();        
Ejemplo n.º 5
0
def dasherr(msg, obj, title='Error'):
    """
    Logs a message with ``rospy.logerr`` and displays a ``QMessageBox`` to the user

    :param msg: Message to display.
    :type msg: str
    :param obj: Parent object for the ``QMessageBox``
    :type obj: QObject
    :param title: An optional title for the `QMessageBox``
    :type title: str
    """
    rospy.logerr(msg)

    box = QMessageBox()
    box.setText(msg)
    box.setWindowTitle(title)
    box.show()

    obj._message_box = box
Ejemplo n.º 6
0
def dasherr(msg, obj, title='Error'):
    """
    Logs a message with ``rospy.logerr`` and displays a ``QMessageBox`` to the user

    :param msg: Message to display.
    :type msg: str
    :param obj: Parent object for the ``QMessageBox``
    :type obj: QObject
    :param title: An optional title for the `QMessageBox``
    :type title: str
    """
    rospy.logerr(msg)

    box = QMessageBox()
    box.setText(msg)
    box.setWindowTitle(title)
    box.show()

    obj._message_box = box
Ejemplo n.º 7
0
    def newButtonSetOrUpdateCurrent(self):
        '''
        Asks user whether saving of button set is to be 
        to a new file, or an update to the current file.
        Cancel is offered as well.
        @return: ButtonSaveResult.NEW_SET, ButtonSaveResult.UPDATE_CURRENT, or ButtonSaveResult.CANCEL
        @rtype: DialogService.ButtonSaveResult
        '''
        msgBox = QMessageBox()
        msgBox.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        msgBox.setText('Create new button set, or update current set?')

        updateCurrButton   = QPushButton('Update current')
        msgBox.addButton(updateCurrButton, QMessageBox.NoRole)
        
        newSetButton   = QPushButton('Create new set')
        msgBox.addButton(newSetButton, QMessageBox.YesRole)
        
        cancelButton = QPushButton('Cancel');
        msgBox.addButton(cancelButton, QMessageBox.RejectRole)

        value = msgBox.exec_();
        return value;
Ejemplo n.º 8
0
class DialogService(object):

    class ButtonSaveResult:
        UPDATE_CURRENT = 0;
        NEW_SET = 1;
        CANCEL = 2;
        

    #----------------------------------
    # Initializer
    #--------------

    def __init__(self, parent=None):
        
        # All-purpose error popup message:
        # Used by self.showErrorMsgByErrorCode(<errorCode>), 
        # or self.showErrorMsg(<string>). Returns a
        # QErrorMessage without parent, but with QWindowFlags set
	    # properly to be a dialog popup box:
        self.errorMsgPopup = QErrorMessage.qtHandler();
       	# Re-parent the popup, retaining the window flags set
        # by the qtHandler:
        self.errorMsgPopup.setParent(parent, self.errorMsgPopup.windowFlags());
        self.errorMsgPopup.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        
        self.infoMsg = QMessageBox(parent=parent);
        self.infoMsg.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
    
    #----------------------------------
    # showErrorMsg
    #--------------
    QErrorMessage
    def showErrorMsg(self,errMsg):
        '''
        Given a string, pop up an error dialog.
        @param errMsg: The message
        @type errMsg: string
        '''
        self.errorMsgPopup.showMessage(errMsg);
    
    #----------------------------------
    # showInfoMsg 
    #--------------

    def showInfoMessage(self, text):
        self.infoMsg.setText(text);
        self.infoMsg.exec_();        

    #----------------------------------
    # newButtonSetOrUpdateCurrent
    #--------------
    
    def newButtonSetOrUpdateCurrent(self):
        '''
        Asks user whether saving of button set is to be 
        to a new file, or an update to the current file.
        Cancel is offered as well.
        @return: ButtonSaveResult.NEW_SET, ButtonSaveResult.UPDATE_CURRENT, or ButtonSaveResult.CANCEL
        @rtype: DialogService.ButtonSaveResult
        '''
        msgBox = QMessageBox()
        msgBox.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        msgBox.setText('Create new button set, or update current set?')

        updateCurrButton   = QPushButton('Update current')
        msgBox.addButton(updateCurrButton, QMessageBox.NoRole)
        
        newSetButton   = QPushButton('Create new set')
        msgBox.addButton(newSetButton, QMessageBox.YesRole)
        
        cancelButton = QPushButton('Cancel');
        msgBox.addButton(cancelButton, QMessageBox.RejectRole)

        value = msgBox.exec_();
        return value;
Ejemplo n.º 9
0
 def show_warning(self, text):
     qWarning(text)
     msgBox = QMessageBox()
     msgBox.setText(text)
     msgBox.exec_()
Ejemplo n.º 10
0
 def show_warning(self, text):
     qWarning(text)
     msgBox = QMessageBox()
     msgBox.setText(text)
     msgBox.exec_()