Browse Source

Fix typos & code cleaning.

- Removed garden.filechooserthumbview dependency.
Bogdan Cordier 3 years ago
parent
commit
c7832922a9
8 changed files with 13 additions and 54 deletions
  1. 1
    1
      README.md
  2. 1
    8
      data/settings_panel.json
  3. 1
    1
      docs/interface.rst
  4. 1
    1
      hadaly.py
  5. 0
    0
      hadaly/__main__.py
  6. 5
    11
      hadaly/app.py
  7. 0
    2
      hadaly/editor.kv
  8. 4
    30
      hadaly/editor.py

+ 1
- 1
README.md View File

@@ -3,7 +3,7 @@
3 3
 <img align="right" height="200" src="https://github.com/octogene/hadaly/raw/master/docs/_static/logo/logo_2.png"/>
4 4
 
5 5
 
6
-This sofware is currently in beta.
6
+This sofware is currently in alpha.
7 7
 
8 8
 Hadaly is a presentation software allowing to manipulate slides, in various ways during presentation. The goal is to offer a practical presentation software for art historians or any other individual who wants to have a bit more interaction with their presentations.
9 9
 

+ 1
- 8
data/settings_panel.json View File

@@ -19,13 +19,6 @@
19 19
     "desc":"Time between each autosave in minutes (Not yet functional)", 
20 20
     "section":"editor", 
21 21
     "key":"autosave_time" },
22
-    
23
-  { "type":"bool",
24
-    "title":"File explorer thumbnail view",
25
-    "desc":"Activate thumbnail view in file explorer (Can be slow)",
26
-    "section":"editor",
27
-    "key":"thumbview",
28
-    "true":"auto" },
29 22
   
30 23
   { "type":"title", "title":"Viewer" },
31 24
   
@@ -67,4 +60,4 @@
67 60
   
68 61
   
69 62
 
70
-]
63
+]

+ 1
- 1
docs/interface.rst View File

@@ -78,7 +78,7 @@ Edit slide
78 78
 - Double click on the slide to show the edit dialog.
79 79
 
80 80
 Show slide informations
81
-^^^^^^^^^^^^^^^^^^^^^^^^
81
+^^^^^^^^^^^^^^^^^^^^^^^
82 82
 
83 83
 - Click on |info| to show/hide slide informations.
84 84
 

+ 1
- 1
hadaly.py View File

@@ -1,7 +1,7 @@
1 1
 #!/usr/bin/env python
2 2
 #-*- coding: utf-8 -*-
3 3
 
4
-from hadaly.main import main
4
+from hadaly.__main__ import main
5 5
 
6 6
 if __name__ == '__main__':
7 7
     main()

hadaly/main.py → hadaly/__main__.py View File


+ 5
- 11
hadaly/app.py View File

@@ -7,9 +7,9 @@ from kivy import require
7 7
 require('1.9.0')
8 8
 
9 9
 import os, json
10
-from sys import argv, getfilesystemencoding
10
+from sys import argv
11 11
 
12
-import main
12
+import __main__
13 13
 import urllib
14 14
 import re
15 15
 
@@ -29,7 +29,6 @@ Config.set('graphics', 'fullscreen', '0')
29 29
 
30 30
 from kivy.app import App
31 31
 from kivy.core.window import Window
32
-from kivy.metrics import dp
33 32
 from kivy.properties import StringProperty, ListProperty, DictProperty, NumericProperty
34 33
 from kivy.uix.screenmanager import ScreenManager, SlideTransition, FadeTransition
35 34
 from kivy.uix.popup import Popup
@@ -41,12 +40,11 @@ from viewer import SlideBox
41 40
 from kivy.logger import Logger
42 41
 from kivy.network.urlrequest import UrlRequest
43 42
 from hadaly.search import ItemButton
44
-import kivy.garden.filechooserthumbview
45 43
 from kivy.uix.filechooser import FileChooserIconView, FileChooserListView
46 44
 
47 45
 
48 46
 class HadalyApp(App):
49
-    presentation = DictProperty({'app': ('hadaly', main.__version__), 'title': 'New Title', 'slides': []})
47
+    presentation = DictProperty({'app': ('hadaly', __main__.__version__), 'title': 'New Title', 'slides': []})
50 48
 
51 49
     slides_list = ListProperty()
52 50
 
@@ -79,7 +77,6 @@ class HadalyApp(App):
79 77
         config.set('editor', 'autosave_time', '15')
80 78
         config.set('editor', 'autosave', '0')
81 79
         config.set('editor', 'font_size', '12')
82
-        config.set('editor', 'thumbview', '1')
83 80
         config.set('viewer', 'thumb', '1')
84 81
         config.set('viewer', 'thumb_pos', 'bottom left')
85 82
         config.set('viewer', 'font_size', '15')
@@ -151,7 +148,7 @@ class HadalyApp(App):
151 148
     def clear(self):
152 149
         self.root.current_screen.slides_view.grid_layout.clear_widgets()
153 150
         self.root.get_screen('viewer').carousel.clear_widgets()
154
-        self.presentation = {'app': ('hadaly', main.__version__), 'title': 'New Title', 'slides': []}
151
+        self.presentation = {'app': ('hadaly', __main__.__version__), 'title': 'New Title', 'slides': []}
155 152
         self.filename = self.dirname = ''
156 153
 
157 154
     def update_presentation(self, type, old_index, new_index):
@@ -193,10 +190,7 @@ class HadalyApp(App):
193 190
 
194 191
     def show_file_explorer(self):
195 192
         popup = Popup(size_hint=(0.8, 0.8))
196
-        if self.config.getint('editor', 'thumbview') == 1:
197
-            file_explorer = FileChooserThumbView(filters=['*.jpg', '*.png', '*.jpeg'])
198
-        else:
199
-            file_explorer = FileChooserListView(filters=['*.jpg', '*.png', '*.jpeg'])
193
+        file_explorer = FileChooserListView(filters=['*.jpg', '*.png', '*.jpeg'])
200 194
         file_explorer.bind(on_submit=self.show_add_slide)
201 195
         file_explorer.popup = popup
202 196
         popup.content = file_explorer

+ 0
- 2
hadaly/editor.kv View File

@@ -1,7 +1,5 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 #:kivy 1.9.0
3
-#:import FileThumbView hadaly.editor.FileThumbView
4
-#:import ThumbView hadaly.editor.ThumbView
5 3
 
6 4
 <EditorScreen@Screen>:
7 5
     slides_view: _slides_view

+ 4
- 30
hadaly/editor.py View File

@@ -6,42 +6,16 @@ from functools import partial
6 6
 
7 7
 from kivy.uix.boxlayout import BoxLayout
8 8
 from kivy.uix.popup import Popup
9
-from kivy.uix.button import ButtonBehavior
10
-from kivy.uix.image import Image
11 9
 from kivy.properties import StringProperty, ObjectProperty, NumericProperty, BooleanProperty
12 10
 from kivy.garden.magnet import Magnet
13
-from kivy.garden.filechooserthumbview import FileChooserThumbView
14 11
 from kivy.clock import Clock
15 12
 from kivy.logger import Logger
16 13
 from kivy.config import Config
17
-from PIL import Image as ImagePIL
14
+from PIL import Image
18 15
 from kivy.graphics.opengl import GL_MAX_TEXTURE_SIZE, glGetIntegerv
19 16
 from kivy.factory import Factory
20 17
 
21 18
 
22
-class FileThumbView(BoxLayout):
23
-    app = ObjectProperty(None)
24
-
25
-    def show_thumbnail(self):
26
-        self.thumb_grid.clear_widgets()
27
-        s = [item for item in self.file_chooser.files if item.endswith(('.png', '.jpg', '.jpeg'))]
28
-        for item in s:
29
-            thumb_src = self.app.create_thumbnail(item)
30
-            thumb = ThumbnailButton(source=thumb_src.encode('utf-8'),
31
-                                    keep_ratio=True,
32
-                                    size_hint=(None, None),
33
-                                    original_src=item.encode('utf-8'))
34
-            self.thumb_grid.add_widget(thumb)
35
-
36
-
37
-class ThumbView(FileChooserThumbView):
38
-    pass
39
-
40
-
41
-class ThumbnailButton(ButtonBehavior, Image):
42
-    original_src = StringProperty(None)
43
-
44
-
45 19
 class Slide(BoxLayout):
46 20
     app = ObjectProperty(None)
47 21
     img_src = StringProperty(None)
@@ -63,7 +37,7 @@ class Slide(BoxLayout):
63 37
                 }
64 38
 
65 39
     def update_texture_size(self):
66
-        im = ImagePIL.open(os.path.join(self.app.tempdir, self.img_src))
40
+        im = Image.open(os.path.join(self.app.tempdir, self.img_src))
67 41
         self.texture_size = im.size
68 42
         return im.size
69 43
 
@@ -71,11 +45,11 @@ class Slide(BoxLayout):
71 45
         Logger.debug('Editor: img_src updated for {title}'.format(title=self.title))
72 46
         max_texture_size = glGetIntegerv(GL_MAX_TEXTURE_SIZE)[0]
73 47
         try:
74
-            im = ImagePIL.open(self.img_src)
48
+            im = Image.open(self.img_src)
75 49
             if max(im.size) > max_texture_size:
76 50
                 Logger.debug('Application : image too big for max texture size ! Resizing...')
77 51
                 size = self.app.resize(im.size, (max_texture_size, max_texture_size))
78
-                im.thumbnail(size, ImagePIL.ANTIALIAS)
52
+                im.thumbnail(size, Image.ANTIALIAS)
79 53
                 im.save(self.img_src)
80 54
         except IOError:
81 55
             Logger.debug('Editor: {img_src} is not a valid filename.'.format(img_src=self.img_src))

Loading…
Cancel
Save