Exemplo n.º 1
0
    def create_transaction_details_window(self, tx_dict):
        tx = Transaction(tx_dict["hex"])
            
        dialog = QDialog(self.gui)
        dialog.setMinimumWidth(500)
        dialog.setWindowTitle(_('Process Offline transaction'))
        dialog.setModal(1)

        l = QGridLayout()
        dialog.setLayout(l)

        l.addWidget(QLabel(_("Transaction status:")), 3,0)
        l.addWidget(QLabel(_("Actions")), 4,0)

        if tx_dict["complete"] == False:
            l.addWidget(QLabel(_("Unsigned")), 3,1)
            if self.gui.wallet.seed :
                b = QPushButton("Sign transaction")
                input_info = json.loads(tx_dict["input_info"])
                b.clicked.connect(lambda: self.sign_raw_transaction(tx, input_info, dialog))
                l.addWidget(b, 4, 1)
            else:
                l.addWidget(QLabel(_("Wallet is de-seeded, can't sign.")), 4,1)
        else:
            l.addWidget(QLabel(_("Signed")), 3,1)
            b = QPushButton("Broadcast transaction")
            b.clicked.connect(lambda: self.gui.send_raw_transaction(tx, dialog))
            l.addWidget(b,4,1)
    
        l.addWidget( self.gui.generate_transaction_information_widget(tx), 0,0,2,3)
        closeButton = QPushButton(_("Close"))
        closeButton.clicked.connect(lambda: dialog.done(0))
        l.addWidget(closeButton, 4,2)

        dialog.exec_()
Exemplo n.º 2
0
def publishDeckGui(ankiDeckForm):
    f = QDialog()
    f.ui = Ui_publishDeckForm()
    f.ui.setupUi(f)
    f.ui.pushButtonPublishDeck.clicked.connect(partial(publishDeckGuiOk, f, ankiDeckForm))
    f.ui.comboBox.addItems(mw.col.decks.allNames())
    f.ui.pushButtonCancel.clicked.connect(lambda: f.done(0))
    f.exec_()
Exemplo n.º 3
0
def ankiDeckSettings(did):
    f = QDialog()
    f.ui = Ui_Form()
    f.ui.setupUi(f)
    table = f.ui.tableWidget
    changes = Queue()
    groups = getAccessGroups(did,
                             mw.col.conf.get('ankipubsubServer',
                                             "http://144.76.172.187:5000/v0"),
                             mw.col.conf.get('pubSubName', ""),
                             mw.col.conf.get('pubSubPassword', ""))
    #users = uniqueList(groups.get('readGroup').append(groups.get('writeGroup').append(groups.get('adminGroup'))))
    readGroup = groups.get('readGroup') if groups.get('readGroup') else []
    writeGroup = groups.get('writeGroup') if groups.get('writeGroup') else []
    adminGroup = groups.get('adminGroup') if groups.get('adminGroup') else []
    users = uniqueList(readGroup + writeGroup + adminGroup)

    table.setColumnCount(4)
    table.setRowCount(len(users))
    for (i, user) in enumerate(users):
        isAdmin = DisableCheckBox(table)
        canWrite = DisableCheckBox(table)
        canRead = DisableCheckBox(table)
        if user in readGroup:
            canRead.setChecked(True)
        if user in writeGroup:
            canWrite.setChecked(True)
        if user in adminGroup:
            isAdmin.setChecked(True)
        if not mw.col.conf.get('pubSubName', "") in adminGroup and mw.col.conf.get('pubSubName', ""):
            isAdmin.setModifiable(False)
            canWrite.setModifiable(False)
            canRead.setModifiable(False)
            f.ui.AddUser.setEnabled(False)

        table.setItem(i, 0, QTableWidgetItem(str(user)))
        isAdmin.connect(isAdmin, SIGNAL("stateChanged(int)"), partial(changes.put, (i, 3, isAdmin)))
        canWrite.connect(canWrite, SIGNAL("stateChanged(int)"), partial(changes.put, (i, 2, canWrite)))
        canRead.connect(canRead, SIGNAL("stateChanged(int)"), partial(changes.put, (i, 1, canRead)))
        table.setCellWidget(i, 1, canRead)
        table.setCellWidget(i, 2, canWrite)
        table.setCellWidget(i, 3, isAdmin)

        """btnDelete = QPushButton(table)
        btnDelete.setGeometry(0, 0, 30, 30)

        btnDelete.setIcon(QIcon('../../addons/pubsub/images/Delete-Resized.jpg'))
        btnDelete.setIconSize(QSize(25, 25))
        btnDelete.clicked.connect(partial(table.removeRow, i))
        table.setCellWidget(i, 4, btnDelete)"""

    table.setHorizontalHeaderLabels(['Name', 'Read', 'Write', 'Admin', 'Delete'])
    table.resizeColumnsToContents()

    f.ui.AddUser.clicked.connect(lambda: addUser(table))
    f.ui.Cancel.clicked.connect(lambda: f.done(0))
    f.ui.Save.clicked.connect(lambda: deckSettingsSave(table, users, did, changes, f))
    f.exec_()
Exemplo n.º 4
0
    def create_transaction_details_window(self, tx_dict):
        tx = Transaction(tx_dict["hex"])

        dialog = QDialog(self.gui)
        dialog.setMinimumWidth(500)
        dialog.setWindowTitle(_('Process Offline transaction'))
        dialog.setModal(1)

        l = QGridLayout()
        dialog.setLayout(l)

        l.addWidget(QLabel(_("Transaction status:")), 3, 0)
        l.addWidget(QLabel(_("Actions")), 4, 0)

        if tx_dict["complete"] == False:
            l.addWidget(QLabel(_("Unsigned")), 3, 1)
            if self.gui.wallet.seed:
                b = QPushButton("Sign transaction")
                input_info = json.loads(tx_dict["input_info"])
                b.clicked.connect(
                    lambda: self.sign_raw_transaction(tx, input_info, dialog))
                l.addWidget(b, 4, 1)
            else:
                l.addWidget(QLabel(_("Wallet is de-seeded, can't sign.")), 4,
                            1)
        else:
            l.addWidget(QLabel(_("Signed")), 3, 1)
            b = QPushButton("Broadcast transaction")
            b.clicked.connect(
                lambda: self.gui.send_raw_transaction(tx, dialog))
            l.addWidget(b, 4, 1)

        l.addWidget(self.gui.generate_transaction_information_widget(tx), 0, 0,
                    2, 3)
        closeButton = QPushButton(_("Close"))
        closeButton.clicked.connect(lambda: dialog.done(0))
        l.addWidget(closeButton, 4, 2)

        dialog.exec_()
Exemplo n.º 5
0
 def done(self, r):
     QDialog.done(self, r)
     self.close()
Exemplo n.º 6
0
 def done(self, r):
     QDialog.done(self, r)
     self.close()
Exemplo n.º 7
0
class RemoconMain(QMainWindow):
    def __init__(self, parent, title, application):
        self._context = parent

        super(RemoconMain, self).__init__()
        self.initialised = False
        self.setObjectName('Remocon')

        self.host_name = "localhost"
        self.master_uri = "http://%s:11311" % (self.host_name)

        self.env_host_name = os.getenv("ROS_HOSTNAME")
        self.env_master_uri = os.getenv("ROS_MASTER_URI")
        if self.env_host_name == None:
            self.env_host_name = 'localhost'
        if self.env_master_uri == None:
            self.env_master_uri = "http://%s:11311" % (self.env_host_name)

        self.application = application
        self._widget_main = QWidget()

        self.rocon_master_list = {}
        self.cur_selected_rocon_master = None
        self.is_init = False

        path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../ui/remocon.ui")
        uic.loadUi(path, self._widget_main)

        utils.setup_home_dirs()
        self.rocon_master_list_cache_path = os.path.join(utils.get_settings_cache_home(), "rocon_master.cache")

        self.icon_paths = {}
        try:
            self.icon_paths['unknown'] = rocon_python_utils.ros.find_resource_from_string('rocon_icons/unknown', extension='png')
        except (rospkg.ResourceNotFound, ValueError):
            console.logerror("Remocon : couldn't find icons on the ros package path (install rocon_icons and rocon_bubble_icons")
            sys.exit(1)
        self.scripts_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../scripts/")

        #main widget
        self._widget_main.list_widget.setIconSize(QSize(50, 50))
        self._widget_main.list_widget.itemDoubleClicked.connect(self._connect_rocon_master)  # list item double click event
        self._widget_main.list_widget.itemClicked.connect(self._select_rocon_master)  # list item double click event

        self._widget_main.add_concert_btn.pressed.connect(self._set_add_rocon_master)  # add button event
        self._widget_main.delete_btn.pressed.connect(self._delete_rocon_master)  # delete button event
        self._widget_main.delete_all_btn.pressed.connect(self._delete_all_rocon_masters)  # delete all button event
        self._widget_main.refresh_btn.pressed.connect(self._refresh_rocon_master_list)  # refresh all button event

        #init
        self._init()
        self._widget_main.show()
        self._widget_main.activateWindow()  # give it the focus
        self._widget_main.raise_()          # make sure it is on top

    def __del__(self):
        print '[RemoconMain]: Destroy'

    def _init(self):

        self._connect_dlg_isValid = False
        self.cur_selected_rocon_master = None
        self._refresh_rocon_master_list()
        self.is_init = True
        pass

    def _check_up(self):
        for k in self.rocon_master_list.values():
            print("Concert: %s" % k)
            rocon_master_uri = k['master_uri']
            host_name = k['host_name']
            print "[_check_up]:MASTER_URI[%s], HOST_NAME[%s]" % (rocon_master_uri, host_name)

            output = subprocess.Popen([self.scripts_path + "rocon_remocon_check_up", rocon_master_uri, host_name], stdout=subprocess.PIPE)
            time_out_cnt = 0
            while True:
                print "checking: " + rocon_master_uri
                result = output.poll()
                if time_out_cnt > 30:
                    print "timeout: " + rocon_master_uri
                    try:
                        output.terminate()
                    except:
                        print "Error: output.terminate()"

                    k['name'] = "Unknown"
                    k['description'] = "Unknown."
                    k['icon'] = "unknown.png"
                    k['flag'] = '0'
                    break

                elif result == 0:
                    args = output.communicate()[0]
                    k['name'] = args.split('\n')[0]
                    k['description'] = args.split('\n')[1]
                    k['icon'] = args.split('\n')[2]

                    if k['name'] == "Unknown":
                        k['flag'] = '0'
                    else:
                        k['flag'] = '1'
                    break

                time.sleep(0.1)
                time_out_cnt += 1

    def _read_cache(self):
        #read cache and display the rocon master list
        try:
            cache_rocon_master_info_list = open(self.rocon_master_list_cache_path, 'r')
        except:
            console.logdebug("Remocon : no cached settings found, moving on.")
            return
        lines = cache_rocon_master_info_list.readlines()
        for line in lines:
            if line.count("[index="):
                rocon_master_index = line[string.find(line, "[index=") + len("[index="):string.find(line, ",name=")]
                rocon_master_name = line[string.find(line, "name=") + len("name="):string.find(line, ",master_uri=")]
                rocon_master_uri = line[string.find(line, ",master_uri=") + len(",master_uri="):string.find(line, ",host_name=")]
                rocon_master_host_name = line[string.find(line, ",host_name=") + len(",host_name="):string.find(line, ",description=")]
                rocon_master_description = line[string.find(line, ",description=") + len(",description="):string.find(line, ",icon=")]
                rocon_master_icon = line[string.find(line, ",icon=") + len(",icon="):string.find(line, ",flag=")]
                rocon_master_flag = line[string.find(line, ",flag=") + len(",flag="):string.find(line, "]")]

                self.rocon_master_list[rocon_master_index] = {}
                self.rocon_master_list[rocon_master_index]['index'] = rocon_master_index
                self.rocon_master_list[rocon_master_index]['name'] = rocon_master_name
                self.rocon_master_list[rocon_master_index]['master_uri'] = rocon_master_uri
                self.rocon_master_list[rocon_master_index]['host_name'] = rocon_master_host_name
                self.rocon_master_list[rocon_master_index]['icon'] = rocon_master_icon
                self.rocon_master_list[rocon_master_index]['description'] = rocon_master_description
                self.rocon_master_list[rocon_master_index]['flag'] = rocon_master_flag
        cache_rocon_master_info_list.close()

    def _delete_all_rocon_masters(self):
        for k in self.rocon_master_list.values():
            del self.rocon_master_list[k["index"]]
        self._update_rocon_master_list()

    def _delete_rocon_master(self):
        if self.cur_selected_rocon_master in self.rocon_master_list.keys():
            del self.rocon_master_list[self.cur_selected_rocon_master]
        self._update_rocon_master_list()

    def _add_rocon_master(self, params):
        rocon_master_uri = str(params['param1'].toPlainText())
        rocon_master_host_name = str(params['param2'].toPlainText())
        rocon_master_index = str(uuid.uuid4())
        self.rocon_master_list[rocon_master_index] = {}
        self.rocon_master_list[rocon_master_index]['index'] = rocon_master_index
        self.rocon_master_list[rocon_master_index]['name'] = "Unknown"
        self.rocon_master_list[rocon_master_index]['master_uri'] = rocon_master_uri
        self.rocon_master_list[rocon_master_index]['host_name'] = rocon_master_host_name
        self.rocon_master_list[rocon_master_index]['icon'] = "unknown.png"
        self.rocon_master_list[rocon_master_index]['description'] = ""
        self.rocon_master_list[rocon_master_index]['flag'] = "0"

        self._update_rocon_master_list()
        self._refresh_rocon_master_list()

    def _set_add_rocon_master(self):
        print '_add_rocon_master'
        if self._connect_dlg_isValid:
            print "Dialog is live!!"
            self._connect_dlg.done(0)

        #dialog
        self._connect_dlg = QDialog(self._widget_main)
        self._connect_dlg.setWindowTitle("Add Ros Master")
        self._connect_dlg.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Ignored)
        self._connect_dlg.setMinimumSize(350, 0)
        # dlg_rect = self._connect_dlg.geometry()

        #dialog layout
        ver_layout = QVBoxLayout(self._connect_dlg)
        ver_layout.setContentsMargins(9, 9, 9, 9)

        #param layout
        text_grid_sub_widget = QWidget()
        text_grid_layout = QGridLayout(text_grid_sub_widget)
        text_grid_layout.setColumnStretch(1, 0)
        text_grid_layout.setRowStretch(2, 0)

        #param 1
        title_widget1 = QLabel("MASTER_URI: ")
        context_widget1 = QTextEdit()
        context_widget1.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Ignored)
        context_widget1.setMinimumSize(0, 30)
        context_widget1.append(self.master_uri)

        #param 2
        title_widget2 = QLabel("HOST_NAME: ")
        context_widget2 = QTextEdit()
        context_widget2.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Ignored)
        context_widget2.setMinimumSize(0, 30)
        context_widget2.append(self.host_name)

        #add param
        text_grid_layout.addWidget(title_widget1)
        text_grid_layout.addWidget(context_widget1)
        text_grid_layout.addWidget(title_widget2)
        text_grid_layout.addWidget(context_widget2)

        #add param layout
        ver_layout.addWidget(text_grid_sub_widget)

        #button layout
        button_hor_sub_widget = QWidget()
        button_hor_layout = QHBoxLayout(button_hor_sub_widget)

        params = {}
        params['param1'] = context_widget1
        params['param2'] = context_widget2

        #check box
        use_env_var_check = QCheckBox("Use environment variables")
        use_env_var_check.setCheckState(Qt.Unchecked)

        def set_use_env_var(data, text_widget1, text_widget2):
            if data == Qt.Unchecked:
                text_widget1.setText(self.master_uri)
                text_widget2.setText(self.host_name)
            elif data == Qt.Checked:
                self.master_uri = str(text_widget1.toPlainText())
                self.host_name = str(text_widget2.toPlainText())
                text_widget1.setText(self.env_master_uri)
                text_widget2.setText(self.env_host_name)

        def check_event(data):
            set_use_env_var(data, context_widget1, context_widget2)

        use_env_var_check.stateChanged.connect(check_event)
        ver_layout.addWidget(use_env_var_check)

        #button
        btn_call = QPushButton("Add")
        btn_cancel = QPushButton("Cancel")

        btn_call.clicked.connect(lambda: self._connect_dlg.done(0))
        btn_call.clicked.connect(lambda: self._add_rocon_master(params))

        btn_cancel.clicked.connect(lambda: self._connect_dlg.done(0))

        #add button
        button_hor_layout.addWidget(btn_call)
        button_hor_layout.addWidget(btn_cancel)

        #add button layout
        ver_layout.addWidget(button_hor_sub_widget)
        self._connect_dlg.setVisible(True)
        self._connect_dlg.finished.connect(self._destroy_connect_dlg)
        self._connect_dlg_isValid = True

    def _refresh_rocon_master_list(self):
        print '_refresh_rocon_master_list'
        if self.is_init:
            self._update_rocon_master_list()
        self._read_cache()
        self._widget_main.list_info_widget.clear()
        self._check_up()
        self._update_rocon_master_list()

    def _update_rocon_master_list(self):

        print '_update_rocon_master_list'
        self._widget_main.list_widget.clear()
        try:
            cache_rocon_master_info_list = open(self.rocon_master_list_cache_path, 'w')
        except:
            print "No directory or file: %s" % (self.rocon_master_list_cache_path)
            return
        for k in self.rocon_master_list.values():
            self._add_rocon_master_list_item(k)
            rocon_master_index = k['index']
            rocon_master_name = k['name']
            rocon_master_uri = k['master_uri']
            rocon_master_host_name = k['host_name']
            rocon_master_icon = k['icon']
            rocon_master_description = k['description']
            rocon_master_flag = k['flag']

            rocon_master_elem = '['
            rocon_master_elem += 'index=' + str(rocon_master_index) + ','
            rocon_master_elem += 'name=' + str(rocon_master_name) + ','
            rocon_master_elem += 'master_uri=' + str(rocon_master_uri) + ','
            rocon_master_elem += 'host_name=' + str(rocon_master_host_name) + ','
            rocon_master_elem += 'description=' + str(rocon_master_description) + ','
            rocon_master_elem += 'icon=' + rocon_master_icon + ','
            rocon_master_elem += 'flag=' + rocon_master_flag
            rocon_master_elem += ']\n'

            cache_rocon_master_info_list.write(rocon_master_elem)
        cache_rocon_master_info_list.close()

    def _add_rocon_master_list_item(self, rocon_master):
        print('_add_rocon_master_list_item [%s]' % rocon_master['name'])
        rocon_master_index = rocon_master['index']
        rocon_master_name = rocon_master['name']
        rocon_master_uri = rocon_master['master_uri']
        rocon_master_host_name = rocon_master['host_name']
        rocon_master_icon = rocon_master['icon']
        rocon_master_description = rocon_master['description']
        rocon_master['cur_row'] = str(self._widget_main.list_widget.count())

        display_name = str(rocon_master_name) + "\n" + "[" + str(rocon_master_uri) + "]"
        self._widget_main.list_widget.insertItem(self._widget_main.list_widget.count(), display_name)

        #setting the list font

        font = self._widget_main.list_widget.item(self._widget_main.list_widget.count() - 1).font()
        font.setPointSize(13)
        self._widget_main.list_widget.item(self._widget_main.list_widget.count() - 1).setFont(font)

        #setToolTip
        rocon_master_info = ""
        rocon_master_info += "rocon_master_index: " + str(rocon_master_index) + "\n"
        rocon_master_info += "rocon_master_name: " + str(rocon_master_name) + "\n"
        rocon_master_info += "master_uri:  " + str(rocon_master_uri) + "\n"
        rocon_master_info += "host_name:  " + str(rocon_master_host_name) + "\n"
        rocon_master_info += "description:  " + str(rocon_master_description)
        self._widget_main.list_widget.item(self._widget_main.list_widget.count() - 1).setToolTip(rocon_master_info)

        #set icon
        if rocon_master_icon == "unknown.png":
            icon = QIcon(self.icon_paths['unknown'])
            self._widget_main.list_widget.item(self._widget_main.list_widget.count() - 1).setIcon(icon)
        elif len(rocon_master_icon):
            icon = QIcon(os.path.join(utils.get_icon_cache_home(), rocon_master_icon))
            self._widget_main.list_widget.item(self._widget_main.list_widget.count() - 1).setIcon(icon)
        else:
            print rocon_master_name + ': No icon'
        pass

    def _select_rocon_master(self, Item):
        list_widget = Item.listWidget()
        for k in self.rocon_master_list.values():
            if k["cur_row"] == str(list_widget.currentRow()):
                self.cur_selected_rocon_master = k['index']
                break
        self._widget_main.list_info_widget.clear()
        info_text = "<html>"
        info_text += "<p>-------------------------------------------</p>"
        info_text += "<p><b>name: </b>" + str(self.rocon_master_list[self.cur_selected_rocon_master]['name']) + "</p>"
        info_text += "<p><b>master_uri: </b>" + str(self.rocon_master_list[self.cur_selected_rocon_master]['master_uri']) + "</p>"
        info_text += "<p><b>host_name: </b>" + str(self.rocon_master_list[self.cur_selected_rocon_master]['host_name']) + "</p>"
        info_text += "<p><b>description: </b>" + str(self.rocon_master_list[self.cur_selected_rocon_master]['description']) + "</p>"
        info_text += "<p>-------------------------------------------</p>"
        info_text += "</html>"
        self._widget_main.list_info_widget.appendHtml(info_text)

    def _destroy_connect_dlg(self):
        print "[Dialog] Destroy!!!"
        self._connect_dlg_isValid = False

    def _connect_rocon_master(self):
        rocon_master_name = str(self.rocon_master_list[self.cur_selected_rocon_master]['name'])
        rocon_master_uri = str(self.rocon_master_list[self.cur_selected_rocon_master]['master_uri'])
        rocon_master_host_name = str(self.rocon_master_list[self.cur_selected_rocon_master]['host_name'])

        rocon_master_index = str(self.cur_selected_rocon_master)

        if self.rocon_master_list[rocon_master_index]['flag'] == '0':
            # DJS: unused reply box?
            # reply = QMessageBox.warning(self, 'ERROR', "YOU SELECT NO CONCERT", QMessageBox.Ok|QMessageBox.Ok)
            return

        execute_path = self.scripts_path + 'rocon_remocon_sub'  # command
        execute_path += " " + "'" + rocon_master_index + "'"  # arg1
        execute_path += " " + "'" + rocon_master_name + "'"  # arg2
        execute_path += " " + "'" + rocon_master_uri + "'"  # arg3
        execute_path += " " + "'" + rocon_master_host_name + "'"  # arg4

        self._widget_main.hide()
        os.execv(self.scripts_path + 'rocon_remocon_sub', ["", rocon_master_index, rocon_master_name, rocon_master_uri, rocon_master_host_name])
        print "Spawning: %s" % (execute_path)
Exemplo n.º 8
0
 def done(self, r):
     """Overload of QDialog.done()."""
     self.parent.enable_action()
     QDialog.done(self, r)
Exemplo n.º 9
0
    def _start_service(self,node_name,service_name):
        
        service=self._graph._client_info_list[node_name]['gateway_name']+"/"+service_name  
        info_text='' 
        
        if service_name=='status':
            service_handle=rospy.ServiceProxy(service, Status)
            call_result=service_handle()
            
            info_text="<html>"
            info_text +="<p>-------------------------------------------</p>"
            info_text +="<p><b>application_namespace: </b>" +call_result.application_namespace+"</p>"
            info_text +="<p><b>remote_controller: </b>" +call_result.remote_controller+"</p>"
            info_text +="<p><b>application_status: </b>" +call_result.application_status+"</p>"
            info_text +="</html>"
            self._client_list_update_signal.emit()

        elif service_name=='platform_info':
            service_handle=rospy.ServiceProxy(service, GetPlatformInfo)
            call_result=service_handle()

            info_text = "<html>"
            info_text += "<p>-------------------------------------------</p>"
            info_text += "<p><b>rocon_uri: </b>" + call_result.platform_info.uri + "</p>"
            info_text += "<p><b>concert_version: </b>" + call_result.platform_info.version + "</p>"
            info_text += "</html>"
            self._client_list_update_signal.emit()
            
        elif service_name=='invite':
            #sesrvice
            service_handle=rospy.ServiceProxy(service, Invite) 
            #dialog
            dlg=QDialog(self._widget) 
            dlg.setMinimumSize(400,0)
            dlg.setMaximumSize(400,0)
            dlg.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Expanding)
            #dialog layout
            ver_layout=QVBoxLayout(dlg)           
            ver_layout.setContentsMargins (0,0,0,0)

            dynamic_arg=[]
            dynamic_arg.append(DynamicArgumentLayer(ver_layout,'Remote Target Name',False,[('remote_target_name','string')]))
            dynamic_arg.append(DynamicArgumentLayer(ver_layout,'Application Namespace',False,[('application_namespace','string')]))
            dynamic_arg.append(DynamicArgumentLayer(ver_layout,'Cancel',False,[('cancel','bool')]))
            #button
            button_hor_sub_widget=QWidget()
            button_hor_layout=QHBoxLayout(button_hor_sub_widget)   
                   
            btn_call=QPushButton("Call")
            btn_cancel=QPushButton("cancel")
            
            btn_call.clicked.connect(lambda: dlg.done(0))
            btn_call.clicked.connect(lambda : self._call_invite_service(service,service_handle,dynamic_arg))

            btn_cancel.clicked.connect(lambda: dlg.done(0))
            #add button
            button_hor_layout.addWidget(btn_call)            
            button_hor_layout.addWidget(btn_cancel)
            #add button layout            
            ver_layout.addWidget(button_hor_sub_widget)

            dlg.setVisible(True)        

        elif service_name=='start_app':
            #sesrvice
            service_handle=rospy.ServiceProxy(service, StartApp) 
            #dialog
            dlg=QDialog(self._widget) 
            dlg.setMinimumSize(400,0)
            dlg.setMaximumSize(400,0)
            dlg.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Expanding)
            #dialog layout
            ver_layout=QVBoxLayout(dlg)           
            ver_layout.setContentsMargins (0,0,0,0)

            dynamic_arg=[]
            dynamic_arg.append(DynamicArgumentLayer(ver_layout,'Name',False,[('name','string')]))
            dynamic_arg.append(DynamicArgumentLayer(ver_layout,'Remappings',True,[('remap to','string'),('remap from','string')]))
            #button
            button_hor_sub_widget=QWidget()
            button_hor_layout=QHBoxLayout(button_hor_sub_widget)   
                   
            btn_call=QPushButton("Call")
            btn_cancel=QPushButton("cancel")
            
            btn_call.clicked.connect(lambda: dlg.done(0))
            btn_call.clicked.connect(lambda : self._call_start_app_service(service,service_handle,dynamic_arg))
            
            btn_cancel.clicked.connect(lambda: dlg.done(0))
            #add button
            button_hor_layout.addWidget(btn_call)            
            button_hor_layout.addWidget(btn_cancel)
            #add button layout            
            ver_layout.addWidget(button_hor_sub_widget)

            dlg.setVisible(True)        

        elif service_name=='stop_app':
            service_handle=rospy.ServiceProxy(service, StopApp)
            call_result=service_handle()

            info_text="<html>"
            info_text +="<p>-------------------------------------------</p>"
            info_text +="<p><b>stopped: </b>" +str(call_result.stopped)+"</p>"
            info_text +="<p><b>error_code: </b>" +str(call_result.error_code)+"</p>"
            info_text +="<p><b>message: </b>" +call_result.message+"</p>"
            info_text +="</html>"

            self._update_client_tab()
        else:
            print 'has no service'
            return
        
        # display the result of calling service  
        # get tab widget handle
        service_text_widget=None
        cur_tab_widget=self._widget.tabWidget.currentWidget()        
        
        if cur_tab_widget==None:
            return
            
        object_name='services_text_widget'
        for k in cur_tab_widget.children():
            if k.objectName().count(object_name) >=1 :
                service_text_widget=k
                break
        if service_text_widget==None:
            return
            
        service_text_widget.clear()
        service_text_widget.appendHtml(info_text)