Example #1
0
def line_edit_binder(line_edit, property, obj):
    print type(obj)
    print dir(obj)
    init_val = getattr(obj,property)
    line_edit.setText(str(init_val))
    property_type = type(init_val)
    validator, alignment = _line_edit_settings[property_type]
    line_edit.setAlignment(alignment)
    if validator : line_edit.setValidator(validator)

    def on_text_edited(text):
        try:
            value = property_type(text)
        except ValueError:
            value = None
        setattr(obj, property, value)

    line_edit.textEdited.connect(on_text_edited)

    def on_vm_changed(sender, prop_name):
        if prop_name == property: 
            value = getattr(sender, property)
            if not line_edit.hasFocus():
                line_edit.setText(str(value))
        if prop_name == property+'_validity':
            validity = getattr(sender, property+'_validity')
            print validity
            GUI_helper.set_line_edit_validity(line_edit, validity)

    validity = getattr(obj, property+'_validity', None)
    if validity:
        GUI_helper.set_line_edit_validity(line_edit, validity)
    obj.property_changed.connect(on_vm_changed)
Example #2
0
 def on_vm_changed(sender, prop_name):
     if prop_name == property: 
         value = getattr(sender, property)
         if not line_edit.hasFocus():
             line_edit.setText(str(value))
     if prop_name == property+'_validity':
         validity = getattr(sender, property+'_validity')
         print validity
         GUI_helper.set_line_edit_validity(line_edit, validity)
Example #3
0
    def modify_waypoint(self, title):
        ukc_units  = self.misc_data.UKC_units
        deviations = self.misc_data.deviations
        tidal_points = self.database.tidal_points
        speeds = self.misc_data.speeds

        self.top = GUI_helper.modify_waypoint_toplevel(self, title, ukc_units, deviations, tidal_points, speeds)
Example #4
0
    def load_routes_toplevel(self, title):
        waypoints = self.routing_data.route_points
        connections = self.routing_data.connections
        speeds = self.misc_data.speeds
        UKCs = self.misc_data.UKC_units

        self.top = GUI_helper.modify_route_toplevel(self, title, waypoints, connections, Routing.Route(), speeds, UKCs)
        self.make_top_modal()
Example #5
0
    def __initUI(self):

        self.parent.title("GNA Tijpoorten")

        menubar = GUI_helper.MenuBar(self)
        self.parent.config(menu=menubar)

        self.waypointframe = GUI_helper.Waypointframe(self)
        self.connections_frame = GUI_helper.ConnectionsFrame(self)
        self.routes_frame = GUI_helper.RoutesFrame(self)
        self.tidal_calculations_frame = GUI_helper.Find_Tidal_window_frame(self)
        self.tidal_graph_frame = GUI_helper.TidalWindowsGraphFrame(self)
        self.display_tidal_calculations_frame()#DEBUG
Example #6
0
 def load_connection_toplevel(self, title):
     '''gets called from 'edit connection' and 'add connection'''
     waypoints = self.routing_data.route_points
     self.top = GUI_helper.modify_connection_toplevel(self, title, waypoints)
     self.make_top_modal()