Commits

Anonymous committed a1b04fb Draft

fix list content and created apk

  • Participants
  • Parent commits 17c7161

Comments (0)

Files changed (2)

Kivyeditorcouchdb-0.2.0-debug.apk

Binary file added.
 from kivy.properties import ObjectProperty
 from kivy.app import App
 from kivy.core.window import Window
-from kivy.core.text import LabelBase
 from kivy.uix.accordion import Accordion, AccordionItem
 from kivy.uix.boxlayout import BoxLayout
 from kivy.uix.scrollview import ScrollView
 from kivy.uix.button import Button
 from kivy.uix.widget import Widget
 from kivy.uix.label import Label
+from kivy.uix.textinput import TextInput
 from kivy.graphics import Color, Rectangle
 from kivy.clock import Clock
 from kivy.lang import Builder
         self.db = Connect().connect_server()
         docs = self.db.all_docs()
         if not docs:
-            now = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
-            ctx = { 'title': 'Not title', 'paragraph': 'No paragraph', 'published': now }
-            self.wid = Builder.template('EntriesItem', **ctx)
+            layout = BoxLayout()
+            nodata = Labe(text='No data')
+            layout.add_widget(nodata)
+            scroll_view.add_widget(layout)
         else:
-            count = len(docs)
             for d in docs:
                 entry = self.db.get(d['id'])
                 title = entry['title']
                 self.paragraph.append(paragraph)
                 self.published.append(published)
                 # Create Layout
-                layout = GridLayout(cols=1, spacing=32, size_hint=(None, None))
+                layout = GridLayout(cols=1, spacing=10, size_hint_y=None)
                 layout.bind(minimum_height=layout.setter('height'))
-                layout.bind(minimum_width=layout.setter('width'))
+                # layout.bind(minimum_width=layout.setter('width'))
                 # Create Label for data
-                for i in range(count):
-                    for t, p, s in zip(self.title, self.paragraph, self.published):
-                        title = Label(text=str(t), size_hint_y=None, size=(34,64), height=40)
-                        paragraph = Label(text=str(p), size_hint_y=None, size=(34,64), height=40)
-                        published = Label(text=s, size_hint_y=None, size=(134,64), height=40)
-                        layout.add_widget(title)
-                        layout.add_widget(paragraph)
-                        layout.add_widget(published)
+                for t, p, s in zip(self.title, self.paragraph, self.published):
+                    title = TextInput(
+                        text=str(t),
+                        readonly=True,
+                        size_hint_y=None,
+                        font_size=15,
+                        height=35,
+                        foreground_color=(1, 1, 1, 1),
+                        background_color=(0, 0, 0, 1))
+                    paragraph = TextInput(
+                        text=str(p),
+                        readonly=True,
+                        size_hint_y=None,
+                        font_size=12,
+                        height=130,
+                        foreground_color=(1, 1, 1, 1),
+                        background_color=(0, 0, 0, 1))
+                    published = TextInput(
+                        text='Published: %s' % s,
+                        readonly=True,
+                        size_hint_y=None,
+                        font_size=10,
+                        height=30,
+                        foreground_color=(1, 1, 1, 1),
+                        background_color=(0, 0, 0, 1))
+                    separator = Label(
+                        text='[color=32a4ce]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/color]',
+                        markup = True)
+                    layout.add_widget(title)
+                    layout.add_widget(paragraph)
+                    layout.add_widget(published)
+                    layout.add_widget(separator)
                 # Create ScrollView
                 scroll_view = ScrollView()
                 scroll_view.center = Window.center
         """
         list_content = BoxLayout(orientation='horizontal')
 
-        self.content = content = BoxLayout()
+        self.content = content = BoxLayout(post_hint=(0, 0))
         list_content.add_widget(content)
         sc = Editor()
         sc.content.add_widget(list_content)