[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Re: Re: [pygame] Pygame-UI: UI Component Framework for python and pygame



Hi Jake,

To answer your questions:

1. For rendering I'm currently doing blit.

2. CSS parser is a great idea but initially I would like to implement a configuration manager using XML because this provides me with the opportunity of implementing a designer later on when I have enough quality components to build it with.

Question:

Why do you consider having CSS properties as attributes in the XML node wrong? The XML you have provided has width and height properties as attributes and font-size as a node content, shouldn't they all be nodes or attributes to be consistent? I'm not saying yours is wrong just wanted to know the reasoning behind it. 

Currently in my branch code I am implementing the configuration manager as a separate class that is being instantiated inside the base component and that finds the XML node by ID attribute where the ID is the ID of the control. To have all components instantiated from the existing XML I am using the component collection constructor with the config (XML) path provided to it. It goes through the nodes and instantiates each component by getting the component type, be it an ImageBox or a Button, from the XML and instantiating the component with the XML node attribute. Let me know what you think! I would soon have this code committed and once I make sure it works as expected, I would have it merged to trunk. 


---- OriginalMessage ----
From: "Jake b" <ninmonkeys@xxxxxxxxx>
To: pygame-users@xxxxxxxx
Sent: Sun, Jul 03, 2011, 04:28 AM
Subject: Re: Re: [pygame] Pygame-UI: UI Component Framework for python and pygame

For rendering, what do you plan on doing? ( blit, opengl, svg_blit, pygame.draw )

My main request for reusability is loading a .css file.
If for XML, I tried this. [ Using attributes for sll style info seemed wrong. ]

<configuration>
        <component name="inventory left" width="200px" height="150px">
            <parent>inventory root</parent>
            <type>window frame</type>
            <!-- load base, except set font size -->
            <basestyle>inventory.css</basestyle>
            <style>font-size: 20px;</style>
        </component>
        <component name="inventory right" width="100px" height="150px">
            <parent>inventory root</parent>
            <type>window frame</type>
            <basestyle>inventory.css</basestyle>
            <style>font-size: 12px;</style>
        </component>
</configuration>

Or, you could define that in xml:

<configuration>
    <stylelist>
        <style id="inventory base">font-size: 1em; color:gray; font-family: sans-serif;</style>
    </stylelist>
 
    <component name="inventory left pane" basestyle="inventory base" width="200px" height="150px">
        <parent>inventory root</parent>
        <type>window frame</type>
        <style>font-size: 20px;</style>
    </component>
   
    <component name="inventory right pane" basestyle="inventory base" width="100px" height="150px">
        <parent>inventory root</parent>
        <type>window frame</type>
        <style>font-size: 12px;</style>
    </component>
</configuration>





--
Jake