python类size()的实例源码

gap.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def unimage(self, params):
        self.unimages.append([])
        if self.kivy:
            from kivy.uix.image import Image
            self.unimages[len(self.unimages) - 1] = Image( source= params[4],
                allow_stretch = True, size_hint = (None, None),
                size=(params[2] * self.xratio, params[3] * self.yratio),
                pos=(params[0] * self.xratio, params[1] * self.yratio))

            self.root.add_widget(self.unimages[len(self.unimages) - 1])

        else:
            import ui
            self.unimages[len(self.unimages) - 1] = (ui.ImageView
            (name = 'Image', frame = (params[0] * self.xratio, \
            (600 - params[1] - params[3]) * self.yratio, \
            params[2] * self.xratio, params[3] * self.yratio)))

            self.root.add_subview (self.unimages[len(self.unimages) - 1])
            self.unimages[len(self.unimages) - 1].image = \
                ui.Image.named(params[4])
kdialog.py 文件源码 项目:HeaTDV4A 作者: HeaTTheatR 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, **kvargs):
        super(KDialog, self).__init__(**kvargs)

        self.orientation = "vertical"
        self.param = None

        # ???? ??? ?????? ?????? "??-???-??????".
        self.box_buttons_select = BoxLayout(orientation="horizontal",
                                            size_hint_y=None, height=40)
        self.scroll = ScrollView()
        self.box_content = GridLayout(cols=2, size_hint_y=None)
        self.box_content.bind(minimum_height=self.box_content.setter("height"))
        self.body = Popup(title_align=self.title_align,
                          background=self.background_image,
                          on_dismiss=self.dismiss_callback)
        # ??? ???? ?????????.
        with self.box_content.canvas:
            Color(0.16, 0.16, 0.16)
            self.canvas_for_box_content = \
                Rectangle(pos=(5, 5), size=(self.box_content.width,
                                            self.box_content.height))
            self.box_content.bind(size=self._update_canvas_size,
                                  pos=self._update_canvas_size)

        self.scroll.add_widget(self.box_content)
messageviewer.py 文件源码 项目:HeaTDV4A 作者: HeaTTheatR 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def add_text_to_label(self, text):
        # TODO: ????????? ??????? ??????????? ?? ?????????? ????????,
        # ????????? ? Label, ?????????? ??????? ????? ?????? ??? ????? ???
        # ??????????? ???????...
        while text != "":
            _text = text[:3500]
            text = text[3500:]

            message_text = Label(text=_text, size_hint_y=None, markup=True)
            message_text.bind(size=lambda *args: self._update_label_size(args),
                              on_ref_press=self.event_callback)
            self.box_content.add_widget(message_text)
        # else:
        #    message_text = Label(text=text.decode("utf-8", "replace"),
        #                         size_hint_y=None, markup=True)
        #    message_text.bind(size=lambda *args: self._update_label_size(args),
        #                      on_ref_press=self.event_callback)
        #    self.box_content.add_widget(message_text)
messageviewer.py 文件源码 项目:HeaTDV4A 作者: HeaTTheatR 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _update_canvas_size(self, instance, value):
        """?????????? ??? ????????? ??????? ?????? ??????????.

        type instance: instance <kivy.uix.gridlayout.GridLayout object'>;

        type value: list;
        param value: ??????? ?????? instance;

        """

        self.canvas_for_box_content.pos = instance.pos
        self.canvas_for_box_content.size = instance.size

        # ????????? ?????? ???? Popup - ???? ?????????.
        self.body_message.height = self.canvas_for_box_content.size[1] + 150
        if self.body_message.height > Window.size[1]:
            self.body_message.height = Window.size[1] - 10
scrollbutton.py 文件源码 项目:HeaTDV4A 作者: HeaTTheatR 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _update_canvas_size(self, instance, value):
        """?????????? ??? ????????? ??????? ?????? ??????????.

        type instance: instance <kivy.uix.gridlayout.GridLayout object'>;

        type value: list;
        param value: ??????? ?????? instance;

        """

        self.canvas_for_box_content.pos = instance.pos
        self.canvas_for_box_content.size = instance.size

        # ????????? ?????? ???? Popup.
        self.body.height = self.canvas_for_box_content.size[1] + 70
        self.body.width = int(Window.size[0] / self.size_hint_x)

        if self.body.height > Window.size[1]:
            self.body.height = Window.size[1] - 10
gap.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def uniframe(self, params):
        if self.kivy:
            from kivy.graphics import Color
            from kivy.graphics import Rectangle
            self.root.canvas.add(Color (params[4][0],params[4][1], \
                params[4][2]))
            self.root.canvas.add(Rectangle(pos = (params[0] * self.xratio, \
                params[1] * self.yratio), size = (params[2] * self.xratio, \
                params[3] * self.yratio)))
        else:
            import ui
            self.uniframes.append([])
            self.uniframes[len(self.uniframes) - 1] = \
                ui.View(frame=(params[0] * self.xratio, \
                (600 - params[1] - params[3]) * self.yratio, \
                params[2] * self.xratio, params[3] * self.yratio))
            self.uniframes[len(self.uniframes) - 1].background_color = \
                (params[4][0],params[4][1], params[4][2],1.0)
            self.root.add_subview(self.uniframes[len(self.uniframes) - 1])
gap12.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def unimage(self, params):
        self.unimages.append([])
        if self.kivy:
            from kivy.uix.image import Image
            self.unimages[len(self.unimages) - 1] = Image( source= params[4],
                allow_stretch = True, size_hint = (None, None),
                size=(params[2] * self.xratio, params[3] * self.yratio),
                pos=(params[0] * self.xratio, params[1] * self.yratio))

            self.root.add_widget(self.unimages[len(self.unimages) - 1])

        else:
            import ui
            self.unimages[len(self.unimages) - 1] = (ui.ImageView
            (name = 'Image', frame = (params[0] * self.xratio, \
            (600 - params[1] - params[3]) * self.yratio, \
            params[2] * self.xratio, params[3] * self.yratio)))

            self.root.add_subview (self.unimages[len(self.unimages) - 1])
            self.unimages[len(self.unimages) - 1].image = \
                ui.Image.named(params[4])
gap12.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def uniframe(self, params):
        if self.kivy:
            from kivy.graphics import Color
            from kivy.graphics import Rectangle
            self.root.canvas.add(Color (params[4][0],params[4][1], \
                params[4][2]))
            self.root.canvas.add(Rectangle(pos = (params[0] * self.xratio, \
                params[1] * self.yratio), size = (params[2] * self.xratio, \
                params[3] * self.yratio)))
        else:
            import ui
            self.uniframes.append([])
            self.uniframes[len(self.uniframes) - 1] = \
                ui.View(frame=(params[0] * self.xratio, \
                (600 - params[1] - params[3]) * self.yratio, \
                params[2] * self.xratio, params[3] * self.yratio))
            self.uniframes[len(self.uniframes) - 1].background_color = \
                (params[4][0],params[4][1], params[4][2],1.0)
            self.root.add_subview(self.uniframes[len(self.uniframes) - 1])
gap21.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def unimage(self, params):
        self.unimages.append([])
        if self.kivy:
            from kivy.uix.image import Image
            self.unimages[len(self.unimages) - 1] = Image( source= params[4],
                allow_stretch = True, size_hint = (None, None),
                size=(params[2] * self.xratio, params[3] * self.yratio),
                pos=(params[0] * self.xratio, params[1] * self.yratio))

            self.root.add_widget(self.unimages[len(self.unimages) - 1])

        else:
            import ui
            self.unimages[len(self.unimages) - 1] = (ui.ImageView
            (name = 'Image', frame = (params[0] * self.xratio, \
            (600 - params[1] - params[3]) * self.yratio, \
            params[2] * self.xratio, params[3] * self.yratio)))

            self.root.add_subview (self.unimages[len(self.unimages) - 1])
            self.unimages[len(self.unimages) - 1].image = \
                ui.Image.named(params[4])
bdialog.py 文件源码 项目:Easy 作者: HeaTTheatR 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _update_canvas_size(self, instance, value):
        '''?????????? ??? ????????? ??????? ?????? ??????????.

        type instance: instance <kivy.uix.gridlayout.GridLayout object'>;

        type value: list;
        param value: ??????? ?????? instance;

        '''

        self.canvas_for_box_content.pos = instance.pos
        self.canvas_for_box_content.size = instance.size

        # ????????? ?????? ???? Popup.
        self.height = self.dp(self.canvas_for_box_content.size[1] + 70)
        self.width = self.dp(int(Window.size[0] // self.hint_x))

        if self.height > Window.size[1]:
            self.height = self.dp(Window.size[1] - 10)
kdialog.py 文件源码 项目:Easy 作者: HeaTTheatR 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def _update_box_content_size(self, *args):
        if args != ():
            height = self.dp(args[0][1])
            if height != 0 and height is not None and height != self.dp(150):
                if self.param == 'logpass':
                    self.height = self.dp(210)
                elif self.param == 'text':
                    self.height = self.dp(170)
                else:
                    if self.param == 'query' and self.check:
                        h = self.dp(190)
                    else:
                        h = self.dp(150)
                    self.height = h if height < h else height
        else:
            if self.rst:
                self.height = self.dp(400)

        if self.height > Window.size[1]:
            self.height = self.dp(Window.size[1] - 10)
DisplaySource.py 文件源码 项目:displayminion 作者: cedarsuite 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, client, **kwargs):
        self.client = client
        self.disp_size = [0, 0]
        self.child_size = Window.size

        self.canvas = RenderContext(use_parent_projection = True)
        with self.canvas:
            self.fbo = Fbo(size = Window.size, use_parent_projection = True)

        with self.fbo:
            ClearColor(0, 0, 0, 0)
            ClearBuffers()

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

        self.texture = self.fbo.texture

        if self.client.config.get('outputs', 'shmsink') == 'yes':
            from .GStreamerOutput import GStreamerOutput
            self.shmsinkoutput = GStreamerOutput(self.texture)
        else:
            self.shmsinkoutput = False

        Window.bind(on_resize = self.resize)
DisplaySource.py 文件源码 项目:displayminion 作者: cedarsuite 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _resize(self, *args):
        to_size = list(Window.size)
        if self.disp_size[0] > 0:
            to_size[0] = self.disp_size[0]

        if self.disp_size[1] > 0:
            to_size[1] = self.disp_size[1]

        self.child_size = to_size
        self.size = to_size

        self.fbo.size = Window.size
        self.texture = self.fbo.texture

        if self.shmsinkoutput: self.shmsinkoutput.new_texture(self.texture)

        for w in reversed(self.children[:]):
            self.remove_widget(w)
            self.add_widget(w)

        for s in self.client.sections: s.recalc()
GStreamerAction.py 文件源码 项目:displayminion 作者: cedarsuite 项目源码 文件源码 阅读 72 收藏 0 点赞 0 评论 0
def update(self, dt):
        sample, self.sample = self.sample, None
        if sample is None:
            return

        try:
            buf = sample.get_buffer()
            result, mapinfo = buf.map(Gst.MapFlags.READ)

            addr = mapinfo.__hash__()
            c_mapinfo = _MapInfo.from_address(addr)

            sbuf = string_at(c_mapinfo.data, mapinfo.size)
            self.texture.blit_buffer(sbuf, colorfmt = 'rgb')
        finally:
            if mapinfo is not None:
                buf.unmap(mapinfo)

        self.image.canvas.ask_update()
main.py 文件源码 项目:zipper 作者: richarddun 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self,**kwargs):
        self.baseimg = os.path.abspath(os.path.join(os.path.dirname('__file__'),'animation','effects','enbar_noback.png'))
        self.hpimg = os.path.abspath(os.path.join(os.path.dirname('__file__'),'animation','effects','hbar.png'))
        self.mpimg = os.path.abspath(os.path.join(os.path.dirname('__file__'),'animation','effects','mpbar.png'))

        super(ZippyGame,self).__init__(**kwargs)
        tempscale = Window.height / 256.
        self.map = BaseMap(os.path.abspath(os.path.join(os.path.dirname('__file__'),'Maps','prototype1','16px-680x800-metal.tmx')),
            Window.size,tempscale)
        spawn = self.map.map.layers['start'].find('spawn')[0]
        self.zipmeter = ZipMeter()
        self.sprite = Player_Sprite((spawn.px,spawn.py),self.map)
        self.add_widget(self.map)
        self.map.add_widget(self.sprite)
        self.add_widget(self.zipmeter)
        Clock.schedule_interval(self.update, 1.0/60.0)
main.py 文件源码 项目:zipper 作者: richarddun 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def consider_collide(self,pushx,pushy):
        """
        method to recursively find the point on a straight line where a collision occurs with
        tile object containing collision properties (t,b,l,r : top, bottom, left, right)
        Updates an Rect instance value with the x,y location at the point of collision for
        later use.  Uses recursion instead of iteration because endpoint is not known prior to
        calling the method.

        :param pushx: normalised vector describing the direction to move, already pre-computed by the touch angle
        plus the touch location
        :param pushy: normalised vector describing the direction to move, already pre-computed by the touch angle
        plus the touch location
        :return: always returns None
        """
        self.plotrect = Rect((self.pos[0]+(self.width*.42))+pushx,(self.pos[1]+(self.height*.35))+pushy,
                             self.size[0]*.16, self.size[1]*.29)
        numnum = len(self.map.map.layers['blocker'].collide(self.plotrect, 'blocker'))
        if numnum >= 1:
            return None
        pushx += self.movedir.x
        pushy += self.movedir.y
        self.consider_collide(pushx,pushy)
bdialog.py 文件源码 项目:kdialog 作者: HeaTTheatR 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _update_canvas_size(self, instance, value):
        '''?????????? ??? ????????? ??????? ?????? ??????????.

        type instance: instance <kivy.uix.gridlayout.GridLayout object'>;

        type value: list;
        param value: ??????? ?????? instance;

        '''

        self.canvas_for_box_content.pos = instance.pos
        self.canvas_for_box_content.size = instance.size

        # ????????? ?????? ???? Popup.
        self.height = self.dp(self.canvas_for_box_content.size[1] + 70)
        self.width = self.dp(int(Window.size[0] // self.hint_x))

        if self.height > Window.size[1]:
            self.height = self.dp(Window.size[1] - 10)
kdialog.py 文件源码 项目:kdialog 作者: HeaTTheatR 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _update_window_size(self, instance, value):
        '''?????????? ??? ????????? ??????? ?????? ??????????.'''

        if not self.rst:
            self.height = self.message.texture_size[1]

        if self.param == 'text' or self.param == 'query' and self.check:
            self.height = 170
        elif self.param == 'logpass':
            self.height = 210
        elif self.rst:
            self.height = self.message.height = 400

        if self.height > Window.size[1]:
            self.height = Window.size[1] - 10
        elif self.height < 150:
            self.height = 150
MapBoard.py 文件源码 项目:KivyTrek 作者: peterLaurence 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        kwargs.setdefault('do_rotation', False)
        kwargs.setdefault('do_scale', False)
        kwargs.setdefault('do_translation_x', False)
        kwargs.setdefault('do_translation_y', False)
        super(DistToCenterWidget, self).__init__(**kwargs)

        self.image = Image(source='data/reticules/distcenter/dist_to_center_reticule.png')
        self.image.size = self.image.texture_size
        self.add_widget(self.image)

        self.label = DistanceLabel()
        self.label.markup = True
        self.label.pos = self.image.width + dp(5), self.image.height / 2 - dp(8)
        self.add_widget(self.label)

        self.pos = Window.size[0] / 2 - self.image.width / 2, Window.size[1] / 2 - self.image.height / 2
GravBox.py 文件源码 项目:GravBox 作者: GravBoxInterface 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def on_touch_down(self, touch):

        with self.canvas:

            if touch.x > self.x_bounds:
                self.out_of_bounds = True
                #print ('Touch down event out of bounds with x > %s \n' %(self.x_bounds))
                pass            

            elif touch.x < self.x_bounds:
                self.canvas.clear()
                d = 10
                Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d,d))
                touch.ud['line'] = Line(points=(touch.x, touch.y))
                #self.vector_length(touch.ud['line'])
                self.x_initial = touch.x
                self.y_initial = touch.y
                self.out_of_bounds = False
                print ('This is the initial x value: %s, \nThis is the initial y value: %s \n\n' %(self.x_initial, self.y_initial))
gravbox-master-erin.py 文件源码 项目:GravBox 作者: GravBoxInterface 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def userInput(self, *args): # function to save user input and take output from algorithm

        name_of_file = 'algorithm_input'# USER INPUT FILENAME
        inputFileName = os.path.join(assetsdirectory, name_of_file+'.txt') #TOTAL PATH NAME

        with open(inputFileName, 'w') as f: # create file and write initial and final coordinate positions
        f.write('%f\t%f\t%f\t%f' % (drawUtility.x_initial, drawUtility.y_initial, drawUtility.x_final, drawUtility.y_final))

        drawUtility.canvas.clear()
        particle = Particle(pos = (drawUtility.x_initial, drawUtility.y_initial), size = (10, 10)) # draw a particle at chosen initial position
        drawUtility.add_widget(particle)    

    while os.path.isfile('algorithm_output.npy') == False: # search for output file
        sleep(1)
        print "Still no file"
    else:
        print "File found!"

        #x,y = np.load('algorithm_output.npy') # load in algorithm output
        #xs = np.split(x, len(x)/200, 0); ys = np.split(y, len(y)/200, 0) # split x and y arrays into manageable chunks for animation

        x = np.load('mylistx.npy'); xs = np.split(x, len(x)/200, 0) # test data
            y = np.load('mylisty.npy'); ys = np.split(y, len(y)/200, 0)

            self.animate(xs, ys, 0, particle) # call animation function with output data
main.py 文件源码 项目:GravBox 作者: GravBoxInterface 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def userInput(self, *args): # function to save user input and take output from algorithm

        name_of_file = 'algorithm_input'# USER INPUT FILENAME
        inputFileName = os.path.join(assetsdirectory, name_of_file+'.txt') #TOTAL PATH NAME

        with open(inputFileName, 'w') as f: # create file and write initial and final coordinate positions
            f.write('%f\t%f\t%f\t%f' % (drawUtility.x_initial, drawUtility.y_initial, drawUtility.x_final, drawUtility.y_final))

        drawUtility.canvas.clear()
        particle = Particle(pos = (drawUtility.x_initial, drawUtility.y_initial), size = (10, 10)) # draw a particle at chosen initial position
        drawUtility.add_widget(particle)    

        while os.path.isfile('algorithm_output.npy') == False: # search for output file
            sleep(1)
            print ("Still no file")
        else:
            #x = np.load('mylistx.npy'); xs = np.split(x, len(x)/200, 0) # test data
            #y = np.load('mylisty.npy'); ys = np.split(y, len(y)/200, 0)
            print ("File found!")

            x,y = np.load('algorithm_output.npy') # load in algorithm output
            xs = np.split(x, len(x)/200, 0); ys = np.split(y, len(y)/200, 0) # split x and y arrays into manageable chunks for animation

            #self.animate(xs, ys, 0, particle) # call animation function with output data
GravBoxMaster.py 文件源码 项目:GravBox 作者: GravBoxInterface 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def userInput(self, *args): # function to save user input and take output from algorithm

        name_of_file = 'algorithm_input'# USER INPUT FILENAME
        inputFileName = os.path.join(assetsdirectory, name_of_file+'.txt') #TOTAL PATH NAME

        with open(inputFileName, 'w') as f: # create file and write initial and final coordinate positions
            f.write('%f\t%f\t%f\t%f' % (drawUtility.x_initial, drawUtility.y_initial, drawUtility.x_final, drawUtility.y_final))

        drawUtility.canvas.clear()
        particle = Particle(pos = (drawUtility.x_initial, drawUtility.y_initial), size = (10, 10)) # draw a particle at chosen initial position
        drawUtility.add_widget(particle)    

        while os.path.isfile('algorithm_output.npy') == False: # search for output file
            sleep(1)
            print ("Still no file")
        else:
            x = np.load('mylistx.npy'); xs = np.split(x, len(x)/200, 0) # test data
            y = np.load('mylisty.npy'); ys = np.split(y, len(y)/200, 0)
            print ("File found!")

        #x,y = np.load('algorithm_output.npy') # load in algorithm output
        #xs = np.split(x, len(x)/200, 0); ys = np.split(y, len(y)/200, 0) # split x and y arrays into manageable chunks for animation

            self.animate(xs, ys, 0, particle) # call animation function with output data
program.py 文件源码 项目:HeaTDV4A 作者: HeaTTheatR 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def on_config_change(self, config, section, key, value):
        """?????????? ??? ?????? ?????? ?? ?????? ???????? ?????????."""

        def select_callback(*args):
            file_manager.body.dismiss()
            self.downloadfolder[1] = file_manager.select_folder
            config.set("General", "downloadkey", "1")
            config.set("General", "downloadfolder", str(self.downloadfolder))
            config.write()

        # TODO: ???????? ???????? ??????? ?? ???? ? ????????? ???????????.
        if key == "downloadkey" and int(value):  # "????????? ????????"
            file_manager = \
                FileChooser(select_callback=select_callback, filter="folder",
                            title=core.string_lang_select_folder,
                            background_image=self.core.theme_decorator_window,
                            auto_dismiss=False,  size=(.85, .9),)
        elif key == "downloadkey" and not int(value):
            self.downloadfolder[1] = ""
            config.set("General", "downloadkey", "0")
            config.set("General", "downloadfolder", str(self.downloadfolder))
            config.write()
        elif key == "checkattachtoforum":  # "???????? ????? ??????"
            self.checkattachtoforum = int(value)
        elif key == "progresstextsize":  # "???????? ??????? ??????"
            self.window_text_size = int(value)
        elif key == "edittheme":  # "?????? ??????? ????????????? ????"
            self.edit_pallete_theme()
kdialog.py 文件源码 项目:HeaTDV4A 作者: HeaTTheatR 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _update_canvas_size(self, instance, value):
        """?????????? ??? ????????? ??????? ?????? ??????????.

        type instance: instance <kivy.uix.gridlayout.GridLayout object'>;

        type value: list;
        param value: ??????? ?????? instance;

        """

        self.canvas_for_box_content.pos = instance.pos
        self.canvas_for_box_content.size = instance.size

        # ????????? ??????? ???? Popup - ???? ?????????.
        if self.param in ["text", "tel", "address", "mail", "password",
                          "datetime", "number"]:
            plus_height = 170
        elif self.param == "logpass":
            plus_height = 200
        else:
            plus_height = 120

        self.body.height = self.canvas_for_box_content.size[1] + plus_height
        self.body.width = int(Window.size[0] / self.size_hint_x)

        if self.body.height > Window.size[1]:
            self.body.height = Window.size[1] - 10

        if self.rst:
            self.message.height = self.body.height / 1.33
gap.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def unilabel(self, params):
        self.unilabels.append([])
        if self.kivy:
            from kivy.uix.label import Label
            self.unilabels[len(self.unilabels) - 1] = Label(pos = \
                (params[0] * self.xratio, params[1] * self.yratio), \
                size_hint=(1.0,1.0), halign="left", \
                valign="bottom", text = params[4])
            self.unilabels[len(self.unilabels) - 1].font_size = 17.5 * \
                self.yratio
            self.unilabels[len(self.unilabels) - 1].bind(size= \
                self.unilabels[len(self.unilabels) - 1].setter('text_size'))
            self.root.add_widget(self.unilabels[len(self.unilabels) - 1])

        else:

            import ui
            self.unilabels[len(self.unilabels) - 1] = ui.Label(frame= \
                (params[0] * self.xratio,  (600 - params[1] - params[3]) * \
                self.yratio, params[2] * self.xratio, params[3] * self.yratio))
            self.unilabels[len(self.unilabels) - 1].text = params[4]
            self.unilabels[len(self.unilabels) - 1].text_color = 'white'
            self.unilabels[len(self.unilabels) - 1].alignment = \
                ALIGN_LEFT = True
            self.unilabels[len(self.unilabels) - 1].font = ('<system>', 18 * \
                self.xratio)
            self.root.add_subview(self.unilabels[len(self.unilabels) - 1])
gap21.py 文件源码 项目:GAP 作者: Tileyon 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def unilabel(self, params):
        self.unilabels.append([])
        if self.kivy:
            from kivy.uix.label import Label
            self.unilabels[len(self.unilabels) - 1] = Label(pos = \
                (params[0] * self.xratio, params[1] * self.yratio), \
                size_hint=(1.0,1.0), halign="left", \
                valign="bottom", text = params[4])
            self.unilabels[len(self.unilabels) - 1].font_size = 17.5 * \
                self.yratio
            self.unilabels[len(self.unilabels) - 1].bind(size= \
                self.unilabels[len(self.unilabels) - 1].setter('text_size'))
            self.root.add_widget(self.unilabels[len(self.unilabels) - 1])

        else:

            import ui
            self.unilabels[len(self.unilabels) - 1] = ui.Label(frame= \
                (params[0] * self.xratio,  (600 - params[1] - params[3]) * \
                self.yratio, params[2] * self.xratio, params[3] * self.yratio))
            self.unilabels[len(self.unilabels) - 1].text = params[4]
            self.unilabels[len(self.unilabels) - 1].text_color = 'white'
            self.unilabels[len(self.unilabels) - 1].alignment = \
                ui.ALIGN_LEFT
            self.unilabels[len(self.unilabels) - 1].font = ('<system>', 18 * \
                self.yratio)
            self.root.add_subview(self.unilabels[len(self.unilabels) - 1])
theming.py 文件源码 项目:Blogs-Posts-Tutorials 作者: kiok46 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(ThemeManager, self).__init__(**kwargs)
        self.rec_shadow = Atlas('{}rec_shadow.atlas'.format(images_path))
        self.rec_st_shadow = Atlas('{}rec_st_shadow.atlas'.format(images_path))
        self.quad_shadow = Atlas('{}quad_shadow.atlas'.format(images_path))
        self.round_shadow = Atlas('{}round_shadow.atlas'.format(images_path))
        Clock.schedule_once(lambda x: self.on_theme_style(0, self.theme_style))
        self._determine_device_orientation(None, Window.size)
        Window.bind(size=self._determine_device_orientation)
tabs.py 文件源码 项目:Blogs-Posts-Tutorials 作者: kiok46 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def build(self):
            from kivy.core.window import Window
            Window.size = (540, 720)
            # self.theme_cls.theme_style = 'Dark'

            return Builder.load_string("""
#:import Toolbar kivymd.toolbar.Toolbar
BoxLayout:
    orientation:'vertical'
    Toolbar:
        id: toolbar
        title: 'Page title'
        background_color: app.theme_cls.primary_color
        left_action_items: [['menu', lambda x: '']]
        right_action_items: [['search', lambda x: ''],['more-vert',lambda x:'']]
    MDTabbedPanel:
        id: tab_mgr
        tab_display_mode:'icons'

        MDTab:
            name: 'music' 
            text: "Music" # Why are these not set!!!
            icon: "playlist-audio"
            MDLabel:
                font_style: 'Body1'
                theme_text_color: 'Primary'
                text: "Here is my music list :)"
                halign: 'center'
        MDTab:
            name: 'movies'
            text: 'Movies'
            icon: "movie"

            MDLabel:
                font_style: 'Body1'
                theme_text_color: 'Primary'
                text: "Show movies here :)"
                halign: 'center'


""")
theming.py 文件源码 项目:mobileinsight-mobile 作者: mobile-insight 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(ThemeManager, self).__init__(**kwargs)
        self.rec_shadow = Atlas('{}rec_shadow.atlas'.format(images_path))
        self.rec_st_shadow = Atlas('{}rec_st_shadow.atlas'.format(images_path))
        self.quad_shadow = Atlas('{}quad_shadow.atlas'.format(images_path))
        self.round_shadow = Atlas('{}round_shadow.atlas'.format(images_path))
        Clock.schedule_once(lambda x: self.on_theme_style(0, self.theme_style))
        self._determine_device_orientation(None, Window.size)
        Window.bind(size=self._determine_device_orientation)


问题


面经


文章

微信
公众号

扫码关注公众号