Ejemplo n.º 1
0
    def __init__(self, **kwargs):
        super(OptionPage, self).__init__(**kwargs)
        self.options = load_json('options.json')

        self.add_background()

        self.back_button = Button(
            text='Back',
            background_color=self.options['button_color'],
            height=40)

        self.options_grid = GridLayout(rows=2, cols=2, col_default_width=120)

        self.options_grid.add_widget(Label(text='Set Background Color'))
        color_entry = TextInput(text=' '.join(
            [str(int(elem * 100)) for elem in self.options['background']]),
                                height=30,
                                width=100,
                                size_hint_y=None,
                                size_hint_x=None)
        self.options_grid.add_widget(color_entry)

        self.options_grid.add_widget(Label(text='Set Button Color'))
        button_color_entry = TextInput(text=' '.join(
            [str(int(elem * 100)) for elem in self.options['background']]),
                                       height=30,
                                       width=100,
                                       size_hint_y=None,
                                       size_hint_x=None)
        self.options_grid.add_widget(button_color_entry)

        def apply(_):
            background_color = color_entry.text
            background_color = tuple(
                [float(t) / 100 for t in background_color.split(' ')])
            self.options['background'] = background_color

            button_color = button_color_entry.text
            button_color = tuple(
                [float(t) / 100 for t in button_color.split(' ')])
            self.options['button_color'] = button_color

            save_json('options.json', self.options)

        self.apply_button = Button(
            text='Apply',
            background_color=self.options['button_color'],
            height=40)
        self.apply_button.bind(on_press=apply)

        self.add_widget(self.options_grid)
        self.add_widget(self.back_button)
        self.add_widget(self.apply_button)

        with self.canvas:
            self.options = load_json('options.json')

            Callback(self.resize_widgets)
Ejemplo n.º 2
0
 def __init__(self, **kwargs):
     super(AddMaterialPage, self).__init__(**kwargs)
     self.rows = 1
     self.columns = 1
     self.add_background()
     self.options = load_json('options.json')
     self.back_button = Button(
         text='Back', background_color=self.options['button_color'])
     self.add_widget(self.back_button)
Ejemplo n.º 3
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.parts = {}
        self.options = load_json('options.json')
        self.add_background()  # add background

        self.back_button = Button(
            text='go back',
            size=self.center,
            pos=(400, 400),
            background_color=self.options['button_color'])

        # Any changes to this list must be reflected in self.update_grid
        self.column_labels = [
            'Part Name', 'Material', 'Print vol', 'Part Thickness',
            'Infill Amt', 'Print Time', 'Final Cost'
        ]

        # TODO load materials from options
        self.materials = {
            'ASA': {
                'price': 30,
                'density': 1.5
            },
            'PLA': {
                'price': 30,
                'density': 1
            },
            'ULTEM': {
                'price': 530,
                'density': 1
            }
        }

        # self.reset_all()

        with self.canvas:
            print('updating totals')
            Callback(self.update_totals)
Ejemplo n.º 4
0
    def __init__(self, **kwargs):
        super(QueryPage, self).__init__(**kwargs)

        self.options = load_json('options.json')
        # setup vars
        self.parts = []

        self.add_background()

        # Define widgets
        self.entry = TextInput(height=27,
                               text='/Users/goldwin/PycharmProjects/FDM_APP/')
        self.label = Label(text='Enter a path to your .stl files here')
        self.go_button = Button(text='GO!',
                                height=25,
                                background_color=self.options['button_color'])
        self.option_page = Button(
            text='Set Options',
            height=40,
            width=40,
            background_color=self.options['button_color'])
        self.add_printer_page = Button(
            text='Add Printer', background_color=self.options['button_color'])
        self.add_material_page = Button(
            text='Add Material', background_color=self.options['button_color'])

        self.option_grid = GridLayout(rows=3, cols=1)
        self.option_grid.add_widget(self.option_page)
        self.option_grid.add_widget(self.add_printer_page)
        self.option_grid.add_widget(self.add_material_page)
        # set dynamic canvas options
        with self.canvas:
            Callback(self.resize_widgets)

        # Add widgets to self
        self.add_widget(self.go_button)
        self.add_widget(self.entry)
        self.add_widget(self.label)
        self.add_widget(self.option_grid)