Пример #1
0
def buildRuleView(rule, *args):
    main_layout = FloatLayout()

    header = Label(text=rule.getName(),
                   pos_hint={
                       'center_x': .5,
                       'top': 1
                   },
                   size_hint=(.2, .1),
                   font_size="30sp",
                   bold=True,
                   color=rgba('#0a5e00'))

    body = WrappedLabel(text=rule.getText(),
                        font_size="20sp",
                        pos_hint={
                            'center_x': .5,
                            'center_y': .5
                        },
                        size_hint=(.9, .9))

    main_layout.add_widget(header)
    main_layout.add_widget(body)

    rule_view = ModalView(size_hint=(.92, .98),
                          background="Resources/262626.png",
                          background_color=rgba('#0a5e00'))
    rule_view.add_widget(main_layout)
    rule_view.open()
Пример #2
0
 def reset_data(self, *args):
     self.root.ids.pg1_icon.text_color = rgba(17, 20, 219, 255)
     self.root.ids.pg1_back.text_color = [1, 1, 1, 1]
     self.root.ids.pg1_icon.icon = 'numeric-1-circle'
     self.root.ids.pg2_icon.text_color = rgba(17, 20, 219, 255)
     self.root.ids.pg2_back.text_color = [1, 1, 1, 1]
     self.root.ids.pg2_icon.icon = 'numeric-2-circle'
     self.root.ids.pg3_icon.text_color = rgba(17, 20, 219, 255)
     self.root.ids.pg3_back.text_color = [1, 1, 1, 1]
     self.root.ids.pg3_icon.icon = 'numeric-3-circle'
     self.root.ids.pg4_icon.text_color = rgba(17, 20, 219, 255)
     self.root.ids.pg4_back.text_color = [1, 1, 1, 1]
     self.root.ids.pg4_icon.icon = 'numeric-4-circle'
     self.root.ids.pg5_icon.text_color = rgba(17, 20, 219, 255)
     self.root.ids.pg5_back.text_color = [1, 1, 1, 1]
     self.root.ids.pg5_icon.icon = 'numeric-5-circle'
     self.root.ids.opt1_icon.text_color = [1, 1, 1, 1]
     self.root.ids.opt2_icon.text_color = [1, 1, 1, 1]
     self.root.ids.opt3_icon.text_color = [1, 1, 1, 1]
     self.root.ids.opt4_icon.text_color = [1, 1, 1, 1]
     self.root.ids.opt1_icon.icon = 'alpha-a-circle-outline'
     self.root.ids.opt2_icon.icon = 'alpha-b-circle-outline'
     self.root.ids.opt3_icon.icon = 'alpha-c-circle-outline'
     self.root.ids.opt4_icon.icon = 'alpha-d-circle-outline'
     self.callback('Home')
     self.root.ids.progress.value = 0
     self.root.ids.next_qn.text = 'Next'
     self.root.ids.result_recycler.data = []
     self.skipped = ''
Пример #3
0
    def __init__(self, **kwargs):
        super(TopicCard, self).__init__(**kwargs)

        # print('< ', self.favorite_topic, self.topic, ' >')
        if os.path.exists('favorite.json'):
            if self.favorite_topic == True:
                # print('< ', self.favorite_topic, self.topic, ' >')
                self.iconButton = MDIconButton(id='stars',
                                               icon='star',
                                               theme_text_color='Custom',
                                               text_color=rgba('#E91E63'))
                self.iconButton.text_color = rgba('#E91E63')
            else:
                self.iconButton = MDIconButton(id='stars',
                                               icon='star',
                                               theme_text_color='Custom',
                                               text_color=rgba('#000000'))

        else:
            self.iconButton = MDIconButton(id='stars',
                                           icon='star',
                                           theme_text_color='Custom',
                                           text_color=rgba('#000000'))

        self.add_widget(self.iconButton)
        self.iconButton.bind(
            on_release=lambda x: self.favorite(self.id, self.topic))
Пример #4
0
    def __init__(self, short_text='File Browser'):

        try:
            f = open('./Appdata/config.txt')
            lines = f.readlines()
            video_input_path = lines[0]
            video_input_path = video_input_path[:-1]
            video_input_path = os.path.abspath(video_input_path)
            video_output_path = lines[1]
            video_output_path = video_output_path[:-1]
            video_output_path = os.path.abspath(video_output_path)
            f.close()

        except:
            video_input_path = './Appdata/InputVideos/'
            video_output_path = './Appdata/output/'

        browser = FileBrowser(select_string='Select',
                              cancel_state='down',
                              favorites=[(video_input_path, "Input Folder"),
                                         (video_output_path, "Output Folder")])
        browser.bind(
            on_success=self._fbrowser_success,
            on_canceled=self._fbrowser_canceled,
        )

        self.popup = Popup(title=short_text,
                           content=browser,
                           size_hint=(0.7, 0.7),
                           auto_dismiss=False,
                           background_color=rgba('#2f323a'),
                           separator_color=rgba('#DAA520'),
                           title_color=rgba('#DAA520'))
Пример #5
0
    def Batch_Loop(self, feature_path, full_path, snippet_path, batch_size,
                   gpu_flag, videos_in_folder, video_count):

        current_video = 0
        self.popup.content = Label(text='Processing Video..(' +
                                   str(current_video) + '/' +
                                   str(video_count) + ')',
                                   color=rgba('#DAA520'),
                                   font_size=20)
        for video in videos_in_folder:
            if '_noext' not in video:
                current_video = current_video + 1
                self.popup.content = Label(text='Processing Video..(' +
                                           str(current_video) + '/' +
                                           str(video_count) + ')',
                                           color=rgba('#DAA520'),
                                           font_size=20)
                path = full_path + '/' + video
                feature_extractor.feature_extractor(feature_path, path,
                                                    snippet_path, batch_size,
                                                    gpu_flag)

        self.popup.content = Label(
            text='Anomalous Snippets of Videos saved in the output folder',
            color=rgba('#DAA520'),
            font_size=20)
        Clock.schedule_once(partial(self.dismisspopup), 1)
        mainmenu = App.get_running_app().root.get_screen('MainMenu')
        mainmenu.ids.videoplayer.state = 'play'
Пример #6
0
    def favorite(self, id, topic):
        store = JsonStore('favorite.json')
        for x in store:
            self.s.append(store.get(x).get('id'))

        if id in self.s:
            try:
                store.delete(topic)
                self.iconButton.text_color = rgba('#000000')
                print('Removed')
                if len(store) == 0:
                    os.remove('favorite.json')
                    MDApp.get_running_app(
                    ).root.ids.main.ids.main_star.text_color = 0, 0, 0, 0
                    print('<<<< File was removed >>>')

            except KeyError as keyerr:
                print('>>>>> Error <<<<<: ', keyerr)
                store.put(topic, id=id)
                self.iconButton.text_color = rgba('#E91E63')
                MDApp.get_running_app(
                ).root.ids.main.ids.main_star.text_color = 1, 1, 1, 1

            except FileNotFoundError as fileerr:
                print('<<< Error>>> : ', fileerr)
        else:
            store.put(topic, id=id)
            self.iconButton.text_color = rgba('#E91E63')
            print('Added to favorite')
            if len(store) == 1:
                MDApp.get_running_app(
                ).root.ids.main.ids.main_star.text_color = 1, 1, 1, 1

        self.s = []
Пример #7
0
    def on_pre_enter(self, *args):

        self.product_title = self.manager.PRODUCT_TITLE

        self.update_sites(self.manager.DF_STR)

        def shorten(url):
            url = url.replace('https://', '').replace('http://', '')
            domains = ['.com', '.co.uk', '.fr', '.net', '.co.nz', '.org', '.co.il', 'tv']
            for domain in domains:
                if domain in url:
                    cut_url = url[:url.index(domain) + len(domain)]
                    return cut_url

            return url

        self.ids.grid.clear_widgets()

        product = self.manager.PRODUCTS[self.manager.PRODUCT_TITLE]

        hex_colors = cycle(['ff9999', 'ffc99', 'ffff99', 'ccff99', '99ff99', '99ffcc',
                            '99ffff', '99ccff', '9999ff', 'cc99ff', 'ff99ff', 'ff99cc'])

        if self.manager.DF_STR == 'Top Rated':
            i = 0

            if product.num_sites < 5:
                self.ids.top_edge.opacity = 0
                self.ids.bottom_edge.opacity = 0
            else:
                self.ids.top_edge.opacity = 1
                self.ids.bottom_edge.opacity = 1

            for i in range(0, product.num_sites):
                button = Button(text=shorten(product.sites[i]), font_name='Ubuntu-C.ttf', background_normal='website.png',
                                background_down='website_dark.png', background_color=rgba(f"#{next(hex_colors)}"),
                                font_size=80, color=[0, 0, 0, 1], size=(940,180), size_hint=(None, None), halign='center')
                button.bind(on_release=partial(self.start_second_thread, i))
                i += 1
                self.ids.grid.add_widget(button)

        elif self.manager.DF_STR == 'Most Mentioned':
            i = 0

            if len(product.sites_occurrence) < 5:
                self.ids.top_edge.opacity = 0
                self.ids.bottom_edge.opacity = 0
            else:
                self.ids.top_edge.opacity = 1
                self.ids.bottom_edge.opacity = 1

            for i in range(0, len(product.sites_occurrence)):
                button = Button(text=shorten(product.sites_occurrence[i]), font_name='Ubuntu-C.ttf', background_normal='website.png',
                                background_down='website_dark.png', background_color=rgba(f"#{next(hex_colors)}"),
                                font_size=80, color=[0, 0, 0, 1], size=(940, 180), size_hint=(None, None), halign='center')

                button.bind(on_release=partial(self.start_second_thread, i))
                i += 1
                self.ids.grid.add_widget(button)
Пример #8
0
    def SaveSnippet(self):
        '''
        Desc: Called when the save snippet button is clicked.
        1) If no Snippets are selected, Show popup and wait for selection.

        else

        2) concatenate the snippets and save them in the output directory
        3) clear the snippet lists and populate it with the new snippets

        '''

        self.popup.content = Label(text='Saving Snippets',
                                   color=rgba('#DAA520'),
                                   font_size=24)
        self.ids.videoplayer.state = 'stop'
        try:
            f = open('./Appdata/config.txt')
            lines = f.readlines()
            f.close()
            video_output_path = lines[1]
            video_output_path = video_output_path[:-1]
            output_path = video_output_path
        except:
            output_path = 'Appdata/output/'
        vidname = os.path.basename(path)
        list_path = 'Appdata/temp/snip/'

        if not self.SnippetList:
            self.popup.content = Label(text='Please add Snippets to save',
                                       color=rgba('#DAA520'),
                                       font_size=24)
            self.popup.open()
            Clock.schedule_once(partial(self.dismisspopup), 1)

        else:
            self.popup.open()
            with open('Appdata/temp/snip/snippets.txt', 'w') as file:
                for element in self.SnippetList:
                    file.writelines('file ' + '\'' + element + "\'\n")
                file.close()
            os.system(
                "ffmpeg -f concat -i {}snippets.txt -codec copy {}/{}_anomalous.mp4"
                .format(list_path, output_path, vidname))
            self.dismisspopup()
            self.SnippetList = []
            self.ids.plot_image.opacity = 0
            self.ids.Snippets.remove_widget(self.SS)
            self.SS = ScrollScreen()
            self.ids.videoplayer.source = '.\\Appdata\\Eyespy_noext.mp4'
            self.ids.videoplayer.state = 'play'
Пример #9
0
    def switch_qn(self, *args):
        index = self.qn_no
        try:
            self.confirm_skip.dismiss()
        except:
            pass

        if index != 4:
            self.get_ans(index + 1)
            self.root.ids.progress.value += 25
            self.get_response('', '')

            if index == 0:
                self.root.ids.pg1_icon.text_color = rgba(11, 158, 11, 255)
                self.root.ids.pg1_icon.icon = 'checkbox-marked-circle'
            elif index == 1:
                self.root.ids.pg2_icon.text_color = rgba(11, 158, 11, 255)
                self.root.ids.pg2_icon.icon = 'checkbox-marked-circle'
            elif index == 2:
                self.root.ids.pg3_icon.text_color = rgba(11, 158, 11, 255)
                self.root.ids.pg3_icon.icon = 'checkbox-marked-circle'
            elif index == 3:
                self.root.ids.pg4_icon.text_color = rgba(11, 158, 11, 255)
                self.root.ids.pg4_icon.icon = 'checkbox-marked-circle'
                self.root.ids.next_qn.text = 'Submit'

            if self.ans[index] == 'None':
                if index == 0:
                    self.root.ids.pg1_icon.text_color = [1, 1, 1, 1]
                    self.root.ids.pg1_back.text_color = rgba(11, 158, 11, 255)
                    self.root.ids.pg1_icon.icon = 'fast-forward'
                if index == 1:
                    self.root.ids.pg2_icon.text_color = [1, 1, 1, 1]
                    self.root.ids.pg2_back.text_color = rgba(11, 158, 11, 255)
                    self.root.ids.pg2_icon.icon = 'fast-forward'
                if index == 2:
                    self.root.ids.pg3_icon.text_color = [1, 1, 1, 1]
                    self.root.ids.pg3_back.text_color = rgba(11, 158, 11, 255)
                    self.root.ids.pg3_icon.icon = 'fast-forward'
                if index == 3:
                    self.root.ids.pg4_icon.text_color = [1, 1, 1, 1]
                    self.root.ids.pg4_back.text_color = rgba(11, 158, 11, 255)
                    self.root.ids.pg4_icon.icon = 'fast-forward'

        elif index == 4:
            if self.ans[4] == 'None':
                self.root.ids.pg5_icon.text_color = [1, 1, 1, 1]
                self.root.ids.pg5_back.text_color = rgba(11, 158, 11, 255)
                self.root.ids.pg5_icon.icon = 'fast-forward'
                self.end_load.open()
                self.save_response()
            else:
                self.root.ids.pg5_icon.text_color = [0, 1, 0, 1]
                self.root.ids.pg5_icon.icon = 'checkbox-marked-circle'
                self.end_load.open()
                self.save_response()
Пример #10
0
def get_color(type, name):
    """Retrieves a specific color.

    Args:
        type (str): Color type (light/dark).
        name (str): Color name.

    Returns:
        str: The chosen color in RGBA format.
    """

    if type == 'light':
        return rgba(LIGHT_COLOR_DCT[name])
    return rgba(DARK_COLOR_DCT[name])
Пример #11
0
    def application_look_settings(self, instance):
        clear_selected_item_button_color_values = ["#70af85", "#70af85"]
        delete_button_color_values = ["#f05454", "#f05454"]
        workspace_boundary_color_values = ["#30475e", "#D6ED17FF"]
        left_tray_buttons_color_values = ["#00bcd4", "#f88f01"]
        left_tray_color_values = ["#282828", "#00af91"]
        bar_color_values = ["#282828", "#D6ED17FF"]
        upper_utility_tray_boundary_color_values = ["#00af91", "#D6ED17FF"]
        if self.mode == 0:
            self.mode += 1
        else:
            self.mode -= 1
        if self.mode == 0:
            self.theme_cls.theme_style = "Light"
            try:
                instance.theme_text_color = "Primary"
            except:
                pass
        else:
            self.theme_cls.theme_style = "Dark"
            self.upper_utilitytray_color = rgba(
                upper_utility_tray_boundary_color_values[
                    self.mode])  # correct here allso
            try:
                instance.theme_text_color = "Custom"
                instance.text_color = self.upper_utilitytray_color
            except:
                pass
        self.clear_selected_item_button_color = clear_selected_item_button_color_values[
            self.mode]
        self.delete_button_color = delete_button_color_values[self.mode]

        self.buildersccreen.openbutton.md_bg_color = rgba(
            left_tray_buttons_color_values[self.mode])
        self.buildersccreen.savebutton.md_bg_color = rgba(
            left_tray_buttons_color_values[self.mode])
        self.buildersccreen.addwiresbutton.md_bg_color = rgba(
            left_tray_buttons_color_values[self.mode])
        self.buildersccreen.sensorsbutton.md_bg_color = rgba(
            left_tray_buttons_color_values[self.mode])
        self.buildersccreen.basiceqbutton.md_bg_color = rgba(
            left_tray_buttons_color_values[self.mode])
        self.left_tray_color = rgba(left_tray_color_values[self.mode])
        self.bar_color = rgba(bar_color_values[self.mode])
        self.upper_utilitytray_color = rgba(
            upper_utility_tray_boundary_color_values[
                self.mode])  # correctt here
        self.workspace_boundary_color = rgba(
            workspace_boundary_color_values[self.mode])
 def update_tile_data(self):
     tile_data = []
     for row in range(self.maze_size):
         for col in range(self.maze_size):
             new_tile = {'coords': [col, row], 'tile': self._generated_data[row][col], 'update_callback': self.update_marker_list, 'current_marker': 'None'}
             if tuple(new_tile['coords']) in self.path_nodes:
                 new_tile['color'] = rgba(PATH_COLOR)
             for marker_name, marker_list in self.marker_lists.items():
                 if tuple(new_tile['coords']) in marker_list:
                     new_tile['current_marker'] = marker_name
                     new_tile['color'] = rgba(MARKERS[marker_name])
             if 'color' not in new_tile:
                 new_tile['color'] = rgba('#FFFFFF')
             tile_data.append(new_tile)
     self.tile_data = tile_data
    def change_marker(self):
        markers = ['None'] + list(MARKERS.keys())
        current_index = markers.index(self.current_marker)
        if current_index == len(markers) - 1:
            next_marker = 'None'
        else:
            next_marker = markers[current_index + 1]

        self.update_callback(self.current_marker, next_marker, self.coords)

        self.current_marker = next_marker
        if next_marker == 'None':
            self.color = rgba('#FFFFFF')
        else:
            self.color = rgba(MARKERS[next_marker])
Пример #14
0
    def get_time(self):
        mv = ModalView(size_hint=[.8, .6])
        box = BoxLayout(orientation='vertical', size_hint=[.5, .5])
        mv.add_widget(box)

        cl = CTP(color=[1, 1, 1, 1])
        cl.bind(time=self.set_time)

        submit = Button(text='OK', background_normal='',
                        background_color=rgba('#ffffff'), color=rgba('#0e1574ff'), size_hint_y=.2)

        submit.bind(on_release=lambda x: self.update_time(cl.time, mv))
        box.add_widget(cl)
        box.add_widget(submit)
        mv.open()
Пример #15
0
    def filebrowse(self):
        '''
        Desc: Called When Add Video Button is Pressed, works:
        1) Clear Widget Scrollscreen
        2) Clear Temp folder
        3) Create New Temp Directories
        4) Open FileBrowser

        '''

        self.SnippetList = []
        self.ids.plot_image.opacity = 0
        self.ids.Snippets.remove_widget(self.SS)
        self.SS = ScrollScreen()
        self.ids.videoplayer.source = ''
        if os.path.exists('./Appdata/temp'):
            shutil.rmtree("./Appdata/temp/")

        os.makedirs('./Appdata/temp')
        os.makedirs('./Appdata/temp/snip')
        os.makedirs('./Appdata/temp/frames')
        os.makedirs('./Appdata/temp/textfeatures')
        os.makedirs('./Appdata/temp/plot')
        self.popup.content = Label(text='Features are being extracted..(1/3)',
                                   color=rgba('#DAA520'),
                                   font_size=24)
        self.file_popup.start()
Пример #16
0
class OneUIVerticalBar(RelativeLayout):
    x_width = NumericProperty(80)
    state = StringProperty("open")
    border_radius = ListProperty([0, 0, 0, 0])
    back_color = ListProperty(rgba(OneUIColors.SaveButton.value))

    def __init__(self, **kwargs):
        super(OneUIVerticalBar, self).__init__(**kwargs)
        self.size_hint_x = None
        self.width = dp(self.x_width)

    def set_state(self, state: str):
        if state == "close":
            self.__close()
        elif state == "open":
            self.__open()
        elif state == "toggle":
            self.__toggle()

    def __toggle(self):
        if self.state == "open":
            self.__close()
        else:
            self.__open()

    def __close(self):
        self.state = "close"
        self.width = dp(0)

    def __open(self):
        self.state = "open"
        self.width = dp(self.x_width)
Пример #17
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     btn3 = Button(text='view',background_color=rgba('#0088aafd'),size_hint =(.4, .4),
             pos_hint ={'x':.2, 'y':.2})
     btn3.bind(on_press=lambda x: self.view_tasks())
     # self.bind(on_release=lambda x: self.view_task())
     self.add_widget(btn3)
Пример #18
0
    def signin(self):

        # print ( self.data )

        if (len(self.ids.username.text) == 0):
            toast("Username need to be entered")
            self.logged = False
        else:
            if (len(self.ids.password.text) == 0):
                toast("Password need to be entered")
                self.logged = False
            else:
                for user in self.data['users']:
                    if (user['username'] == self.ids.username.text):
                        if (user['password'] == self.ids.password.text):
                            self.logged = True
                            break
                        else:
                            self.logged = False
                    else:
                        self.logged = False

        if (self.logged):
            self.ids.result.text = "Successfuly logged in"
            self.ids.result.theme_text_color = 'Custom'
            self.ids.result.text_color = rgba(0, 255, 0, 255)
            self.sound_success.play()
            if Hardware_data:
                self.act5.LoggedIn()
        else:
            self.ids.result.text = "Wrog password or username"
            self.ids.result.theme_text_color = 'Error'
            self.sound_wrong.play()
            if Hardware_data:
                self.act5.WrogLogIn()
 def refresh_marker_list(self):
     marker_data = []
     for marker_name, marker_color in MARKERS.items():
         if marker_name == 'Entrance' or marker_name == 'Exit':
             continue
         marker_data.append({'marker_name': marker_name, 'marker_color': rgba(marker_color), 'marker_count': str(len(self.marker_lists[marker_name]))})
     self.parent.ids.marker_list.data = marker_data
Пример #20
0
    def on_medium_toggle_btn_press(self, medium):
        """Signals communication component to start/stop transmitting the given medium.
        
        Args:
            medium (str): Medium to start/stop transmitting (audio/video).
        """

        app = App.get_running_app()
        username = app.root_sm.current_screen.username

        state = self.ids[medium].state

        app.send_gui_evt({
            'type': 'session',
            'subtype': 'control',
            'mode': 'self_state',
            'src': username,
            'medium': medium,
            'state': state
        })

        # Changing button color accordingly
        if state == 'down':
            self.ids[medium].background_color = rgba(design.GRAY)
        else:
            if medium == 'audio':
                self.ids[medium].background_color = design.get_color(
                    'dark', 'orange')
            else:
                self.ids[medium].background_color = design.get_color(
                    'dark', 'purple')
Пример #21
0
 def on_tab_switch(
     self,
     instance_tab_manager,
     instance_android_tabs,
     instance_tab_label,
     tab_label_text,
 ):
     if not tab_label_text:
         tab_label_text = "Red"
     if not instance_android_tabs.rv.data:
         for hue in _colors[tab_label_text]:
             color = _colors[tab_label_text][hue]
             if tab_label_text == "Light":
                 text_color = (0, 0, 0, 1)
             elif tab_label_text == "Dark":
                 text_color = (1, 1, 1, 1)
             else:
                 text_color = text_colors[tab_label_text][hue]
             color_widget = {
                 "rgba_color": rgba(color),
                 "hex_value": color,
                 "hue_code": hue,
                 "text_color": text_color,
             }
             instance_android_tabs.rv.data.append(color_widget)
Пример #22
0
    def update_color_sheme(self, new_color_scheme):
        """
        Callback that processes a new value for color_scheme
        :param new_color_scheme:
        :return:
        """

        try:
            if new_color_scheme is not None:
                for note_name, color_list in new_color_scheme.items():

                    note_number = MTCU.note_name_to_number(note_name)
                    condensed_note_number = MTCU.condense_note_pitch(
                        note_number)

                    if (0 <= condensed_note_number <
                            MTCU.AMOUNT_DISTINCT_NOTES):
                        # Store the color in the MusicTheoryCoreUtils:
                        MTCU.NOTE_COLORS[condensed_note_number] = rgba(
                            color_list)

                return new_color_scheme
            else:
                return None

        except:
            # Silent fail results in returning None, so the original value is not modified.
            return None
Пример #23
0
 def on_touch_down(self, touch):
     if self.collide_point(*touch.pos):
         self.color = utils.rgba('#171717')
         audio = self.app.sound.source
         self.app.content.load_recommendation(audio)
         self.dropdown.dismiss()
         return True
Пример #24
0
    def set_master_colour(self, value):

        """ This function is 'continued' in concentricshapes """

        if all((True if type(x) == str else False for x in value)):
            colour_attribute_for_master_colour = ''.join(value)
        else:
            colour_attribute_for_master_colour = None

        if colour_attribute_for_master_colour:

            if colour_attribute_for_master_colour[0] == '#':
                self._master_colour = rgba(colour_attribute_for_master_colour)
            elif hasattr(self, colour_attribute_for_master_colour):
                self.pseudo_bind_master_colour_attribute = colour_attribute_for_master_colour
            else:
                raise Exception("{} doesnt start with a '#' to denote its an rgba value"
                                ", nor is the value found as an attribute of this class {}".format(value, self))
        elif type(value) in (list, tuple, ColorProperty):
            self._master_colour = tuple(value)
            self.pseudo_bind_master_colour_attribute = None

        elif issubclass(type(value), list):
            self._master_colour = tuple(value)
            self.pseudo_bind_master_colour_attribute = None

        else:
            raise Exception("Couldn't set value {} as master colour")

        """ This function is 'continued' in concentricshapes """

        self.do_colour_update()
Пример #25
0
def buildRules(rules, widget):
    #starting position
    top_lbl_id = .8

    for rule in rules:
        #spacing in between rows
        top_lbl_id -= 1.2

        row = FloatLayout(size_hint_y=None, height=50)
        lbl_id = Label(text=str(rule.getId()),
                       font_size="20sp",
                       size_hint_y=None,
                       pos_hint={
                           "center_x": .1,
                           "top": top_lbl_id
                       },
                       height=100,
                       color=rgba('#0a5e00'))

        lbl_name = Label(text=rule.getName(),
                         font_size="20sp",
                         size_hint_y=None,
                         size_hint_x=.6,
                         pos_hint={
                             "x": .2,
                             "top": top_lbl_id
                         },
                         height=100,
                         halign="left")

        btn = Button(text="",
                     size_hint_y=None,
                     pos_hint={
                         "x": 0,
                         "top": top_lbl_id
                     },
                     height=100,
                     background_normal="",
                     background_color=rgba('#262626'))

        btn.bind(on_press=partial(buildRuleView, rule))

        row.add_widget(btn)
        row.add_widget(lbl_id)
        row.add_widget(lbl_name)

        widget.add_widget(row)
    def __init__(self, **kwargs):

        super(PairedDevicesPopup, self).__init__(**kwargs)

        self.background_colour = rgba('#434359')

        self.devices_scroll_view = None
        self.devices_grid_layout = None
    def set_secondary_colours(self, wid, colour):

        if not colour and self.shape_colour_list:
            self.master_colour = self.inner_shape

        if colour and self.shape_list:

            if type(colour) == str:
                colour = rgba(colour)

            shape_dictionary = self.shape_dictionary
            min_size_hint = min(self.shape_size_hint_list)
            for shape in shape_dictionary:
                base_colour = colour
                # if i:
                colour_size_hint = shape['shape_size_hint']
                # else:
                #     colour_size_hint = 1

                auto_colour = self.set_colour_by_size_hint(
                    base_colour, colour_size_hint, min_size_hint)

                shape['shape_colour'] = auto_colour

            self.shape_dictionary = shape_dictionary

            #self.get_shape_dictionary()

            # if len(shape_dictionary) > 2:
            #     n = 1
            # else:
            #     n = 0

            n = 0

            if self.needs_text_colour:
                #if True:
                #  not my favourite bit of code, but as colour property will fill in as [1, 1, 1, 1], what else can i do
                self.text_colour = shape_dictionary[n]['shape_colour']
            if self.needs_trim_colour:
                #if True:
                self.trim_colour = shape_dictionary[n]['shape_colour']

                self.set_image_colour(self, self.trim_colour)

                #self.set_image_colour(self.trim_colour)
            # else:
            #     self.shape_dictionary[n]['shape_colour'] = self.trim_colour
            #     print('setting it!!!!!!!!!!!!!!!!!!!!! asdfasdfsadf')

        # for shape, colour in zip(self.shape_list, self.shape_colour_list):
        #     shape.update_colour(colour)

        # for colour_instruction, colour in zip(self.colour_instruction_list, self.shape_colour_list):
        #     colour_instruction.rgba = colour

        return
 def build(self):
     floor_configurator = Builder.load_string(kv_string)
     marker_data = []
     for marker_name, marker_color in MARKERS.items():
         if marker_name == 'Entrance' or marker_name == 'Exit':
             continue
         marker_data.append({'marker_name': marker_name, 'marker_color': rgba(marker_color), 'marker_count': str(0)})
     floor_configurator.ids.marker_list.data = marker_data
     return floor_configurator
Пример #29
0
 def __init__(self, **kwargs):
     super().__init__()
     self.note = kwargs.get('note')
     self.row = kwargs.get('row')
     self.text = kwargs.get('text')
     self.color = kwargs.get('color')
     self.background_color = kwargs.get('background_color')
     self.key_color_normal = self.background_color
     self.text_color_normal = self.color
     self.highlight = rgba(app.config.get('Grid', 'Highlight'))
Пример #30
0
def main():

    Config.set('graphics', 'width', '1000')
    Config.set('graphics', 'height', '600')
    Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
    Config.write()
    Window.borderless = False
    Window.clearcolor = utils.rgba("#1E1F26")
    app = MainApp()
    app.run()
Пример #31
0
    def batch_processing(self):

        self.ids.videoplayer.state = 'pause'

        self.Batch_Flag = True
        self.popup.content = Label(
            text='Videos are being processed...This will take long',
            color=rgba('#DAA520'),
            font_size=20)
        self.popup.open()
        self.featureExtraction()