Browse Source

Fix typos & code cleaning.

- Removed garden.filechooserthumbview dependency.
fix_readme
octogene 6 years ago
parent
commit
c7832922a9
  1. 2
      README.md
  2. 9
      data/settings_panel.json
  3. 2
      docs/interface.rst
  4. 2
      hadaly.py
  5. 0
      hadaly/__main__.py
  6. 16
      hadaly/app.py
  7. 2
      hadaly/editor.kv
  8. 34
      hadaly/editor.py

2
README.md

@ -3,7 +3,7 @@
<img align="right" height="200" src="https://github.com/octogene/hadaly/raw/master/docs/_static/logo/logo_2.png"/>
This sofware is currently in beta.
This sofware is currently in alpha.
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
data/settings_panel.json

@ -19,13 +19,6 @@
"desc":"Time between each autosave in minutes (Not yet functional)",
"section":"editor",
"key":"autosave_time" },
{ "type":"bool",
"title":"File explorer thumbnail view",
"desc":"Activate thumbnail view in file explorer (Can be slow)",
"section":"editor",
"key":"thumbview",
"true":"auto" },
{ "type":"title", "title":"Viewer" },
@ -67,4 +60,4 @@
]
]

2
docs/interface.rst

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

2
hadaly.py

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

0
hadaly/main.py → hadaly/__main__.py

16
hadaly/app.py

@ -7,9 +7,9 @@ from kivy import require
require('1.9.0')
import os, json
from sys import argv, getfilesystemencoding
from sys import argv
import main
import __main__
import urllib
import re
@ -29,7 +29,6 @@ Config.set('graphics', 'fullscreen', '0')
from kivy.app import App
from kivy.core.window import Window
from kivy.metrics import dp
from kivy.properties import StringProperty, ListProperty, DictProperty, NumericProperty
from kivy.uix.screenmanager import ScreenManager, SlideTransition, FadeTransition
from kivy.uix.popup import Popup
@ -41,12 +40,11 @@ from viewer import SlideBox
from kivy.logger import Logger
from kivy.network.urlrequest import UrlRequest
from hadaly.search import ItemButton
import kivy.garden.filechooserthumbview
from kivy.uix.filechooser import FileChooserIconView, FileChooserListView
class HadalyApp(App):
presentation = DictProperty({'app': ('hadaly', main.__version__), 'title': 'New Title', 'slides': []})
presentation = DictProperty({'app': ('hadaly', __main__.__version__), 'title': 'New Title', 'slides': []})
slides_list = ListProperty()
@ -79,7 +77,6 @@ class HadalyApp(App):
config.set('editor', 'autosave_time', '15')
config.set('editor', 'autosave', '0')
config.set('editor', 'font_size', '12')
config.set('editor', 'thumbview', '1')
config.set('viewer', 'thumb', '1')
config.set('viewer', 'thumb_pos', 'bottom left')
config.set('viewer', 'font_size', '15')
@ -151,7 +148,7 @@ class HadalyApp(App):
def clear(self):
self.root.current_screen.slides_view.grid_layout.clear_widgets()
self.root.get_screen('viewer').carousel.clear_widgets()
self.presentation = {'app': ('hadaly', main.__version__), 'title': 'New Title', 'slides': []}
self.presentation = {'app': ('hadaly', __main__.__version__), 'title': 'New Title', 'slides': []}
self.filename = self.dirname = ''
def update_presentation(self, type, old_index, new_index):
@ -193,10 +190,7 @@ class HadalyApp(App):
def show_file_explorer(self):
popup = Popup(size_hint=(0.8, 0.8))
if self.config.getint('editor', 'thumbview') == 1:
file_explorer = FileChooserThumbView(filters=['*.jpg', '*.png', '*.jpeg'])
else:
file_explorer = FileChooserListView(filters=['*.jpg', '*.png', '*.jpeg'])
file_explorer = FileChooserListView(filters=['*.jpg', '*.png', '*.jpeg'])
file_explorer.bind(on_submit=self.show_add_slide)
file_explorer.popup = popup
popup.content = file_explorer

2
hadaly/editor.kv

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

34
hadaly/editor.py

@ -6,42 +6,16 @@ from functools import partial
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
from kivy.uix.button import ButtonBehavior
from kivy.uix.image import Image
from kivy.properties import StringProperty, ObjectProperty, NumericProperty, BooleanProperty
from kivy.garden.magnet import Magnet
from kivy.garden.filechooserthumbview import FileChooserThumbView
from kivy.clock import Clock
from kivy.logger import Logger
from kivy.config import Config
from PIL import Image as ImagePIL
from PIL import Image
from kivy.graphics.opengl import GL_MAX_TEXTURE_SIZE, glGetIntegerv
from kivy.factory import Factory
class FileThumbView(BoxLayout):
app = ObjectProperty(None)
def show_thumbnail(self):
self.thumb_grid.clear_widgets()
s = [item for item in self.file_chooser.files if item.endswith(('.png', '.jpg', '.jpeg'))]
for item in s:
thumb_src = self.app.create_thumbnail(item)
thumb = ThumbnailButton(source=thumb_src.encode('utf-8'),
keep_ratio=True,
size_hint=(None, None),
original_src=item.encode('utf-8'))
self.thumb_grid.add_widget(thumb)
class ThumbView(FileChooserThumbView):
pass
class ThumbnailButton(ButtonBehavior, Image):
original_src = StringProperty(None)
class Slide(BoxLayout):
app = ObjectProperty(None)
img_src = StringProperty(None)
@ -63,7 +37,7 @@ class Slide(BoxLayout):
}
def update_texture_size(self):
im = ImagePIL.open(os.path.join(self.app.tempdir, self.img_src))
im = Image.open(os.path.join(self.app.tempdir, self.img_src))
self.texture_size = im.size
return im.size
@ -71,11 +45,11 @@ class Slide(BoxLayout):
Logger.debug('Editor: img_src updated for {title}'.format(title=self.title))
max_texture_size = glGetIntegerv(GL_MAX_TEXTURE_SIZE)[0]
try:
im = ImagePIL.open(self.img_src)
im = Image.open(self.img_src)
if max(im.size) > max_texture_size:
Logger.debug('Application : image too big for max texture size ! Resizing...')
size = self.app.resize(im.size, (max_texture_size, max_texture_size))
im.thumbnail(size, ImagePIL.ANTIALIAS)
im.thumbnail(size, Image.ANTIALIAS)
im.save(self.img_src)
except IOError:
Logger.debug('Editor: {img_src} is not a valid filename.'.format(img_src=self.img_src))

Loading…
Cancel
Save