Ejemplo n.º 1
0
    def __init__(self, parent):
        self.container = Frame(parent)
        self.container.pack()

        # widgets
        self._init_menubar()
        self.interface_panel = InterfacePanel(self.container)
        self.configuration_panel = ConfigurationPanel(self.container)

        # visualization
        self.interface_panel.display()
        self.configuration_panel.forget()

        # actions
        action = RiverModelAction(self)
        # actions for current panel
        self.mb_interface.bind("<Button-1>",action.OnMBInterface)
        self.mb_configuration.bind("<Button-1>",action.OnMBConfig)

        # actions for interface panel
        self.interface_panel.go_button.bind("<Button-1>", action.OnGo)
Ejemplo n.º 2
0
        "ok" : 20}


def button_up(name, duration):
    print("Duration for '{}' was {} seconds".format(name, duration))


def button_callback(name):
    if name in ["back", "forward"]:
        print("Button '{}' down....".format(name))
        return button_up
    else:
        print("Button '{}' pressed.".format(name))
        return None


def rotation_callback(pos, dir):
    dir = "<--" if dir < 0 else "-->"
    print("{} Pos: {}".format(dir, pos))


with InterfacePanel() as panel:
    panel.add_rotary_encoder("Wheel", rotation_callback, *rotary_encoder)
    for name, pin in buttons.iteritems():
        panel.add_button(name, button_callback, pin)

    sleep(60)


print("Times up! Exiting...")
Ejemplo n.º 3
0
def rotation_callback(position, direction):
    show_on_oled(myargs.list, position, display)


def button_callback(name):
    a = 1
    # if name in ["back", "forward"]:
    #     print("Button '{}' down....".format(name))
    #     return button_up
    # else:
    #     print("Button '{}' pressed.".format(name))
    #     return None


panel = InterfacePanel()

panel.add_rotary_encoder("Wheel", rotation_callback, *rotary_encoder)
for name, pin in buttons.items():
    panel.add_button(name, button_callback, pin)

# itemlist = ['Wohnzimmer', 'Küche', 'Schlafzimmer', 'Flur', 'Schreibtisch', 'Spielecke']

try:

    show_on_oled(myargs.list, 0, disp=display)
    print('waiting 60s 4 callback...')
    sleep(60)
    print('...time is up!')

except KeyboardInterrupt:  # Ctrl-C to terminate the program
Ejemplo n.º 4
0
class RiverModel:
    def __init__(self, parent):
        self.container = Frame(parent)
        self.container.pack()

        # widgets
        self._init_menubar()
        self.interface_panel = InterfacePanel(self.container)
        self.configuration_panel = ConfigurationPanel(self.container)

        # visualization
        self.interface_panel.display()
        self.configuration_panel.forget()

        # actions
        action = RiverModelAction(self)
        # actions for current panel
        self.mb_interface.bind("<Button-1>",action.OnMBInterface)
        self.mb_configuration.bind("<Button-1>",action.OnMBConfig)

        # actions for interface panel
        self.interface_panel.go_button.bind("<Button-1>", action.OnGo)

        # actions for configuration panel


    #######################################
    #       Components Declaration        #
    #######################################
    def _init_menubar(self):
        self.menubar = Frame(self.container,relief=RAISED,borderwidth=1)
        self.menubar.pack()

        self.mb_interface = Button(self.menubar,text='Interface')
        self.mb_interface.pack(side=LEFT)

        self.mb_configuration = Button(self.menubar,text='Configuration')
        self.mb_configuration.pack(side=LEFT)


    #######################################
    #       Getters                       #
    #######################################
    def get_output_frequency(self):
        return self.configuration_panel.get_output_frequency()
    
    def get_days_to_run(self):
        return self.configuration_panel.get_days_to_run()

    def get_which_stock(self):
        return self.configuration_panel.get_which_stock()

    def get_tss_value(self):
        return self.configuration_panel.get_tss_value()

    def get_macro_base_temp(self):
        return self.configuration_panel.get_macro_base_temp()

    def get_gross_macro_coef(self):
        return self.configuration_panel.get_gross_macro_coef()

    def get_resp_macro_coef(self):
        return self.configuration_panel.get_resp_macro_coef()

    def get_sen_macro_coef(self):
        return self.configuration_panel.get_sen_macro_coef()

    def get_macro_mass_max(self):
        return self.configuration_panel.get_macro_mass_max()
    
    def get_macro_vel_max(self):
        return self.configuration_panel.get_macro_vel_max()

    def get_k_phyto(self):
        return self.configuration_panel.get_k_phyto()

    def get_k_macro(self):
        return self.configuration_panel.get_k_macro()

    def get_flow_corners(self):
        return self.configuration_panel.get_fixed_corners()

    def get_filenames(self):
        return self.configuration_panel.filenames

    def get_parfile(self):
        return self.configuration_panel.parfile

    def get_tempfile(self):
        return self.configuration_panel.tempfile

    def get_daystorunarray(self):
        return self.configuration_panel.daystorunarray

    def get_timestep(self):
        return self.configuration_panel.get_timestep()