コード例 #1
0
 def __init__(self):
     QObject.__init__(self)
     self.file_watcher = QFileSystemWatcher()
     self.file_watcher.fileChanged.connect(self.on_file_changed)
     self.changed = {}
     self.launches = {}
     self.binaries = {}
コード例 #2
0
ファイル: file_watcher.py プロジェクト: fkie/multimaster_fkie
 def __init__(self):
     QObject.__init__(self)
     self.file_watcher = QFileSystemWatcher()
     self.file_watcher.fileChanged.connect(self.on_file_changed)
     self.changed = {}
     self.launches = {}
     self.binaries = {}
コード例 #3
0
 def __init__(self, args, bufsize=0, executable=None, stdin=None, stdout=None,
              stderr=subprocess.PIPE, preexec_fn=None, close_fds=False,
              shell=False, cwd=None, env=None, universal_newlines=False,
              startupinfo=None, creationflags=0, object_id='', description=''):
     '''
     For arguments see https://docs.python.org/2/library/subprocess.html
     Additional arguments:
     :param object_id: the identification string of this object and title of the
     error message dialog
     :type object_id: str
     :param description: the description string used as addiotional information
     in dialog if an error was occured
     :type description: str
     '''
     try:
         QObject.__init__(self)
         self._args = args
         self._object_id = object_id
         self._description = description
         self.error.connect(self.on_error)
         # wait for process to avoid 'defunct' processes
         self.popen = subprocess.Popen(args=args, bufsize=bufsize, executable=executable, stdin=stdin, stdout=stdout,
                                       stderr=stderr, preexec_fn=preexec_fn, close_fds=close_fds, shell=shell, cwd=cwd, env=env,
                                       universal_newlines=universal_newlines, startupinfo=startupinfo, creationflags=creationflags)
         thread = threading.Thread(target=self._supervise)
         thread.setDaemon(True)
         thread.start()
     except Exception as _:
         raise
コード例 #4
0
 def __init__(self):
     QObject.__init__(self)
     self.setObjectName('ParameterHandler')
     self.__requestListThreads = []
     self.__requestValuesThreads = []
     self.__deliveryThreads = []
     self._lock = threading.RLock()
コード例 #5
0
 def __init__(self, launch_file, package=None, masteruri=None, argv=[]):
     '''
     Creates the LaunchConfig object. The launch file will be not loaded on
     creation, first on request of Roscfg value.
     @param launch_file: The absolute or relative path with the launch file.
                        By using relative path a package must be valid for
                        remote launches.
     @type launch_file: C{str}
     @param package:  the package containing the launch file. If None the
                     launch_file will be used to determine the launch file.
                     No remote launches a possible without a valid package.
     @type package: C{str} or C{None}
     @param masteruri: The URL of the ROS master.
     @type masteruri: C{str} or C{None}
     @param argv: the list the arguments needed for loading the given launch file
     @type argv: C{[str]}
     @raise roslaunch.XmlParseException: if the launch file can't be found.
     '''
     QObject.__init__(self)
     self.__launchFile = launch_file
     self.__package = package_name(os.path.dirname(
         self.__launchFile))[0] if package is None else package
     self.__masteruri = masteruri if masteruri is not None else 'localhost'
     self.__roscfg = None
     self.argv = argv
     self.__reqTested = False
     self.__argv_values = dict()
     self.global_param_done = [
     ]  # masteruri's where the global parameters are registered
     self.hostname = get_hostname(self.__masteruri)
     self.__launch_id = '%.9f' % time.time()
     nm.filewatcher().add_launch(self.__masteruri, self.__launchFile,
                                 self.__launch_id, [self.__launchFile])
コード例 #6
0
 def __init__(self):
     '''
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._interfaces_files = None
     self.setDaemon(True)
コード例 #7
0
 def __init__(self, subsystem_id, node_id, caller_ns):
     '''
     :param caller_ns: the namespace of the client used to create handoff topics
     '''
     QObject.__init__(self)
     jaus_address = JausAddress(subsystem_id, node_id, 0)
     self._address = Address(jaus_address)
     self._subsystem_restricted = 65535
     self._only_monitor = False
     self._ocu_nodes = dict()  # address of ocu client : services
     self._warnings = dict(
     )  # address of ocu client : list of services with warnings
     self._ins_autorithy = dict(
     )  # address of ocu client : list of services with INSUFFICIENT_AUTHORITY
     self._has_control_access = False
     self.handoff_supported = True
     self.control_subsystem = -1  # this value is set by robot.py
     self._topic_handoff_own_request = '%shandoff_own_request' % caller_ns
     self._topic_handoff_own_response = '%shandoff_own_response' % caller_ns
     self._topic_handoff_remote_request = '%shandoff_remote_request' % caller_ns
     self._topic_handoff_remote_response = '%shandoff_remote_response' % caller_ns
     self._pub_handoff_own_request = rospy.Publisher(
         self._topic_handoff_own_request, HandoffRequest, queue_size=10)
     self._pub_handoff_own_response = rospy.Publisher(
         self._topic_handoff_own_response, HandoffResponse, queue_size=10)
     self._sub_handoff_remote_request = rospy.Subscriber(
         self._topic_handoff_remote_request,
         HandoffRequest,
         self._callback_handoff_remote_request,
         queue_size=10)
     self._sub_handoff_remote_response = rospy.Subscriber(
         self._topic_handoff_remote_response,
         HandoffResponse,
         self._callback_handoff_remote_response,
         queue_size=10)
コード例 #8
0
 def __init__(self, subsystem, settings, authority=205):
     QObject.__init__(self)
     self._subsystem = subsystem
     self._settings = settings
     self._authority = authority
     ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                            'robot.ui')
     self._widget = QWidget()
     loadUi(ui_file, self._widget)
     self._last_update = rospy.Time.now()
     self._component_names = dict()
     self._warnings = []
     self._feedback_warnings = dict()
     self._ocu_client = None
     self._warning_dialog = self._create_warning_dialog()
     self._detailed_dialog = self._create_detailed_dialog()
     self.handoff_dialog = HandoffDialog(self.name, self.subsystem_id,
                                         self._settings, self._widget)
     self.handoff_dialog.button_blink.connect(
         self._widget.button_handoff.setEnabled)
     self._widget.button_view.clicked.connect(self._on_robot_view)
     self._widget.button_control.setText(
         "%s - %d" %
         (subsystem.ident.name, self._subsystem.ident.address.subsystem_id))
     self._widget.button_control.clicked.connect(self._on_robot_control)
     self._widget.button_control.setObjectName(subsystem.ident.name)
     self._widget.button_handoff.setEnabled(False)
     self._widget.button_handoff.clicked.connect(self.on_show_handoff)
     self._widget.button_warnings.setEnabled(False)
     self._widget.button_warnings.clicked.connect(self.on_show_warnings)
     self._widget.button_details.clicked.connect(self.on_show_details)
コード例 #9
0
 def __init__(self, service_uri, service, delay_exec=0.0, parent=None):
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._service_uri = service_uri
     self._service = service
     self._delay_exec = delay_exec
     self.setDaemon(True)
コード例 #10
0
 def __init__(self):
     QObject.__init__(self)
     self.setObjectName('ParameterHandler')
     self.__requestListThreads = []
     self.__requestValuesThreads = []
     self.__deliveryThreads = []
     self._lock = threading.RLock()
コード例 #11
0
 def __init__(self):
     '''
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._interfaces_files = None
     self.setDaemon(True)
コード例 #12
0
 def __init__(self, launch_file, package=None, masteruri=None, argv=[]):
     '''
     Creates the LaunchConfig object. The launch file will be not loaded on
     creation, first on request of Roscfg value.
     @param launch_file: The absolute or relative path with the launch file.
                        By using relative path a package must be valid for
                        remote launches.
     @type launch_file: C{str}
     @param package:  the package containing the launch file. If None the
                     launch_file will be used to determine the launch file.
                     No remote launches a possible without a valid package.
     @type package: C{str} or C{None}
     @param masteruri: The URL of the ROS master.
     @type masteruri: C{str} or C{None}
     @param argv: the list the arguments needed for loading the given launch file
     @type argv: C{[str]}
     @raise roslaunch.XmlParseException: if the launch file can't be found.
     '''
     QObject.__init__(self)
     self.__launchFile = launch_file
     self.__package = package_name(os.path.dirname(self.__launchFile))[0] if package is None else package
     self.__masteruri = masteruri if masteruri is not None else 'localhost'
     self.__roscfg = None
     self.argv = argv
     self.__reqTested = False
     self.__argv_values = dict()
     self.global_param_done = []  # masteruri's where the global parameters are registered
     self.hostname = nm.nameres().getHostname(self.__masteruri)
     self.__launch_id = '%.9f' % time.time()
     nm.file_watcher().add_launch(self.__masteruri, self.__launchFile, self.__launch_id, [self.__launchFile])
コード例 #13
0
 def __init__(self, masteruri, wait, check_host=True, parent=None):
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._masteruri = masteruri
     self._wait = wait
     self._check_host = check_host
     self.setDaemon(True)
コード例 #14
0
 def __init__(self, args, bufsize=0, executable=None, stdin=None, stdout=None,
              stderr=subprocess.PIPE, preexec_fn=None, close_fds=False,
              shell=False, cwd=None, env=None, universal_newlines=False,
              startupinfo=None, creationflags=0, object_id='', description=''):
     '''
     For arguments see https://docs.python.org/2/library/subprocess.html
     Additional arguments:
     :param object_id: the identification string of this object and title of the
     error message dialog
     :type object_id: str
     :param description: the description string used as addiotional information
     in dialog if an error was occured
     :type description: str
     '''
     try:
         QObject.__init__(self)
         self._args = args
         self._object_id = object_id
         self._description = description
         self.error.connect(self.on_error)
         # wait for process to avoid 'defunct' processes
         self.popen = subprocess.Popen(args=args, bufsize=bufsize, executable=executable, stdin=stdin, stdout=stdout,
                                       stderr=stderr, preexec_fn=preexec_fn, close_fds=close_fds, shell=shell, cwd=cwd, env=env,
                                       universal_newlines=universal_newlines, startupinfo=startupinfo, creationflags=creationflags)
         thread = threading.Thread(target=self._supervise)
         thread.setDaemon(True)
         thread.start()
     except Exception as _:
         raise
コード例 #15
0
ファイル: run_dialog.py プロジェクト: AaryenMehta/learning101
 def __init__(self, package, grpc_url, parent=None):
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._grpc_url = grpc_url
     self._package = package
     self.setDaemon(True)
     self._canceled = False
     self._result = {}
コード例 #16
0
ファイル: Gui.py プロジェクト: thesamprice/py-qt-propgrid
 def __init__(self, parent=None):
     QObject.__init__(self, parent)
     self.children = []
     self.active_members = []
     self.format = 'long'
     self.command_text = ''
     self.last_index =  0.0
     self.html = ''
コード例 #17
0
 def __init__(self, ident, descr='', target=None, args=()):
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._id = ident
     self.descr = descr
     self._target = target
     self._args = args
     self.setDaemon(True)
コード例 #18
0
 def __init__(self, ident, descr='', target=None, args=()):
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._id = ident
     self.descr = descr
     self._target = target
     self._args = args
     self.setDaemon(True)
コード例 #19
0
 def __init__(self, progress_frame, progress_bar, progress_cancel_button, name=''):
     QObject.__init__(self)
     self.__progress_queue = []
     self.__running = False
     self._name = name
     self._progress_frame = progress_frame
     self._progress_bar = progress_bar
     self._progress_cancel_button = progress_cancel_button
     progress_frame.setVisible(False)
     progress_cancel_button.clicked.connect(self._on_progress_canceled)
コード例 #20
0
    def __init__(self, current_path, root_path):
        '''
        :param root_path: the open root file
        :type root_path: str
        '''
        QObject.__init__(self)
        threading.Thread.__init__(self)
        self.setDaemon(True)
#        self.current_path = current_path
        self.root_path = root_path
コード例 #21
0
 def __init__(self, progress_frame, progress_bar, progress_cancel_button):
     QObject.__init__(self)
     self.__ignore_err_list = []
     self.__progress_queue = []
     self.__running = False
     self._progress_frame = progress_frame
     self._progress_bar = progress_bar
     self._progress_cancel_button = progress_cancel_button
     progress_frame.setVisible(False)
     progress_cancel_button.clicked.connect(self._on_progress_canceled)
コード例 #22
0
 def __init__(self, parent=None):
     super(LifeFrame, self).__init__(parent)
     self._ui = Ui_life_frame()
     self._motion = Rotate('/mobile_base/commands/velocity')
     self._motion_thread = None
     self._timer = QTimer()
     #self._timer.setInterval(60000) #60s
     self._timer.setInterval(250) #60s
     QObject.connect(self._timer, SIGNAL('timeout()'), self, SLOT('update_progress_callback()'))
     self._state = LifeFrame.STATE_STOPPED
     self._is_alive = False # Used to indicate whether the frame is alive or not (see hibernate/restore methods)
コード例 #23
0
 def __init__(self, masteruri, params, parent=None):
     '''
     @param masteruri: The URI of the ROS parameter server
     @type masteruri: C{str}
     @param params: The dictinary the parameter name and their value, see U{http://www.ros.org/wiki/ROS/Parameter%20Server%20API#setParam}
     @type params: C{dict(str: value)}
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._masteruri = masteruri
     self._params = params
     self.setDaemon(True)
コード例 #24
0
 def __init__(self, monitoruri, masteruri, delayed_exec=0., parent=None):
     '''
     :param str masteruri: the URI of the remote ROS master
     :param str monitoruri: the URI of the monitor RPC interface of the master_discovery node
     :param float delayed_exec: Delay the execution of the request for given seconds.
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._monitoruri = monitoruri
     self._masteruri = masteruri
     self._delayed_exec = delayed_exec
     self.setDaemon(True)
コード例 #25
0
 def __init__(self, parent=None):
     super(LifeFrame, self).__init__(parent)
     self._ui = Ui_life_frame()
     self._motion = Rotate('/mobile_base/commands/velocity')
     self._motion_thread = None
     self._timer = QTimer()
     #self._timer.setInterval(60000) #60s
     self._timer.setInterval(250)  #60s
     QObject.connect(self._timer, SIGNAL('timeout()'), self,
                     SLOT('update_progress_callback()'))
     self._state = LifeFrame.STATE_STOPPED
     self._is_alive = False  # Used to indicate whether the frame is alive or not (see hibernate/restore methods)
コード例 #26
0
 def __init__(self, masteruri, params, parent=None):
     '''
     @param masteruri: The URI of the ROS parameter server
     @type masteruri: C{str}
     @param params: The dictinary the parameter name and their value, see U{http://www.ros.org/wiki/ROS/Parameter%20Server%20API#setParam}
     @type params: C{dict(str: value)}
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._masteruri = masteruri
     self._params = params
     self.setDaemon(True)
コード例 #27
0
 def __init__(self, current_path, root_path):
     '''
     :param root_path: the open root file
     :type root_path: str
     :param current_path: current shown file
     :type current_path: str
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self.setDaemon(True)
     self.current_path = current_path
     self.root_path = root_path
コード例 #28
0
 def __init__(self, nodename, masteruri, layout, parent=None):
     '''
     Creates a new item.
     '''
     QObject.__init__(self, parent)
     self.setObjectName("LoggerHandler")
     self.nodename = nodename
     self.masteruri = masteruri
     self._logger_items = {}  # logger name: LoggerItem
     self.layout = layout
     self._change_all_cancel = False
     self.loggers_signal.connect(self._handle_loggers)
     self._thread_update = None
     self._thread_set_all = None
コード例 #29
0
    def __init__(self, master):
        QObject.__init__(self)
        self.name = master.name
        self._master = master
        self._syncronized = MasterSyncButtonHelper.NOT_SYNC
        self.ICONS = {MasterSyncButtonHelper.SYNC: nm.settings().icon("%s_sync.png" % self.ICON_PREFIX),
                      MasterSyncButtonHelper.NOT_SYNC: nm.settings().icon("%s_not_sync.png" % self.ICON_PREFIX),
                      MasterSyncButtonHelper.SWITCHED: nm.settings().icon("%s_start_sync.png" % self.ICON_PREFIX)}
        self.widget = QPushButton()
#    self.widget.setFlat(True)
        self.widget.setIcon(self.ICONS[MasterSyncButtonHelper.NOT_SYNC])
        self.widget.setMaximumSize(48, 48)
        self.widget.setCheckable(True)
        self.widget.clicked.connect(self.on_sync_clicked)
コード例 #30
0
    def __init__(self, master):
        QObject.__init__(self)
        self.name = master.name
        self._master = master
        self._syncronized = MasterSyncButtonHelper.NOT_SYNC
        self.ICONS = {MasterSyncButtonHelper.SYNC: QIcon(":/icons/%s_sync.png" % self.ICON_PREFIX),
                      MasterSyncButtonHelper.NOT_SYNC: QIcon(":/icons/%s_not_sync.png" % self.ICON_PREFIX),
                      MasterSyncButtonHelper.SWITCHED: QIcon(":/icons/%s_start_sync.png" % self.ICON_PREFIX)}
        self.widget = QPushButton()
#    self.widget.setFlat(True)
        self.widget.setIcon(self.ICONS[MasterSyncButtonHelper.NOT_SYNC])
        self.widget.setMaximumSize(48, 48)
        self.widget.setCheckable(True)
        self.widget.clicked.connect(self.on_sync_clicked)
コード例 #31
0
 def __init__(self, nodename, masteruri, loggers, newlevel):
     '''
     :param str nodename: the name of the node
     :param str masteruri: the master where the service is registered
     :param list logger: list with tuple of (logger and current level)
     :param str newlevel: new log level
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._nodename = nodename
     self._masteruri = masteruri
     self._loggers = loggers
     self._newlevel = newlevel
     self._cancel = False
     self.setDaemon(True)
コード例 #32
0
 def __init__(self, monitoruri, masteruri, delayed_exec=0., parent=None):
     '''
     @param masteruri: the URI of the remote ROS master
     @type masteruri: C{str}
     @param monitoruri: the URI of the monitor RPC interface of the master_discovery node
     @type monitoruri: C{str}
     @param delayed_exec: Delay the execution of the request for given seconds.
     @type delayed_exec: C{float}
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._monitoruri = monitoruri
     self._masteruri = masteruri
     self._delayed_exec = delayed_exec
     self.setDaemon(True)
コード例 #33
0
 def eventFilter(self, watched, event):
     if event.type() == QEvent.DeferredDelete:
         # TOOD: check if ignore() is necessary
         event.ignore()
         self.close_signal.emit(str(self._instance_id))
         return True
     return QObject.eventFilter(self, watched, event)
コード例 #34
0
 def eventFilter(self, watched, event):
     if event.type() == QEvent.DeferredDelete:
         # TOOD: check if ignore() is necessary
         event.ignore()
         self.close_signal.emit(str(self._instance_id))
         return True
     return QObject.eventFilter(self, watched, event)
コード例 #35
0
 def __init__(self, nodename, masteruri, layout, parent=None):
     '''
     Creates a new item.
     '''
     QObject.__init__(self, parent)
     self.setObjectName("LoggerHandler")
     self.nodename = nodename
     self.masteruri = masteruri
     self._filter = QRegExp('', Qt.CaseInsensitive, QRegExp.Wildcard)
     self._logger_items = {}  # logger name: LoggerItem
     self.layout = layout
     self._change_all_cancel = False
     self._stored_values = {}
     self.loggers_signal.connect(self._handle_loggers)
     self._thread_update = None
     self._thread_set_all = None
コード例 #36
0
 def eventFilter(self, obj, event):
     print('key pressed')
     if event.type() == QEvent.KeyPress and (event.key() == Qt.Key_Left or event.key() == Qt.Key_Right):
         return True # eat alt+tab or alt+shift+tab key
     else:
         # standard event processing
         return QObject.eventFilter(self, obj, event)
コード例 #37
0
 def __init__(self, search_text, path, is_regex=False, path_text={}, recursive=False):
     '''
     :param search_text: text to search for
     :type search_text: str
     :param path: initial file path
     :type path: str
     .param is_regex: is the search_text a regular expressions
     :type is_regex: bool
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._search_text = search_text
     self._path = path
     self._path_text = path_text
     self._recursive = recursive
     self._isrunning = True
     self.setDaemon(True)
コード例 #38
0
 def __init__(self, search_text, path, is_regex=False, path_text={}, recursive=False, only_launch=False, count_results=0):
     '''
     :param str search_text: text to search for
     :param str path: initial file path
     :param bool is_regex: is the search_text a regular expressions
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._search_text = search_text
     self._path = path
     self._path_text = path_text
     self._recursive = recursive
     self._only_launch = only_launch
     self._found = 0
     self._count_results = count_results
     self._isrunning = True
     self.setDaemon(True)
コード例 #39
0
 def __init__(self, launch_file, mtime=0, includes={}, args={}, nodes=[]):
     '''
     Creates the LaunchConfig object. Store the informations get from
     node manager daemon.
     :param str launch_file: grpc path to the lauch file
     :param double mtime:  modification time of the launch file used to detect changes.
     :param includes: a dictionary with included files and their modification time stamps.
     :type includes: {str: double}
     :param args: a dictionary with arguments used to load launch file.
     :type args: {str: str}
     :param nodes: a list with node names.
     :type nodes: [str]
     '''
     QObject.__init__(self)
     self.launchfile = launch_file
     self.mtime = mtime
     self.includes = includes
     self.args = args
     self.nodes = nodes
     self.global_param_done = True
     self.__launch_id = '%.9f' % time.time()
コード例 #40
0
ファイル: __init__.py プロジェクト: AaryenMehta/learning101
 def __init__(self):
     QObject.__init__(self)
     self._channels = []
     self.file = FileChannel()
     self.file.error.connect(self.on_error)
     self._channels.append(self.file)
     self.launch = LaunchChannel()
     self.launch.error.connect(self.on_error)
     self._channels.append(self.launch)
     self.monitor = MonitorChannel()
     self.monitor.error.connect(self.on_error)
     self._channels.append(self.monitor)
     self.screen = ScreenChannel()
     self.screen.error.connect(self.on_error)
     self._channels.append(self.screen)
     self.settings = SettingsChannel()
     self.settings.error.connect(self.on_error)
     self._channels.append(self.settings)
     self.version = VersionChannel()
     self.version.error.connect(self.on_error)
     self._channels.append(self.version)
コード例 #41
0
 def __init__(self,
              search_text,
              path,
              is_regex=False,
              path_text={},
              recursive=False):
     '''
     :param search_text: text to search for
     :type search_text: str
     :param path: initial file path
     :type path: str
     .param is_regex: is the search_text a regular expressions
     :type is_regex: bool
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._search_text = search_text
     self._path = path
     self._path_text = path_text
     self._recursive = recursive
     self._isrunning = True
     self.setDaemon(True)
コード例 #42
0
    def __init__(self, context):
        QObject.__init__(self, context)
        self.setObjectName('CO2Detection')
         # setup main widget
        self._widget = QWidget()
        ui_file = os.path.join(rospkg.RosPack().get_path('hector_co2_detection_plugin'), 'lib', 'CO2Detection.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('CO2Detection')

        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)

        # setup subscribers  
        self._CO2Subscriber = rospy.Subscriber("/co2detected", Bool, self._on_co2_detected)
        
        # style settings
        self._co2_detected_color = QColor(0, 0, 0, 255)
        self._status_no_co2_style = "background-color: rgb(50, 255, 50);"
        self._status_co2_style = "background-color: rgb(255, 50, 50);"
        
        self._co2_font = QFont()
        self._co2_font.setBold(True)

       

        # Qt Signals
        #self.connect(self, QtCore.SIGNAL('setCO2Style(PyQt_PyObject)'), self._set_co2_style)
        self._update_co2_color.connect(self._set_co2_style)
        self._update_no_co2_color.connect(self._set_no_co2_style)

        self._widget.co2detectbutton.setText("Clear Air")
        self._update_no_co2_color.emit()
コード例 #43
0
 def eventFilter(self, obj, event):
     if event.type() in self._event_callbacks:
         ret_val = self._event_callbacks[event.type()](obj, event)
         if ret_val is not None:
             return ret_val
     if event.type() == event.ContextMenu and obj == self.title_label:
         menu = QMenu(self)
         rename_action = menu.addAction(self.tr('Rename dock widget'))
         action = menu.exec_(self.mapToGlobal(event.pos()))
         if action == rename_action:
             self.title_label.hide()
             self.title_edit.setText(self.title_label.text())
             self.title_edit.show()
             self.title_edit.setFocus()
         return True
     return QObject.eventFilter(self, obj, event)
コード例 #44
0
 def eventFilter(self, obj, event):
     if event.type() in self._event_callbacks:
         ret_val = self._event_callbacks[event.type()](obj, event)
         if ret_val is not None:
             return ret_val
     if event.type() == event.ContextMenu and obj == self.title_label:
         menu = QMenu(self)
         rename_action = menu.addAction(self.tr('Rename dock widget'))
         action = menu.exec_(self.mapToGlobal(event.pos()))
         if action == rename_action:
             self.title_label.hide()
             self.title_edit.setText(self.title_label.text())
             self.title_edit.show()
             self.title_edit.setFocus()
         return True
     return QObject.eventFilter(self, obj, event)
コード例 #45
0
    def eventFilter(self, watched, event):
        if event.type() == QEvent.Hide:
            self.hide_signal.emit(watched)

        if event.type() == QEvent.Show:
            self.show_signal.emit(watched)

        if event.type() == QEvent.WindowIconChange:
            # prevent emitting recursive event when emitted signal will trigger another event
            if not self._recursive_invocation:
                self._recursive_invocation = True
                self.window_icon_changed_signal.emit(watched)
                self._recursive_invocation = False

        if event.type() == QEvent.WindowTitleChange:
            # prevent emitting recursive event when emitted signal will trigger another event
            if not self._recursive_invocation:
                self._recursive_invocation = True
                self.window_title_changed_signal.emit(watched)
                self._recursive_invocation = False

        return QObject.eventFilter(self, watched, event)
コード例 #46
0
    def eventFilter(self, watched, event):
        if event.type() == QEvent.Hide:
            self.hide_signal.emit(watched)

        if event.type() == QEvent.Show:
            self.show_signal.emit(watched)

        if event.type() == QEvent.WindowIconChange:
            # prevent emitting recursive event when emitted signal will trigger another event
            if not self._recursive_invocation:
                self._recursive_invocation = True
                self.window_icon_changed_signal.emit(watched)
                self._recursive_invocation = False

        if event.type() == QEvent.WindowTitleChange:
            # prevent emitting recursive event when emitted signal will trigger another event
            if not self._recursive_invocation:
                self._recursive_invocation = True
                self.window_title_changed_signal.emit(watched)
                self._recursive_invocation = False

        return QObject.eventFilter(self, watched, event)
コード例 #47
0
 def eventFilter(self, obj, event):
     if event.type() in self._event_callbacks:
         ret_val = self._event_callbacks[event.type()](obj, event)
         if ret_val is not None:
             return ret_val
     if event.type() == event.ContextMenu and obj == self.title_label:
         menu = QMenu(self)
         rename_action = menu.addAction(self.tr('Rename dock widget'))
         hide_action = QAction("Hide title bar", self)
         hide_action.setCheckable(True)
         hide_action.setChecked(self.hide_title_bar)
         if self._dock_widget.features() & QDockWidget.DockWidgetFloatable and \
                 self._dock_widget.features() & QDockWidget.DockWidgetMovable:
             menu.addAction(hide_action)
         action = menu.exec_(self.mapToGlobal(event.pos()))
         if action == rename_action:
             self.title_label.hide()
             self.title_edit.setText(self.title_label.text())
             self.title_edit.show()
             self.title_edit.setFocus()
         if action == hide_action:
             self.hide_title_bar = not self.hide_title_bar
         return True
     return QObject.eventFilter(self, obj, event)
コード例 #48
0
 def eventFilter(self, obj, event):
     if event.type() in self._event_callbacks:
         ret_val = self._event_callbacks[event.type()](obj, event)
         if ret_val is not None:
             return ret_val
     return QObject.eventFilter(self, obj, event)
コード例 #49
0
 def __init__(self):
     QObject.__init__(self)
     self.__updateThreads = {}
     self.__requestedUpdates = {}
     self._lock = threading.RLock()
コード例 #50
0
 def __init__(self, launch_serveruri, delayed_exec=0.0, parent=None):
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._launch_serveruri = launch_serveruri
     self._delayed_exec = delayed_exec
     self.setDaemon(True)
コード例 #51
0
ファイル: history.py プロジェクト: fkie/multimaster_fkie
 def __init__(self):
     QObject.__init__(self)
     self.PARAM_CACHE = self.loadCache(nm.settings().PARAM_HISTORY_FILE)
コード例 #52
0
 def __init__(self, masteruri, params, parent=None):
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._masteruri = masteruri
     self._params = params
     self.setDaemon(True)
コード例 #53
0
 def __init__(self, masteruri, wait, parent=None):
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self._masteruri = masteruri
     self._wait = wait
     self.setDaemon(True)
コード例 #54
0
 def __init__(self):
     '''
     '''
     QObject.__init__(self)
     threading.Thread.__init__(self)
     self.setDaemon(True)
コード例 #55
0
 def __init__(self):
     QObject.__init__(self)
     self.__serviceThreads = {}
     self.__refreshThreads = {}
     self._lock = threading.RLock()