gui_service.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import Tkinter
00003 import roslib
00004 roslib.load_manifest('face_contour_detector')
00005 import rospy
00006 from face_contour_detector.srv import *
00007 from face_contour_detector.msg import *
00008 import image_selection_frame
00009 import image_settings_frame
00010 from portrait_robot_msgs.srv import *
00011 
00012 ## @package face_contour_detector.gui.gui_service
00013 #  This modules initializes a new node that implements the service srv/ContourDetectorGUI. It accepts a list of autoselect_result as proposals and opens an ImageSelectionFrame. This opens an ImageSettingsFrame. Details can be found in the class documentation.
00014 #  The name of the service is "display_on_gui"
00015 #  @author Fabian Wenzelmann
00016 
00017 ## @brief Handler function that handles a display_on_gui service request
00018 #  @param req ContourDetectorGUIRequest
00019 #  @return Returns ContourDetectorGUIResponse - but this value is not really important since the main gui is called - but the method must returns a response
00020 def show_handler(req):
00021     #global gui_opened
00022     #if gui_opened:
00023     #    msg_srv = rospy.ServiceProxy("/alubsc/status_msg", alubsc_status_msg)
00024     #    try:
00025     #        msg_srv(2, "a gui is already running".encode("ascii"))
00026     #    except:
00027     #        pass
00028     #    return ContourDetectorGUIResponse()
00029     #gui_opened = True
00030     props = req.proposals
00031     root = Tkinter.Tk()
00032     frame = image_selection_frame.ImageSelectionFrame(root, props)
00033     frame.pack()
00034     root.mainloop()
00035     service = rospy.ServiceProxy("/alubsc/edge_image", alubsc_node_instr)
00036     if image_settings_frame.current_image is None:
00037         service(False, [])
00038     else:
00039         service(True, [image_settings_frame.current_image])
00040     #gui_opened = False
00041     return ContourDetectorGUIResponse()
00042 
00043 ## @brief init the node
00044 def init_gui_node():
00045     rospy.init_node("gui_server")
00046     s1 = rospy.Service("display_on_gui", ContourDetectorGUI, show_handler)
00047     rospy.spin()
00048     
00049 if __name__ == "__main__":
00050     init_gui_node()
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


face_contour_detector
Author(s): Fabian Wenzelmann and Julian Schmid
autogenerated on Wed Dec 26 2012 16:18:17