Exemplo n.º 1
0
    def graph_pop_up(self, k):
        self.clear_widgets()
        self.scrollable_numeric = ScrollView(size_hint=(.55, 0.9),
                                             pos_hint={
                                                 "right": 0.98,
                                                 "top": 0.95
                                             })
        show = GridLayout(cols=3, size_hint=(1, None))

        show.bind(minimum_height=show.setter('height'))
        self.test_functions()

        self.function_texts = []
        self.function_range = []

        for i in self.functions:

            btn = Button(text=str(i), size_hint_y=None)

            btn.bind(on_press=self.exec_function)
            show.add_widget(btn)

            temp = TextInput(text=self.get_function_name(str(i)),
                             size_hint_y=None,
                             foreground_color=(1, 1, 1, 1),
                             background_color=(0, 0, 0, 1))
            temp2 = TextInput(text="0,10,1",
                              size_hint_y=None,
                              foreground_color=(1, 1, 1, 1),
                              background_color=(0, 0, 0, 1))
            self.function_texts.append(temp)
            self.function_range.append(temp2)
            show.add_widget(temp)
            show.add_widget(temp2)
        btn = Button(text="Help",
                     size_hint=(.3, .2),
                     pos_hint={
                         "right": 0.42,
                         "top": .3
                     })

        btn.bind(on_press=self.graph_help)
        self.add_widget(btn)
        self.aimg2 = kvImage(pos_hint={
            "right": 0.42,
            "top": 0.92
        },
                             allow_stretch=True,
                             keep_ratio=True,
                             size_hint_y=.6,
                             size_hint_x=.4)
        self.add_widget(self.aimg2)

        btn2 = Button(text="Back", size_hint_y=None)
        btn2.bind(on_press=lambda x: self.main_screen())

        self.scrollable_numeric.add_widget(show)
        show.add_widget(btn2)
        self.add_widget(self.scrollable_numeric)
Exemplo n.º 2
0
    def __init__(self):
        super().__init__()
        self.name = 'gallery'
        global path

        # default pic for gallery but change when new 1 is taken
        # google photos

        self.my_grid = GridLayout(cols=1, rows=2, spacing= 25, padding=5)
        self.my_grid1 = GridLayout(cols=2, rows=1, spacing= 25, padding=45)
        self.my_image1 = kvImage(source = '1.png')
        self.my_grid1.add_widget(self.my_image1)

        self.my_box2 = BoxLayout(orientation='vertical',size_hint=(.3,.3),spacing=5)
        self.my_image2 = ImageButton(source = '2.png',on_press = self.show_pic_2)
        self.my_box2.add_widget(self.my_image2)
        self.my_image3 = ImageButton(source = '3.png',on_press = self.show_pic_3)
        self.my_box2.add_widget(self.my_image3)
        self.my_image4 = kvImage(source = 'Logo.png')
        self.my_box2.add_widget(self.my_image4)

        self.my_grid1.add_widget(self.my_box2)
        self.my_grid.add_widget(self.my_grid1)
        self.add_widget(self.my_grid)

        self.my_box1 = BoxLayout(orientation='horizontal',size_hint=(.15,.15),spacing=25)
        self.bt_back = Button(text="back",size_hint=(.5,.5))
        self.bt_back.bind(on_press=self.on_click)
        self.my_box1.add_widget(self.bt_back)
        self.bt_send = Button(text="send",size_hint=(.5,.5))
        self.my_box1.add_widget(self.bt_send)
        self.textinput = TextInput(text='e-mail',size_hint=(.5,.5))
        self.my_box1.add_widget(self.textinput)
        #self.bt_print = Button(text="print",size_hint=(.5,.5))
        #self.my_box1.add_widget(self.bt_print)

        self.my_grid.add_widget(self.my_box1)
Exemplo n.º 3
0
    def main_recursive_analysis(self, k):
        self.clear_widgets()
        self.scrollable_numeric = ScrollView(size_hint=(.96, 0.45),
                                             pos_hint={
                                                 "right": 0.98,
                                                 "top": 0.48
                                             })
        show = GridLayout(cols=2, size_hint_y=None)
        show.bind(minimum_height=show.setter('height'))
        self.test_functions()

        self.function_texts = []

        for i in self.functions:

            btn = Button(
                text=str(i),
                size_hint_y=None,
                height=screensize[1] / 4,
            )

            btn.bind(on_press=self.recursive_function)
            show.add_widget(btn)

            self.function_texts.append(i)

        self.aimg2 = kvImage(pos_hint={
            "right": 0.95,
            "top": 0.96
        },
                             allow_stretch=True,
                             keep_ratio=True,
                             size_hint_y=.45,
                             size_hint_x=.9)
        self.add_widget(self.aimg2)

        btn2 = Button(
            text="Back",
            size_hint_y=None,
            height=screensize[1] / 4,
        )
        btn2.bind(on_press=lambda x: self.main_screen())

        self.scrollable_numeric.add_widget(show)
        show.add_widget(btn2)
        self.add_widget(self.scrollable_numeric)
Exemplo n.º 4
0
    def main_recursive_analysis(self, k):
        self.clear_widgets()
        self.scrollable_numeric = ScrollView(size_hint=(.55, 0.9),
                                             pos_hint={
                                                 "right": 0.98,
                                                 "top": 0.95
                                             })
        show = GridLayout(cols=2)
        self.test_functions()

        self.function_texts = []

        for i in self.functions:

            btn = Button(text=str(i), )

            btn.bind(on_press=self.recursive_function)
            show.add_widget(btn)

            self.function_texts.append(i)

        self.aimg2 = kvImage(pos_hint={
            "right": 0.42,
            "top": 0.92
        },
                             allow_stretch=True,
                             keep_ratio=True,
                             size_hint_y=.6,
                             size_hint_x=.4)
        self.add_widget(self.aimg2)

        btn2 = Button(text="Back", )
        btn2.bind(on_press=lambda x: self.main_screen())

        self.scrollable_numeric.add_widget(show)
        show.add_widget(btn2)
        self.add_widget(self.scrollable_numeric)
Exemplo n.º 5
0
    def main_analysis(self, k):

        self.clear_widgets()
        self.scrollable_dis = ScrollView(size_hint=(.55, 0.9),
                                         pos_hint={
                                             "right": 0.98,
                                             "top": 0.95
                                         })
        self.grid_widget_dis = GridLayout(cols=1, size_hint=(1, None))
        self.grid_widget_dis.bind(
            minimum_height=self.grid_widget_dis.setter('height'))

        self.scrollable_dis.add_widget(self.grid_widget_dis)
        self.add_widget(self.scrollable_dis)
        datatemp = self.get_instructions()
        for i in datatemp.split("\n"):
            self.grid_widget_dis.add_widget(
                TextInput(text=str(i),
                          size_hint_y=None,
                          readonly=True,
                          foreground_color=(1, 1, 1, 1),
                          background_color=(0, 0, 0, 1)))
        cmplx = self.get_loops()
        self.complexity_output = TextInput(text=str("O(n^" + str(cmplx) + ")"),
                                           foreground_color=(1, 1, 1, 1),
                                           background_color=(0, 0, 0, 1),
                                           font_size=20,
                                           size_hint=(0.1, 0.05),
                                           pos_hint={
                                               "right": 0.3,
                                               "top": 0.95
                                           })
        self.add_widget(self.complexity_output)
        x = list(range(0, 1000))
        y, x = zip(*[((i / 10)**float(cmplx), i / 10) for i in x])

        #print(cmplx)
        plt.plot(x, y)
        plt.ylabel("Time")

        plt.savefig("temp.png")

        plt.close()
        self.aimg = kvImage(pos_hint={
            "right": 0.42,
            "top": 0.92
        },
                            allow_stretch=True,
                            keep_ratio=True,
                            size_hint_y=.6,
                            size_hint_x=.4)
        self.aimg.source = "temp.png"
        self.aimg.reload()

        self.go_back_btn = Button(text="Back",
                                  size_hint=(.2, .1),
                                  pos_hint={
                                      "right": 0.25,
                                      "top": .2
                                  })

        self.go_back_btn.bind(on_press=lambda x: self.main_screen())
        self.add_widget(self.go_back_btn)
        self.add_widget(self.aimg)
Exemplo n.º 6
0
    def main_screen(self):
        self.main_grid = GridLayout(cols=1,
                                    size_hint=(.3, .7),
                                    pos_hint={
                                        "right": 0.32,
                                        "top": .75
                                    })
        self.clear_widgets()
        self.load_btn = Button(text="Load",
                               size_hint=(.3, .2),
                               pos_hint={
                                   "right": 0.32,
                                   "top": .75
                               })

        self.load_btn.bind(on_press=self.load_pop_up)

        self.main_grid.add_widget(self.load_btn)
        self.analysis_btn = Button(text="Analysis",
                                   size_hint=(.3, .2),
                                   pos_hint={
                                       "right": 0.32,
                                       "top": .53
                                   })
        self.analysis_btn.bind(on_press=self.main_analysis)

        self.main_grid.add_widget(self.analysis_btn)

        self.recursive_analysis_btn = Button(text="Recursive\nAnalysis",
                                             size_hint=(.3, .2),
                                             pos_hint={
                                                 "right": 0.32,
                                                 "top": .53
                                             })
        self.recursive_analysis_btn.bind(on_press=self.main_recursive_analysis)

        self.main_grid.add_widget(self.recursive_analysis_btn)

        self.graph_btn = Button(text="Function\nTest",
                                size_hint=(.3, .2),
                                pos_hint={
                                    "right": 0.32,
                                    "top": .31
                                })
        self.graph_btn.bind(on_press=self.graph_pop_up)

        self.main_grid.add_widget(self.graph_btn)

        self.terminal_btn = Button(text="Terminal",
                                   size_hint=(.3, .2),
                                   pos_hint={
                                       "right": 0.32,
                                       "top": .31
                                   })
        self.terminal_btn.bind(on_press=self.main_terminal)

        self.main_grid.add_widget(self.terminal_btn)

        self.add_widget(self.main_grid)
        try:
            g_logo_path = "https://github.com//weriko/complexityAnalysis/raw/master/Logo.PNG"

            self.logo_btn = AsyncImage(source=g_logo_path,
                                       size_hint=(.7, .2),
                                       pos_hint={
                                           "right": 0.75,
                                           "top": .98
                                       })
            self.add_widget(self.logo_btn)
        except:

            try:
                self.logo_btn = kvImage(pos_hint={
                    "right": 0.75,
                    "top": .98
                },
                                        allow_stretch=True,
                                        keep_ratio=True,
                                        size_hint=(.7, .2))

                self.logo_btn.source = "data/Logo.png"
                self.logo_btn.reload()
                self.add_widget(self.logo_btn)
            except Exception as e:
                print(e)

        self.dropdown_btn = Button(text="""
               __
               __  
               __
                                  """,
                                   font_size=30,
                                   size_hint=(.2, .2),
                                   background_color=(0, 0, 0, 0),
                                   pos_hint={
                                       "right": 0.95,
                                       "top": .98
                                   })
        self.add_widget(self.dropdown_btn)
        self.dropdown_btn.bind(on_press=self.help_pop_up)

        self.scrollable_code = ScrollView(size_hint=(.55, 0.64),
                                          pos_hint={
                                              "right": 0.95,
                                              "top": 0.75
                                          })
        self.grid_widget_code = GridLayout(cols=1, size_hint=(1, None))
        self.grid_widget_code.bind(
            minimum_height=self.grid_widget_code.setter('height'))

        self.scrollable_code.add_widget(self.grid_widget_code)
        self.add_widget(self.scrollable_code)

        try:
            if self.code:
                for i in self.code.split("\n"):
                    self.grid_widget_code.add_widget(
                        TextInput(text=str(i),
                                  size_hint_y=None,
                                  readonly=True,
                                  foreground_color=(1, 1, 1, 1),
                                  background_color=(0, 0, 0, 1)))
        except:
            pass