Пример #1
0
    def __init__(self, **kwargs):
        super(Tweet, self).__init__(**kwargs)

        contentContainer = self.ids['content_container']

        self.profPic = self.ids['profile_image']
        profPicLoader = Loader.image(kwargs["profile_image"])
        profPicLoader.bind(on_load=self._image_loaded)

        userName = self.ids['user_name']
        userName.text = kwargs["user_name"] + " " + "[size=19][color=075981]" + " @"+kwargs["screen_name"] + " - " + to_friendly_time(kwargs["created_at"]) + "[/color][/size]"
        userName.markup = True


        tweetText = self.ids['tweet_text']
        tweetText.text = kwargs["text"]

        self.linkButton = self.ids['link_button']

        urls = kwargs['urls']
        if len(urls)>0:
            self.link = urls[0]["url"]
            if self.link[:15] != "http://youtu.be":
                self.add_hyperlinks(tweetText, urls)
                self.linkButton.bind(on_release = self.on_ref_pressed_btn)

        self.trgHeight = self.height

        if len(kwargs["media"]) > 0:

            self.addImageCont = self.ids['additional_image_cont']
            self.addImage = self.ids['additional_image']

            self.addImageBtn = self.ids['additional_image_button']

            self.image_url = kwargs["media"][0]['url']
            addImageLoader = Loader.image(self.image_url)
            addImageLoader.bind(on_load=self._add_image_loaded)

            self.addImageCont.height = 300
            self.fullHeight = int(kwargs["media"][0]['lrg_height'])

            self.trgHeight += self.addImageCont.height

        self.height = 0
        self.opacity = 0
        #anim = Animation(height = self.trgHeight, opacity = 1, duration = self.animDur)
        #anim.start(self)
        self.height = self.trgHeight
        self.opacity = 1
Пример #2
0
 def build(self):
     iimagem = Loader.image(
         'http://www.topmba.com.br/wp-content/uploads/2013/06/girl-backpack-thinking-sunset-field-fence-moment-field-reeds-hd-fullscreen.jpg'
     )
     iimagem.bind(on_load=self.hcarregar)
     self.imagem = Image()
     return self.imagem
Пример #3
0
 def refreshImage(self, dt):
     if (self.files == None or len(self.files) == 0):
         return
     index = random.randint(0, len(self.files) - 1)
     path = self.files[index]
     proxyImage = Loader.image(path)
     proxyImage.bind(on_load=self._image_loaded)
Пример #4
0
    def _load_source(self, *_):
        #  self.set_angle()
        self.nocache = True
        if not self.source and not self.photo:
            if self._coreimage is not None:
                self._coreimage.unbind(on_texture=self._on_tex_change)
            self.texture = None
            self._coreimage = None
        elif not self.photo:
            if self.photoinfo:
                app = App.get_running_app()
                self.photo = app.session.query(Photo).filter_by(
                    id=self.photoinfo['id']).first()
            #Clock.schedule_once(lambda *dt: self._load_source(), .25)
        else:
            ThumbLoader.max_upload_per_frame = 50
            ThumbLoader.num_workers = 4
            ThumbLoader.loading_image = 'data/loadingthumbnail.png'
            self._coreimage = image = ThumbLoader.image(
                self.source,
                load_callback=self.load_thumbnail,
                nocache=self.nocache,
                mipmap=self.mipmap,
                anim_delay=self.anim_delay)
            image.bind(on_load=self._on_source_load)
            image.bind(on_texture=self._on_tex_change)
            self.texture = image.texture

        self.set_angle()
Пример #5
0
 def download_next_coverart(self):
     song = self.app.playlist.preview_next()
     if song.cover_art and not os.path.isfile(
             self._get_cover_art_path(song)):
         image = Loader.image(song.cover_art)
         image.source = None
         image.bind(on_load=self.save_cover_art)
Пример #6
0
    def __init__(self, poolsize=TILESERVER_POOLSIZE):
        self.cache_path = join(dirname(__file__), 'cache', self.provider_name)
        if not isdir(self.cache_path):
            makedirs(self.cache_path)

        black = Loader.image(join('documents', 'black.png'))
        #Loader._loading_image = black

        self.q_in = deque()
        self.q_out = deque()
        self.q_count = 0
        self.c_in = Condition()
        self.workers = []
        self.poolsize = poolsize
        self.uniqid = 1
        self.want_close = False
        self.available_maptype = dict(roadmap='Roadmap')
        self.hcsvnt = Loader.image(join('documents', 'hcsvnt.png'))
Пример #7
0
    def __init__(self, poolsize=TILESERVER_POOLSIZE):
        self.cache_path = join(dirname(__file__), 'cache', self.provider_name)
        if not isdir(self.cache_path):
            makedirs(self.cache_path)

        black = Loader.image(join('documents','black.png'))
        #Loader._loading_image = black
            
        self.q_in       = deque()
        self.q_out      = deque()
        self.q_count    = 0
        self.c_in       = Condition()
        self.workers    = []
        self.poolsize   = poolsize
        self.uniqid     = 1
        self.want_close = False
        self.available_maptype = dict(roadmap='Roadmap')
        self.hcsvnt     = Loader.image(join('documents','hcsvnt.png'))
Пример #8
0
 def on_source(self, instance, value):
     if not value:
         self.texture = None
         self._coreimage = None
     else:
         filename = resource_find(value)
         self._coreimage = image = Loader.image(filename)
         image.bind(on_load=self.on_source_load)
         self.texture = image.texture
Пример #9
0
 def on_source(self, instance, value):
     if not value:
         self.texture = None
         self._coreimage = None
     else:
         filename = resource_find(value)
         self._coreimage = image = Loader.image(filename)
         image.bind(on_load=self.on_source_load)
         self.texture = image.texture
Пример #10
0
 def on_source(self, instance, value):
     if not value:
         self.texture = None
         self._coreimage = None
     else:
         if not self.is_uri(value):
             value = resource_find(value)
         self._coreimage = image = Loader.image(value)
         image.bind(on_load=self.on_source_load)
         image.bind(on_texture=self._on_tex_change)
         self.texture = image.texture
Пример #11
0
    def __init__(self):
        super(Camera, self).__init__()

        self.CameraImage = Loader.image('http://192.168.42.1/mjpeg/amba.jpg')
        """self.CameraImage.size=(800, 600)"""
        self.CameraImage.pos = (0, 0)

        self.exitbutton = Button(text='exit', size=(40, 40), pos=(10, 10))
        self.exitbutton.bind(on_press=self.Exit)

        self.add_widget(self.CameraImage)
        self.add_widget(self.exitbutton)
Пример #12
0
    def get_cover(self):
        data_folder = App.get_running_app().config.get('Server', 'storagedir')
        cover_file = '%s/%s.png'%(data_folder,str(self.comic_id_number))
        try:
            if os.path.isfile(cover_file):
                return str(cover_file)
            else:
                proxyImage = Loader.image(self.thumb_url,nocache=True)
                proxyImage.bind(on_load=partial(self._proxy_loaded))
                return self.thumb_url

        except:
            Logger.critical('Something bad happened in loading cover')
Пример #13
0
 def on_source(self, instance, value):
     if not value:
         if self._coreimage is not None:
             self._coreimage.unbind(on_texture=self._on_tex_change)
         self.texture = None
         self._coreimage = None
     else:
         if not self.is_uri(value):
             value = resource_find(value)
         self._coreimage = image = Loader.image(value)
         image.bind(on_load=self.on_source_load)
         image.bind(on_texture=self._on_tex_change)
         self.texture = image.texture
    def __init__(self, objective, position, level_max, integrated=True, url=None):
        """
        Initialize the indicator
        :param objective: a table of different objectives
        :param position: the position of the indicator
        :param level_max: the max number of objectives
        """
        Widget.__init__(self)
        self.objective = objective
        self.progress = 0
        self.level = 0
        self.countdown = objective
        self.level_max = level_max
        self.integrated = integrated
        self.position = position
        self.url = url

        btn_new_image = Button(text="Ajout d'images", size=[200, 50])
        btn_new_image.pos = (position[0] - btn_new_image.width / 2, position[1])
        btn_new_image.bind(on_press=self.callback)

        if not self.integrated:
            self.pb = ProgressBar(max=self.objective, value=self.progress, size=[200, 0])
            self.pb2 = ProgressBar(max=self.objective, value=self.progress, size=[200, 0])
            self.pb3 = ProgressBar(max=self.objective, value=self.progress, size=[200, 0])
            self.pb.pos = (position[0] - self.pb.width / 2, position[1] + btn_new_image.height)
            self.pb2.pos = (position[0] - self.pb.width / 2, position[1] + btn_new_image.height + 2)
            self.pb3.pos = (position[0] - self.pb.width / 2, position[1] + btn_new_image.height + 5)
        elif self.integrated and self.countdown >= 0:
            from kivy.uix.image import Image
            from kivy.loader import Loader
            proxyImage = Loader.image(str(self.url))
            proxyImage.bind(on_load=self._image_loaded)
            self.pb = Image()
            self.pb.pos = (position[0] - self.pb.width / 2, position[1] + btn_new_image.height)
            self.position = (position[0] - self.pb.width / 2, position[1] + btn_new_image.height)
            with self.canvas:
                Color(1, 1, 1, 1)
                Rectangle(texture=self.pb.texture,
                          size=(self.pb.width, self.pb.height * (1 - (float(self.progress) / float(self.objective)))),
                          pos=(
                              self.position[0], self.position[1] + self.pb.height * (self.progress / self.objective)))
                Color(0, 0, 0, 1)
                Rectangle(size=(self.pb.width, self.pb.height * (1 - (float(self.progress) / float(self.objective)))),
                          pos=self.pb.pos)

        self.add_widget(btn_new_image)
        if not self.integrated:
            self.add_widget(self.pb)
            self.add_widget(self.pb2)
            self.add_widget(self.pb3)
Пример #15
0
 def _load_source(self, *args):
     source = self.source
     if not source:
         if self._coreimage is not None:
             self._coreimage.unbind(on_texture=self._on_tex_change)
         self.texture = None
         self._coreimage = None
     else:
         if not self.is_uri(source):
             source = resource_find(source)
         self._coreimage = image = Loader.image(source, nocache=self.nocache, mipmap=self.mipmap)
         image.bind(on_load=self._on_source_load)
         image.bind(on_texture=self._on_tex_change)
         self.texture = image.texture
Пример #16
0
 def cycleImage(self, dt, **kwargs):
     # TODO: keep next image cached?
     if not self.isPinned:
         keywords = App.get_running_app().config.get(
             "main_screen", "img_keywords").split(";")
         self.src = self.srcBase + random.choice(
             keywords) + "#" * random.randrange(
                 1, 30)  # hash guarantees new image even if same keywords
         image = Loader.image(self.src)
         image.bind(on_load=self.setImage)
         if kwargs["userTriggered"]:
             Clock.unschedule(self.rotateEvent)
             self.rotateEvent = Clock.schedule_interval(
                 partial(self.cycleImage, userTriggered=False), 3600)
Пример #17
0
 def _load_source(self, *args):
     source = self.source
     if not source:
         if self._coreimage is not None:
             self._coreimage.unbind(on_texture=self._on_tex_change)
         self.texture = None
         self._coreimage = None
     else:
         if not self.is_uri(source):
             source = resource_find(source)
         self._coreimage = image = Loader.image(source,
                 nocache=self.nocache, mipmap=self.mipmap)
         image.bind(on_load=self._on_source_load)
         image.bind(on_texture=self._on_tex_change)
         self.texture = image.texture
Пример #18
0
    def on_start(self):

        print(self.directory)  #diretorio atual da aplicacao
        print(self.user_data_dir
              )  #retorna diretorio do sistema de arquivos do sistema

        print(self.get_running_app().nome)  #INSTACIA ATAUAL DA APLICACAO
        print(
            self.root
        )  #retorna o WIDGET retornado pelo metodo build, nesse casoa Label
        print(self.root_window)  #retorna instacia da janela raiz da aplicacao

        #Carregardor de imagem assincrona, aceita URL da net
        from kivy.loader import Loader
        image = Loader.image('0icon.png')
Пример #19
0
    def loadImage(self, filename, onload=None):
        self.filename = filename
        if filename != None:
            self.onLoadCallback = onload

            proxyImage = Loader.image(filename)

            # this is totally stupid behaviour of Kivy
            # the docs suggest to bind proxy image's on_load method to a callback
            # to indicate when image is loaded. However, when image is already
            # in the cache the callback won't be called. My first thought was
            # that it was a threading issue, because the bindind might have happened
            # after the callback was initiated, but it seems that indeed the method is just not called.
            if proxyImage.loaded == False:
                proxyImage.bind(on_load=self._image_loaded)
            else:
                self._image_loaded(proxyImage)
Пример #20
0
	def _load_next(self,*largs):	
		
		if (self.loadnum < self.limit):
			
			# for some reason to many events where fired, so ignore
			# calls that don't have a unique timestamp
			
			if (len(largs) >0 ):
				if self.last_df == largs[0]:
					ignore = True
				else:
					ignore = False
					self.last_df = largs[0]
			else:
				ignore = False
				
			if not ignore:

				#gif images make trouble, conversion happens on server
				
				src = self.src  %  \
					( regions[self.active_region], ((self.loadnum +1) * self.steps), values.index(self.active_value) + 1)						
			
				proxyImage = Loader.image(src)	
				
				# we already have that image in cache
				if proxyImage.loaded:
					self.image.append(Image())
					self.image[self.loadnum].texture = proxyImage.image.texture
					self.carousel.add_widget(self.image[self.loadnum])
					self.loadnum = self.loadnum + 1
					self._load_next()
					
				# load image in background.						
				else:
					proxyImage.bind(on_load=self._image_loaded)
					self.image.append(Image())
					self.image[self.loadnum].texture = proxyImage.image.texture
					self.carousel.add_widget(self.image[self.loadnum])				
				
				#update widget..
				self.carousel.canvas.ask_update()

		# update progress bar
		self.pb.value =  (self.loadnum) / float(self.limit)  * 100
		self.ltext.text  = "total: + %dh" % ((self.loadnum) * self.steps)
Пример #21
0
    def loadImage(self, filename, onload=None):
        self.filename = filename
        if filename != None:
            self.onLoadCallback = onload

            proxyImage = Loader.image(filename)

            # this is totally stupid behaviour of Kivy
            # the docs suggest to bind proxy image's on_load method to a callback
            # to indicate when image is loaded. However, when image is already
            # in the cache the callback won't be called. My first thought was
            # that it was a threading issue, because the bindind might have happened
            # after the callback was initiated, but it seems that indeed the method is just not called.
            if proxyImage.loaded == False:
                proxyImage.bind(on_load=self._image_loaded)
            else:
                self._image_loaded(proxyImage)
Пример #22
0
    def load_comic_screen(self, comicstream_number):
        m_win_x = Window.width
        m_win_y = Window.height
        carousel = self.ids.comicscreenid.ids['my_carousel']
        carousel.clear_widgets()

        Logger.debug(str(comicstream_number))
        page_count = 22
        comicstream_number = int(self.ids['txt1'].text)
        id = '96'
       # cscomic = CsComic(comicstream_number)
        base_url = App.get_running_app().config.get('Server', 'url')
        base_dir = 'comic_page_images'
        scroll = ScrollView( size_hint=(1,1), do_scroll_x=True, do_scroll_y=False,id='page_thumb_scroll')
        self.pop = Popup(id='page_pop',title='Pages', content=scroll, pos_hint ={'y': .0001},size_hint = (1,.33))
        grid = GridLayout(rows=1, size_hint=(None,None),spacing=5,padding_horizontal=5,id='outtergrd')
        grid.bind(minimum_width=grid.setter('width'))
        for i in range(0, page_count):

            src_full = "%s/comic/%d/page/%d?max_height=1200#.jpg" % (base_url, comicstream_number, i)
            src_thumb = "%s/comic/%d/page/%d?max_height=200#.jpg" % (base_url, comicstream_number, i)

            comic_page_image = ComicImage(src=src_full, _index=i,nocache=False,keep_ratio=False,allow_stretch=True,id='pi_'+str(i),
                                          size_hint = (1,1),size=self.size
                                          )
            proxyImage = Loader.image(src_full)

            scatter = ComicScatter(do_rotation=False, do_scale=False,do_translation_x=False,id='comic_scatter'+str(i),
                                   scale_min=1, scale_max=2, size_hint=(None,None), size = (m_win_x,m_win_y),


                                   )
            scatter.add_widget(comic_page_image)
            carousel.add_widget(scatter)
            c_index =  len(carousel.slides)
            comic_page_image.car_index = c_index

            scatter.parent.bind(pos=self.setter('pos'))
            scatter.parent.bind(size=self.setter('size'))
            proxyImage.bind(on_load=partial(comic_page_image._image_downloaded, grid,comicstream_number))


        #Build the popup scroll of page buttons

        scroll.add_widget(grid)
Пример #23
0
                def reload_desktop( self , *args ) :
                    """

                    :param args:
                    :return:
                    """

                    if self._ev.isSet() :
                        sys.exit( 1 )

                    try :
                        desktop = Loader.image( self.url , nocache=True )
                        desktop.bind( on_load=self.desktop_loaded )

                    except Exception as e :
                        self._clock_event.cancel()
                        self._logger.error( 'reload_desktop ' + str( e ))
                        self.root.ids.desktop.source = './img/stop.png'
                        sys.exit( 1 )
Пример #24
0
    def HandleTweet(self):
        #Gets the Image URLs from the list and starts to load them.
        TempTweetArray = self.ListenerInstance.imageURLArray
        self.ListenerInstance.imageURLArray = []

        for url in TempTweetArray:

            proxxyimage = Loader.image(url)

            proxxyimage.bind(on_load=self.image_loaded)

            #really bad emergency solution. this makes the program download the image from the url twice.
            #I could not get it to convert from kivy image to a numpy array so that I could use the aldready downloaded image.
            #makes the program laggy. should be threaded to prevent blockage.
            #This number should be put in the ImageInformation class so every picture keeps the number of faces.
            #But since the convertion did not work the whole design goes away and this is the best I could figure out for now.
            #Since the convertion didnt work I probably have to rework some stuf or look further into the conversion.
            tempNumber = self.findFace(url)
            #comment out this line to remove face-rec and make program run alot faster
            self.CFLabel.text = self.currentFacesString + tempNumber.__str__()
Пример #25
0
 def _load_source(self, *args):
     source = self.source
     if not source:
         self._clear_core_image()
         return
     if not self.is_uri(source):
         source = resource_find(source)
         if not source:
             Logger.error('AsyncImage: Not found <%s>' % self.source)
             self._clear_core_image()
             return
     self._found_source = source
     self._coreimage = image = Loader.image(source,
                                            nocache=self.nocache,
                                            mipmap=self.mipmap,
                                            anim_delay=self.anim_delay)
     image.bind(on_load=self._on_source_load,
                on_error=self._on_source_error,
                on_texture=self._on_tex_change)
     self.texture = image.texture
Пример #26
0
    def update_images(self, force=False):
        """
0 1 2  3  4 5 6 7 8 9
0 1 2 -2 -1

if the current slide is 6
0 1 2  3  4 5 6 7 8 9
            5 6 7 8 4

if it is 1
0 1 2 3  4 5 6 7 8 9
0 1 2 3 -1

Current slide index is i, eg 6
Find the interval containing the current slide with i / len(interval), eg 1

To decide what image to load in the interval,
inter[i     % len(interval)] = i     % len(slides), eg inter[1]  = 6
inter[i + 1 % len(interval)] = i + 1 % len(slides), eg inter[2]  = 7
inter[i + 2 % len(interval)] = i + 2 % len(slides), eg inter[3]  = 8
inter[i - 1 % len(interval)] = i - 1 % len(slides), eg inter[0]  = 5
inter[i - 2 % len(interval)] = i - 2 % len(slides), eg inter[-1] = 4
"""
        def generate_loaded_callback(index):
            def image_loaded(image):
                self.images[index].texture = image.texture

            return image_loaded

        for index in range(-2, 3):
            index1 = (self.current_index + index) % len(self.images)
            index2 = (self.current_index + index) % len(self.sources)
            if self.images[index1].displayed != index2 or force:
                self.images[index1].texture = self.default_image.texture
                self.images[index1].parent.transform = Matrix()
                i = Loader.image(self.get_image_url(self.sources[index2]),
                                 allow_stretch=True,
                                 nocache=True,
                                 size=Window.size)
                i.bind(on_load=generate_loaded_callback(index1))
                self.images[index1].displayed = index2
    def __init__(self, identifier, image, pos, parent, support, lvl):
        """
        Initialize an animal
        :param identifier: the id of the animal
        :param image: the path of the image for the animal
        :param pos: the square where the scatter can be randomly placed
        """
        self.support = support
        self.scale_min=1
        self.scale_max=3.
        self.src_image = image

        from kivy.graphics.texture import Texture
        self.texture = Texture.create(size=(100, 100))
        size = 100 * 100 * 3
        buf = [0 for x in range(size)]
        buf = b''.join(map(chr, buf))
        self.texture.blit_buffer(buf, colorfmt='rgb', bufferfmt='ubyte')

        if self.src_image is not None:
            from kivy.uix.image import Image
            from kivy.loader import Loader
            proxy_image = Loader.image(str(self.src_image))
            proxy_image.bind(on_load=self._image_loaded)
            self.image = Image()

        self.locked = False
        self.lvl = lvl
        self.size_image=self.size[0]-10,self.size[1]-10
        self.pos_center = self.pos[0]+5, self.pos[1]+5

        Scatter.__init__(self)

        if self.support == "table":
            self.center = [randint(200, pos[0]), randint(200, pos[1])]
        else:
            self.center = pos[0], pos[1]

        self.rotation = randint(0, 360)
        self.identifier = identifier
        self.current_user = None
Пример #28
0
 def _load_source(self, *args):
     """Overwritten method for loading thumbnail of image"""
     source = self.source
     if not source:
         if self._coreimage is not None:
             self._coreimage.unbind(on_texture=self._on_tex_change)
             self._coreimage.unbind(on_load=self._on_source_load)
         self.texture = None
         self._coreimage = None
     else:
         Loader.max_upload_per_frame = 10
         self._coreimage = image = Loader.image(
             source,
             load_callback=self.get_thumbnail,
             nocache=self.nocache,
             mipmap=self.mipmap,
             anim_delay=self.anim_delay)
         image.bind(on_load=self._on_source_load)
         image.bind(on_error=self._on_source_error)
         image.bind(on_texture=self._on_tex_change)
         self.texture = image.texture
Пример #29
0
    def __init__(self, poolsize=TILESERVER_POOLSIZE, **kwargs):
        self.register_event_type('on_dirty')
        super(TileServer, self).__init__(**kwargs)
        self.cache_path = join(dirname(__file__), 'cache', self.provider_name)
        if not isdir(self.cache_path):
            makedirs(self.cache_path)

        #black = Loader.image(join('documents','black.png'))
        #Loader._loading_image = black

        self.q_in       = deque()
        self.q_out      = deque()
        self.q_count    = 0
        self.c_in       = Condition()
        self.workers    = []
        self.poolsize   = poolsize
        self.uniqid     = 1
        self.want_close = False
        self.available_maptype = dict(roadmap='Roadmap')
        self.hcsvnt     = Loader.image(join('documents','hcsvnt.png'))
        self.hcsvnt.bind(on_load=self.set_dirty)
Пример #30
0
    def on_start(self, **kwargs):
        image_dir = os.path.join(os.path.dirname(__file__), 'images')
        image_jpg_original = os.path.join(image_dir, 'DSCF2364.JPG')
        image_raf_original = os.path.join(image_dir, 'DSCF2364.RAF')

        # print('Trying Loader.image')
        proxyImage = Loader.image(image_jpg_original,
                                  load_callback=self._load_callback,
                                  post_callback=self._post_callback)
        # print('Binding on_load')
        # proxyImage.bind(on_load=self._on_load)
        # print('Going back to regularly scheduled programming')

        frame_wait = 0

        frame_wait += 1
        Clock.schedule_once(lambda dt: self._load_jpg(image_jpg_original),
                            frame_wait)
        frame_wait += 2
        Clock.schedule_once(lambda dt: self._convert_jpg(image_jpg_original),
                            frame_wait)
Пример #31
0
    def __init__(self, poolsize=TILESERVER_POOLSIZE, **kwargs):
        self.register_event_type('on_dirty')
        super(TileServer, self).__init__(**kwargs)
        self.cache_path = join(dirname(__file__), 'cache', self.provider_name)
        if not isdir(self.cache_path):
            makedirs(self.cache_path)

        #black = Loader.image(join('documents','black.png'))
        #Loader._loading_image = black

        self.q_in = deque()
        self.q_out = deque()
        self.q_count = 0
        self.c_in = Condition()
        self.workers = []
        self.poolsize = poolsize
        self.uniqid = 1
        self.want_close = False
        self.available_maptype = dict(roadmap='Roadmap')
        self.hcsvnt = Loader.image(join('documents', 'hcsvnt.png'))
        self.hcsvnt.bind(on_load=self.set_dirty)
Пример #32
0
    def _load_source(self, *args):
        source = self.source

        file_name = '.' + urlparse(self.source).path
        if os.path.isfile(file_name):
            source = file_name

        if not source:
            if self._coreimage is not None:
                self._coreimage.unbind(on_texture=self._on_tex_change)
            self.texture = None
            self._coreimage = None
        else:
            if not self.is_uri(source):
                source = resource_find(source)
            self._coreimage = image = Loader.image(source,
                nocache=self.nocache, mipmap=self.mipmap,
                anim_delay=self.anim_delay)

            image.bind(on_load=self._on_source_load)
            image.bind(on_texture=self._on_tex_change)
            self.texture = image.texture
Пример #33
0
 def got_page_size(results):
     Logger.debug(results)
     if results["width"] > results["height"]:
         Logger.debug("Size thing Triggered")
         comic_page_image.proxyImage = Loader.image(comic_page_source,
                                                    nocache=True)
         if comic_page_image.proxyImage.loaded:
             comic_page_image._new_image_downloaded(
                 comic_page_scatter,
                 outer_grid,
                 comic_obj,
                 i,
                 comic_page_source,
                 comic_page_image.proxyImage,
             )
         else:
             comic_page_image.proxyImage.bind(on_load=partial(
                 comic_page_image._new_image_downloaded,
                 comic_page_scatter,
                 outer_grid,
                 comic_obj,
                 i,
                 comic_page_source,
             ))
Пример #34
0
 def process_message(self, server_msg):
     messageWords = server_msg.split(" ", 1)  # otherwise the pickle can end up in thousands of chunks
     if messageWords[0] != "IMAGE":
         logging.debug("Got Message: %s", server_msg)
     logging.debug("message: %s", messageWords[0])
     logging.debug("len: %s", len(server_msg))
     logging.debug("chunks: %s", len(messageWords))
     try:
         pickle_data = pickle.loads(messageWords[1])
     except:
         pickle_data = None
     if messageWords[0] == "IDENT":
         networkProtocol.sendString("VALIDATE " + "admin" + " " + "password" + " " + platform.node())
         # start up the image refresh since we have a connection
         Clock.schedule_interval(self.main_image_refresh, 5.0)
     # after login receive the list of users to possibly login with
     elif messageWords[0] == "USERLIST":
         pass
     elif messageWords[0] == "VIDPLAY":
         # AttributeError: 'NoneType' object has no attribute 'set_volume'  <- means can't find file
         self.root.ids.theater_media_video_videoplayer.source = messageWords[1]
         self.root.ids.theater_media_video_videoplayer.volume = 1
         self.root.ids.theater_media_video_videoplayer.state = "play"
     elif messageWords[0] == "VIDEOLIST":
         data = [{"text": str(i), "is_selected": False} for i in range(100)]
         args_converter = lambda row_index, rec: {"text": rec["text"], "size_hint_y": None, "height": 25}
         list_adapter = ListAdapter(
             data=data,
             args_converter=args_converter,
             cls=ListItemButton,
             selection_mode="single",
             allow_empty_selection=False,
         )
         list_view = ListView(adapter=list_adapter)
         for video_list in pickle_data:
             # print "video list item:",video_list[0]
             # print "vid:",video_list[1]
             btn1 = ToggleButton(
                 text=video_list[0],
                 group="button_group_video_list",
                 size_hint_y=None,
                 width=self.root.ids.theater_media_video_list_scrollview.width,
                 height=(self.root.ids.theater_media_video_list_scrollview.height / 8),
             )
             btn1.bind(on_press=partial(self.Theater_Event_Button_Video_Select, video_list[1]))
             self.root.ids.theater_media_video_list_scrollview.add_widget(btn1)
     elif messageWords[0] == "VIDEODETAIL":
         self.root.ids._screen_manager.current = "Main_Theater_Media_Video_Detail"
         # load vid detail
         # mm_media_name,mm_media_ffprobe_json,mm_media_json,mm_metadata_json
         # print "type:",type(pickle_data[0]),type(pickle_data[1]),type(pickle_data[2]),type(pickle_data[3])
         ffprobe_json = pickle_data[1]
         media_json = pickle_data[2]
         metadata_json = pickle_data[3]
         self.root.ids.theater_media_video_title.text = pickle_data[0]
         self.root.ids.theater_media_video_subtitle.text = metadata_json["tagline"]
         # self.root.ids.theater_media_video_rating = row_data[3]['']
         # print "meta:",metadata_json
         self.root.ids.theater_media_video_runtime.text = str(metadata_json["runtime"])
         self.root.ids.theater_media_video_overview.text = metadata_json["overview"]
         genres_list = u""
         for ndx in range(0, len(metadata_json["genres"])):
             genres_list += metadata_json["genres"][ndx]["name"] + ", "
         self.root.ids.theater_media_video_genres.text = genres_list[:-2]
         # "LocalImages": {"Banner": "", "Fanart": "", "Poster": "../images/poster/f/9mhyID0imBjaRj3FJkARuXXSiQU.jpg", "Backdrop": null},
         production_list = u""
         for ndx in range(0, len(metadata_json["production_companies"])):
             production_list += metadata_json["production_companies"][ndx]["name"] + ", "
         self.root.ids.theater_media_video_production_companies.text = production_list[:-2]
         # go through streams
         audio_streams = []
         subtitle_streams = ["None"]
         for stream_info in ffprobe_json["streams"]:
             logging.debug("info: %s", stream_info)
             stream_language = ""
             stream_title = ""
             stream_codec = ""
             try:
                 stream_language = stream_info["tags"]["language"] + " - "
             except:
                 pass
             try:
                 stream_title = stream_info["tags"]["title"] + " - "
             except:
                 pass
             try:
                 stream_codec = stream_info["codec_long_name"].rsplit("(", 1)[1].replace(")", "") + " - "
             except:
                 pass
             if stream_info["codec_type"] == "audio":
                 logging.debug("audio")
                 audio_streams.append((stream_codec + stream_language + stream_title)[:-3])
             elif stream_info["codec_type"] == "subtitle":
                 subtitle_streams.append(stream_language)
                 logging.debug("sub")
         # populate the audio streams to select
         self.root.ids.theater_media_video_audio_spinner.values = map(str, audio_streams)
         self.root.ids.theater_media_video_audio_spinner.text = u"None"
         # populate the subtitle options
         self.root.ids.theater_media_video_subtitle_spinner.values = map(str, subtitle_streams)
         self.root.ids.theater_media_video_subtitle_spinner.text = u"None"
     #            # populate the chapter grid
     #            for chapter_info in ffprobe_json['chapters']:
     #                # media_json['ChapterImages']
     #                print "chap info:",chapter_info
     #                chapter_box = BoxLayout(size_hint_y=None)
     #                chapter_label = Label(text='Test Chapter')
     #                chapter_label_start = Label(text='Start Time')
     #                chapter_image = Image(source='./images/3D.png')
     #                chapter_box.add_widget(chapter_label)
     #                chapter_box.add_widget(chapter_label)
     #                chapter_box.add_widget(chapter_image)
     #                self.root.ids.theater_media_video_chapter_grid.add_widget(chapter_box)
     elif messageWords[0] == "ALBUMLIST":
         pass
     elif messageWords[0] == "ALBUMDETAIL":
         pass
     elif messageWords[0] == "MUSICLIST":
         pass
     elif messageWords[0] == "AUDIODETAIL":
         pass
     elif messageWords[0] == "GENRELIST":
         logging.debug("gen")
         for genre_list in pickle_data:
             logging.debug("genlist: %s", genre_list)
             btn1 = ToggleButton(
                 text=genre_list[0],
                 group="button_group_genre_list",
                 size_hint_y=None,
                 width=self.root.ids.theater_media_genre_list_scrollview.width,
                 height=(self.root.ids.theater_media_genre_list_scrollview.height / 8),
             )
             btn1.bind(on_press=partial(self.Theater_Event_Button_Genre_Select, genre_list[0]))
             self.root.ids.theater_media_genre_list_scrollview.add_widget(btn1)
     elif messageWords[0] == "PERSONLIST":
         pass
     elif messageWords[0] == "PERSONDETAIL":
         pass
     # metadata images
     elif messageWords[0] == "IMAGE":
         if pickle_data[0] == "MAIN":
             logging.debug("here for main refresh: %s %s", pickle_data[1], pickle_data[2])
             self.demo_media_id = pickle_data[2]
             proxyImage_demo = Loader.image(pickle_data[1])
             proxyImage_demo.bind(on_load=self._image_loaded_home_demo)
         elif pickle_data[0] == "MOVIE":
             logging.debug("here for movie refresh: %s", pickle_data[1])
             proxyImage_movie = Loader.image(pickle_data[1])
             proxyImage_movie.bind(on_load=self._image_loaded_home_movie)
         elif pickle_data[0] == "NEWMOVIE":
             logging.debug("here for newmovie refresh: %s", pickle_data[1])
             proxyImage_new_movie = Loader.image(pickle_data[1])
             proxyImage_new_movie.bind(on_load=self._image_loaded_home_new_movie)
         elif pickle_data[0] == "PROGMOVIE":
             logging.debug("here for progress movie refresh: %s", pickle_data[1])
             proxyImage_prog_movie = Loader.image(pickle_data[1])
             proxyImage_prog_movie.bind(on_load=self._image_loaded_home_prog_movie)
         elif pickle_data[0] == "MOVIEDETAIL":
             logging.debug("here for movie detail refresh: %s", pickle_data[1])
             proxyImage_detail_movie = Loader.image(pickle_data[1])
             proxyImage_detail_movie.bind(on_load=self._image_loaded_detail_movie)
     else:
         logging.error("unknown message type")
Пример #35
0
 def build(self):
     proxyImage = Loader.image(
         'http://iftucr.org/IFT/ANL_files/artistica.jpg')
     proxyImage.bind(on_load=self._image_loaded)
     self.image = Image()
     return self.image
    def process_message(self, server_msg):
        """
        Process network message from server
        """
        json_message = json.loads(server_msg.decode())
        try:
            if json_message['Type'] != "Image":
                common_global.es_inst.com_elastic_index('info', {"Got Message": server_msg})
            else:
                common_global.es_inst.com_elastic_index('info', {"Got Image Message":
                                                                     json_message['Subtype'],
                                                                 'uuid':
                                                                     json_message['UUID']})
        except:
            common_global.es_inst.com_elastic_index('info', {"full record": server_msg})
        common_global.es_inst.com_elastic_index('info', {"len total": len(server_msg)})
        # determine message type and work to be done
        if json_message['Type'] == "Ident":
            # Send a uuid for this connection. This way same installs can be copied, etc.
            # and not run into each other.
            self.send_twisted_message_thread(json.dumps({'Type': 'Ident',
                                                         'UUID': str(uuid.uuid4()),
                                                         'Platform': platform.node()}))
            # start up the image refresh since we have a connection
            Clock.schedule_interval(self.main_image_refresh, 5.0)

        elif json_message['Type'] == 'Play':  # direct file play
            video_source_dir = json_message['Data']
            # TODO - load real mapping
            share_mapping = (
                ('/mediakraken/mnt/', '/home/spoot/zfsspoo/Media/'),)
            if share_mapping is not None:
                for mapping in share_mapping:
                    video_source_dir = video_source_dir.replace(mapping[0], mapping[1])
            if os.path.exists(video_source_dir):
                # direct play it
                self.mpv_process = subprocess.Popen(
                    split('mpv --no-config --fullscreen --ontop --no-osc --no-osd-bar --aid=2',
                          '--audio-spdif=ac3,dts,dts-hd,truehd,eac3 --audio-device=pulse',
                          '--hwdec=auto --input-ipc-server ./mk_mpv.sock \"'
                          + video_source_dir + '\"'))
                self.mpv_connection = common_network_mpv.CommonNetMPVSocat()
        elif json_message['Type'] == "Image":
            common_global.es_inst.com_elastic_index('info', {'stuff': "here for movie refresh"})
            if json_message['Image Media Type'] == "Demo":
                f = open("./image_demo", "w")
                f.write(str(base64.b64decode(json_message['Data'])))
                f.close()
                self.demo_media_id = json_message['UUID']
                if self.first_image_demo == False:
                    common_global.es_inst.com_elastic_index('info', {'stuff': 'boom'})
                    self.root.ids.main_home_demo_image.reload()
                    common_global.es_inst.com_elastic_index('info', {'stuff': 'boom2'})
                else:
                    common_global.es_inst.com_elastic_index('info', {'stuff': 'wha2'})
                    proxy_image_demo = Loader.image("./image_demo")
                    proxy_image_demo.bind(
                        on_load=self._image_loaded_home_demo)
                    self.first_image_demo = False
        elif json_message['Type'] == "MPV":
            # sends the data message direct as a command to local running mpv
            self.mpv_connection.execute(json_message['Data'])
        else:
            common_global.es_inst.com_elastic_index('error', {'stuff': "unknown message type"})
 def process_message(self, server_msg):
     """
     Process network message from server
     """
     json_message = json.loads(server_msg.decode())
     try:
         if json_message['Type'] != "Image":
             common_global.es_inst.com_elastic_index('info', {'Got Message': server_msg})
         else:
             common_global.es_inst.com_elastic_index('info', {'Got Image Message':
                                                                  json_message['Sub'], 'UUID':
                                                                  json_message['UUID']})
     except:
         common_global.es_inst.com_elastic_index('info', {'full record': server_msg})
     common_global.es_inst.com_elastic_index('info', {'len total': len(server_msg)})
     # determine message type and work to be done
     if json_message['Type'] == "Ident":
         # Send a uuid for this connection. This way same installs can be copied, etc.
         # and not run into each other.
         self.send_twisted_message_thread(json.dumps({'Type': 'Ident',
                                                      'UUID': str(uuid.uuid4()),
                                                      'Platform': platform.node()}))
         # start up the image refresh since we have a connection
         Clock.schedule_interval(self.main_image_refresh, 5.0)
     elif json_message['Type'] == "Media":
         if json_message['Subtype'] == "Detail":
             self.root.ids.theater_media_video_title.text \
                 = json_message['Data']['Meta']['themoviedb']['Meta']['title']
             self.root.ids.theater_media_video_subtitle.text \
                 = json_message['Data']['Meta']['themoviedb']['Meta']['tagline']
             # self.root.ids.theater_media_video_rating = row_data[3]['']
             self.root.ids.theater_media_video_runtime.text \
                 = str(json_message['Data']['Meta']['themoviedb']['Meta']['runtime'])
             self.root.ids.theater_media_video_overview.text \
                 = json_message['Data']['Meta']['themoviedb']['Meta']['overview']
             genres_list = ''
             for ndx in range(0,
                              len(json_message['Data']['Meta']['themoviedb']['Meta']['genres'])):
                 genres_list += (
                         json_message['Data']['Meta']['themoviedb']['Meta']['genres'][ndx][
                             'name'] + ', ')
             self.root.ids.theater_media_video_genres.text = genres_list[:-2]
             # "LocalImages": {"Banner": "", "Fanart": "",
             # "Poster": "../images/poster/f/9mhyID0imBjaRj3FJkARuXXSiQU.jpg", "Backdrop": null},
             production_list = ''
             for ndx in range(0, len(json_message['Data']['Meta']['themoviedb']['Meta'][
                                         'production_companies'])):
                 production_list += (json_message['Data']['Meta']['themoviedb']['Meta'][
                                         'production_companies'][ndx]['name'] + ', ')
             self.root.ids.theater_media_video_production_companies.text = production_list[
                                                                           :-2]
             # go through streams
             audio_streams = []
             subtitle_streams = ['None']
             if json_message['Data2'] is not None and 'FFprobe' in json_message['Data2'] \
                     and 'streams' in json_message['Data2']['FFprobe'] \
                     and json_message['Data2']['FFprobe']['streams'] is not None:
                 for stream_info in json_message['Data2']['FFprobe']['streams']:
                     common_global.es_inst.com_elastic_index('info',
                                                             {'info': stream_info})
                     stream_language = ''
                     stream_title = ''
                     stream_codec = ''
                     try:
                         stream_language = stream_info['tags']['language'] + ' - '
                     except:
                         pass
                     try:
                         stream_title = stream_info['tags']['title'] + ' - '
                     except:
                         pass
                     try:
                         stream_codec \
                             = stream_info['codec_long_name'].rsplit('(', 1)[1].replace(')', '') \
                               + ' - '
                     except:
                         pass
                     if stream_info['codec_type'] == 'audio':
                         common_global.es_inst.com_elastic_index('info', {'stuff': 'audio'})
                         audio_streams.append((stream_codec + stream_language
                                               + stream_title)[:-3])
                     elif stream_info['codec_type'] == 'subtitle':
                         subtitle_streams.append(stream_language)
                         common_global.es_inst.com_elastic_index('info', {'stuff': 'subtitle'})
             # populate the audio streams to select
             self.root.ids.theater_media_video_audio_spinner.values = list(map(
                 str, audio_streams))
             self.root.ids.theater_media_video_audio_spinner.text = 'None'
             # populate the subtitle options
             self.root.ids.theater_media_video_subtitle_spinner.values = list(map(str,
                                                                                  subtitle_streams))
             self.root.ids.theater_media_video_subtitle_spinner.text = 'None'
             #            # populate the chapter grid
             #            for chapter_info in json_message['FFprobe']['chapters']:
             #                # media_json['ChapterImages']
             #                chapter_box = BoxLayout(size_hint_y=None)
             #                chapter_label = Label(text='Test Chapter')
             #                chapter_label_start = Label(text='Start Time')
             #                chapter_image = Image(source='./images/3D.png')
             #                chapter_box.add_widget(chapter_label)
             #                chapter_box.add_widget(chapter_label)
             #                chapter_box.add_widget(chapter_image)
             #                self.root.ids.theater_media_video_chapter_grid.add_widget(chapter_box)
         elif json_message['Sub'] == "List":
             data = []
             for video_list in json_message['Data']:
                 data.append({'text': video_list[0], 'uuid': video_list[1],
                              'path': video_list[4]})
             self.root.ids.theater_media_video_list_scrollview.data = data
     elif json_message['Type'] == 'Play':  # direct file play
         # AttributeError: 'NoneType' object has no attribute
         # 'set_volume'  <- means can't find file
         self.root.ids._screen_manager.current = 'Main_Theater_Media_Playback'
         video_source_dir = json_message['Data']
         share_mapping = (
             ('/mediakraken/mnt/zfsspoo/', '/home/spoot/zfsspoo/'),)
         if share_mapping is not None:
             for mapping in share_mapping:
                 video_source_dir = video_source_dir.replace(
                     mapping[0], mapping[1])
         self.root.ids.theater_media_video_videoplayer.source = video_source_dir
         self.root.ids.theater_media_video_videoplayer.volume = 1
         self.root.ids.theater_media_video_videoplayer.state = 'play'
     # after connection receive the list of users to possibly login with
     elif json_message['Type'] == "User":
         pass
     elif json_message['Type'] == "Genre List":
         common_global.es_inst.com_elastic_index('info', {'stuff': "gen"})
         for genre_list in json_message:
             common_global.es_inst.com_elastic_index('info', {"genlist": genre_list})
             btn1 = ToggleButton(text=genre_list[0], group='button_group_genre_list',
                                 size_hint_y=None,
                                 width=self.root.ids.theater_media_genre_list_scrollview.width,
                                 height=(
                                         self.root.ids.theater_media_genre_list_scrollview.height / 8))
             btn1.bind(on_press=partial(
                 self.Theater_Event_Button_Genre_Select, genre_list[0]))
             self.root.ids.theater_media_genre_list_scrollview.add_widget(
                 btn1)
     elif json_message['Type'] == "Image":
         if json_message['Subtype'] == "Movie":
             common_global.es_inst.com_elastic_index('info', {'stuff': "here for movie refresh"})
             f = open('./image_demo', "w")
             f.write(base64.b64decode(json_message['Data'].encode()))
             f.close()
             self.demo_media_id = json_message['UUID']
             proxy_image_demo = Loader.image('./image_demo')
             proxy_image_demo.bind(on_load=self._image_loaded_home_demo)
         elif json_message['Image Media Type'] == "Movie":
             f = open('./image_movie', "w")
             f.write(base64.b64decode(json_message['Data'].encode()))
             f.close()
             proxy_image_movie = Loader.image('./image_movie')
             proxy_image_movie.bind(
                 on_load=self._image_loaded_home_movie)
         elif json_message['Image Media Type'] == "New Movie":
             f = open('./image_new_movie', "w")
             f.write(base64.b64decode(json_message['Data'].encode()))
             f.close()
             proxy_image_new_movie = Loader.image('./image_new_movie')
             proxy_image_new_movie.bind(
                 on_load=self._image_loaded_home_new_movie)
         elif json_message['Image Media Type'] == "In Progress":
             f = open('./image_in_progress', "w")
             f.write(base64.b64decode(json_message['Data'].encode()))
             f.close()
             proxy_image_prog_movie = Loader.image('./image_in_progress')
             proxy_image_prog_movie.bind(
                 on_load=self._image_loaded_home_prog_movie)
             # elif pickle_data[0] == "MOVIEDETAIL":
             #     common_global.es_inst.com_elastic_index('info', {'stuff':"here for movie detail refresh: %s", pickle_data[1])
             #     proxy_image_detail_movie = Loader.image(pickle_data[1])
             #     proxy_image_detail_movie.bind(on_load=self._image_loaded_detail_movie)
         else:
             common_global.es_inst.com_elastic_index('error', {'stuff': "unknown message type"})
    def process_message(self, server_msg):
        """
        Process network message from server
        """
        json_message = json.loads(server_msg.decode())
        try:
            if json_message['Type'] != "Image":
                common_global.es_inst.com_elastic_index('info', {"Got Message": server_msg})
            else:
                common_global.es_inst.com_elastic_index('info', {"Got Image Message":
                                                                     json_message['Sub'], 'uuid':
                                                                     json_message['UUID']})
        except:
            common_global.es_inst.com_elastic_index('info', {"full record": server_msg})
        common_global.es_inst.com_elastic_index('info', {"len total": len(server_msg)})
        # determine message type and work to be done
        if json_message['Type'] == "Ident":
            # Send a uuid for this connection. This way same installs can be copied, etc.
            # and not run into each other.
            self.send_twisted_message_thread(json.dumps({'Type': 'Ident',
                                                         'UUID': str(uuid.uuid4()),
                                                         'Platform': platform.node()}))
            # start up the image refresh since we have a connection
            Clock.schedule_interval(self.main_image_refresh, 5.0)

        elif json_message['Type'] == "Media":
            if json_message['Subtype'] == "Controller":
                # populate the video file list
                self.root.ids.theater_media_video_spinner.values = list(map(
                    str, json_message['Video File List']))

            elif json_message['Subtype'] == "Detail":
                self.root.ids.theater_media_video_title.text \
                    = json_message['Data']['Meta']['themoviedb']['Meta']['title']
                self.root.ids.theater_media_video_subtitle.text \
                    = json_message['Data']['Meta']['themoviedb']['Meta']['tagline']
                # self.root.ids.theater_media_video_rating = row_data[3]['']
                self.root.ids.theater_media_video_runtime.text \
                    = str(json_message['Data']['Meta']['themoviedb']['Meta']['runtime'])
                self.root.ids.theater_media_video_overview.text \
                    = json_message['Data']['Meta']['themoviedb']['Meta']['overview']
                genres_list = ''
                for ndx in range(0,
                                 len(json_message['Data']['Meta']['themoviedb']['Meta']['genres'])):
                    genres_list += (
                            json_message['Data']['Meta']['themoviedb']['Meta']['genres'][ndx][
                                'name'] + ', ')
                self.root.ids.theater_media_video_genres.text = genres_list[:-2]
                production_list = ''
                for ndx in range(0, len(json_message['Data']['Meta']['themoviedb']['Meta'][
                                            'production_companies'])):
                    production_list += (json_message['Data']['Meta']['themoviedb']['Meta'][
                                            'production_companies'][ndx]['name'] + ', ')
                self.root.ids.theater_media_video_production_companies.text = production_list[:-2]

            elif json_message['Subtype'] == 'FFprobe Detail':
                # TODO have the below refresh for the select video file
                # TODO will need to display SD/HD/UHD and length of video
                # populate the audio streams to select
                self.root.ids.theater_media_video_audio_spinner.values = list(map(
                    str, json_message['Audio Streams']))
                self.root.ids.theater_media_video_audio_spinner.text = 'None'
                # populate the subtitle options
                self.root.ids.theater_media_video_subtitle_spinner.values \
                    = list(map(str, json_message['Subtitle Streams']))
                self.root.ids.theater_media_video_subtitle_spinner.text = 'None'
            elif json_message['Subtype'] == "List":
                self.send_twisted_message_thread(json.dumps({'Type': 'Device Play List'}))
                data = []
                for video_list in json_message['Data']:
                    data.append({'text': video_list[0], 'uuid': video_list[1],
                                 'path': video_list[4]})
                self.root.ids.theater_media_video_list_scrollview.data = data
                # self.list_adapter.bind(on_selection_change=self.theater_event_button_video_select)
        # elif json_message['Type'] == 'Play':  # direct file play
        #     # AttributeError: 'NoneType' object has no attribute
        #     # 'set_volume'  <- means can't find file
        #     self.root.ids._screen_manager.current = 'Main_Theater_Media_Playback'
        #     video_source_dir = json_message['Data']
        #     share_mapping = (
        #         ('/mediakraken/mnt/zfsspoo/', '/home/spoot/zfsspoo/'),)
        #     if share_mapping is not None:
        #         for mapping in share_mapping:
        #             video_source_dir = video_source_dir.replace(mapping[0], mapping[1])
        #     self.root.ids.theater_media_video_videoplayer.source = video_source_dir
        #     self.root.ids.theater_media_video_videoplayer.volume = 1
        #     self.root.ids.theater_media_video_videoplayer.state = 'play'
        # after connection receive the list of users to possibly login with
        elif json_message['Type'] == "User":
            pass

        elif json_message['Type'] == "Device Play List":
            play_list = ['This Device']
            for play_device in json_message['Data']:
                play_list.append(play_device[2])  # name of device
            self.root.ids.theater_media_video_play_local_spinner.values = play_list

        elif json_message['Type'] == "Genre List":
            common_global.es_inst.com_elastic_index('info', {'stuff': "gen"})
            for genre_list in json_message:
                common_global.es_inst.com_elastic_index('info', {"genlist": genre_list})
                btn1 = ToggleButton(text=genre_list[0], group='button_group_genre_list',
                                    size_hint_y=None,
                                    width=self.root.ids.theater_media_genre_list_scrollview.width,
                                    height=(
                                            self.root.ids.theater_media_genre_list_scrollview.height / 8))
                btn1.bind(on_press=partial(
                    self.Theater_Event_Button_Genre_Select, genre_list[0]))
                self.root.ids.theater_media_genre_list_scrollview.add_widget(
                    btn1)
        elif json_message['Type'] == "Image":
            if json_message['Subtype'] == "Movie":
                common_global.es_inst.com_elastic_index('info', {'stuff': "here for movie refresh"})
                if json_message['Image Media Type'] == "Demo":
                    f = open("./image_demo", "w")
                    f.write(base64.b64decode(json_message['Data'].encode()))
                    f.close()
                    self.demo_media_id = json_message['UUID']
                    if self.first_image_demo is False:
                        common_global.es_inst.com_elastic_index('info', {'stuff': 'boom'})
                        # self.root.ids.main_home_demo_image.reload()
                        common_global.es_inst.com_elastic_index('info', {'stuff': 'boom2'})
                    else:
                        common_global.es_inst.com_elastic_index('info', {'stuff': 'wha2'})
                        proxy_image_demo = Loader.image("image_demo")
                        proxy_image_demo.bind(
                            on_load=self._image_loaded_home_demo)
                        self.first_image_demo = False
                elif json_message['Image Media Type'] == "Movie":
                    f = open("./image_movie", "w")
                    f.write(base64.b64decode(json_message['Data'].encode()))
                    f.close()
                    proxy_image_movie = Loader.image("./image_movie")
                    proxy_image_movie.bind(
                        on_load=self._image_loaded_home_movie)
                elif json_message['Image Media Type'] == "New Movie":
                    f = open("./image_new_movie", "w")
                    f.write(base64.b64decode(json_message['Data'].encode()))
                    f.close()
                    proxy_image_new_movie = Loader.image("./image_new_movie")
                    proxy_image_new_movie.bind(
                        on_load=self._image_loaded_home_new_movie)
                elif json_message['Image Media Type'] == "In Progress":
                    f = open("./image_in_progress", "w")
                    f.write(base64.b64decode(json_message['Data'].encode()))
                    f.close()
                    proxy_image_prog_movie = Loader.image(
                        "./image_in_progress")
                    proxy_image_prog_movie.bind(
                        on_load=self._image_loaded_home_prog_movie)
        else:
            common_global.es_inst.com_elastic_index('error', {'stuff': "unknown message type"})
Пример #39
0
 def build(self):
     proxyImage = Loader.image("button.jpg")
     proxyImage.bind(on_load=self._image_loaded)
     self.image = Image()
     return self.image
Пример #40
0
 def reload_desktop(self, *args):
     desktop = Loader.image(self.url, nocache=True)
     desktop.bind(on_load=self.desktop_loaded)
Пример #41
0
                      fd.write(data)
              except:
                  Logger.exception('Tileserver: Unable to write %s' % filename)
                  continue

              # post processing
              self.post_download(filename)
              loaded = True
              break
        
        if not loaded:
          return        

        # load image
        try:
          image = Loader.image(filename)
        except Exception,e:
          Logger.error('TileServer|HCSVNT "%s": file=%s' % (str(e), filename))
          image = self.hcsvnt
        image.id = 'img%d' % self.uniqid
        self.uniqid += 1

        # push image on the queue
        q_out.appendleft((filename, image))



class GoogleTileServer(TileServer):
    '''Google tile server.

    .. warning::
Пример #42
0
                except:
                    Logger.exception('Tileserver: Unable to write %s' %
                                     filename)
                    continue

                # post processing
                self.post_download(filename)
                loaded = True
                break

        if not loaded:
            return

        # load image
        try:
            image = Loader.image(filename)
        except Exception, e:
            Logger.error('TileServer|HCSVNT "%s": file=%s' %
                         (str(e), filename))
            image = self.hcsvnt
        image.id = 'img%d' % self.uniqid
        self.uniqid += 1

        # push image on the queue
        q_out.appendleft((filename, image))


class GoogleTileServer(TileServer):
    '''Google tile server.

    .. warning::
Пример #43
0
 def reload_desktop(self, *args):
     desktop = Loader.image(self.url, nocache=True)
     desktop.bind(on_load=self.desktop_loaded)
Пример #44
0
from kivy.base import EventLoop
from kivy.clock import Clock
from kivy.clock import mainthread
import pyttsx3
from kivy.uix.button import Button
from kivy.graphics import Color, Rectangle
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.image import Image
import threading
from kivy.loader import Loader

engine = pyttsx3.init()

im = Image(source='./gif/jpg/00-load.jpg')
image = Loader.image('./gif/jpg/00-load.jpg')
#im2 = Image(source='./gif/07_smile.gif')


class Imglayout(FloatLayout):
    def __init__(self, **args):
        super(Imglayout, self).__init__(**args)

        with self.canvas.before:
            Color(0, 0, 0, 0)
            self.rect = Rectangle(size=self.size, pos=self.pos)

        self.bind(size=self.updates, pos=self.updates)

    def updates(self, instance, value):
        self.rect.size = instance.size
Пример #45
0
from kivy.uix.screenmanager import ScreenManager, Screen, NoTransition
from kivy.clock import Clock
from kivy.properties import NumericProperty
from widgets import *
import re
import keyboard
from kivy.core.window import Window
from kivy.cache import Cache
Cache._categories['kv.image']['limit'] = 0
Cache._categories['kv.texture']['limit'] = 0

# from gpiozero import LED

# Retrieve data files
Builder.load_file('./layout.kv')
gif = Loader.image('./timer_frame.gif')
logo = Loader.image('./WHO.png')
check = Loader.image('./Check.png')
check_hover = Loader.image('./Check Hover.png')


class IntroLogo(BgScreen):
    def __init__(self, **kwargs):
        super(IntroLogo, self).__init__(**kwargs)

        self.layout = AnchorLayout(padding=[100])
        self.add_widget(self.layout)

        # Add starting Logo
        self.logo = Image(source='WHO.png',
                          allow_stretch=True,