forked from openlp/openlp
Moved thumbnail setting into the main settingstab.
This commit is contained in:
parent
a0b7c72e09
commit
a48589752f
@ -281,18 +281,23 @@ class ServiceItem(RegistryProperties):
|
|||||||
self.raw_footer = []
|
self.raw_footer = []
|
||||||
self.foot_text = '<br>'.join([_f for _f in self.raw_footer if _f])
|
self.foot_text = '<br>'.join([_f for _f in self.raw_footer if _f])
|
||||||
|
|
||||||
def add_from_image(self, path, title, background=None):
|
def add_from_image(self, path, title, background=None, thumbnail=None):
|
||||||
"""
|
"""
|
||||||
Add an image slide to the service item.
|
Add an image slide to the service item.
|
||||||
|
|
||||||
:param path: The directory in which the image file is located.
|
:param path: The directory in which the image file is located.
|
||||||
:param title: A title for the slide in the service item.
|
:param title: A title for the slide in the service item.
|
||||||
:param background:
|
:param background:
|
||||||
|
:param thumbnail: Optional alternative thumbnail
|
||||||
"""
|
"""
|
||||||
if background:
|
if background:
|
||||||
self.image_border = background
|
self.image_border = background
|
||||||
self.service_item_type = ServiceItemType.Image
|
self.service_item_type = ServiceItemType.Image
|
||||||
self._raw_frames.append({'title': title, 'path': path})
|
if thumbnail:
|
||||||
|
self._raw_frames.append({'title': title, 'path': path, 'image': thumbnail})
|
||||||
|
self.image_manager.add_image(thumbnail, ImageSource.ImagePlugin, self.image_border)
|
||||||
|
else:
|
||||||
|
self._raw_frames.append({'title': title, 'path': path})
|
||||||
self.image_manager.add_image(path, ImageSource.ImagePlugin, self.image_border)
|
self.image_manager.add_image(path, ImageSource.ImagePlugin, self.image_border)
|
||||||
self._new_item()
|
self._new_item()
|
||||||
|
|
||||||
|
@ -288,13 +288,13 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
os.path.join(doc.get_temp_folder(), 'mainslide001.png')):
|
os.path.join(doc.get_temp_folder(), 'mainslide001.png')):
|
||||||
doc.load_presentation()
|
doc.load_presentation()
|
||||||
i = 1
|
i = 1
|
||||||
image_file = 'mainslide%03d.png' % i
|
image = os.path.join(doc.get_temp_folder(), 'mainslide%03d.png' % i)
|
||||||
image = os.path.join(doc.get_temp_folder(), image_file)
|
thumbnail = os.path.join(doc.get_thumbnail_folder(), 'slide%d.png' % i)
|
||||||
while os.path.isfile(image):
|
while os.path.isfile(image):
|
||||||
service_item.add_from_image(image, name)
|
service_item.add_from_image(image, name, thumbnail=thumbnail)
|
||||||
i += 1
|
i += 1
|
||||||
image_file = 'mainslide%03d.png' % i
|
image = os.path.join(doc.get_temp_folder(), 'mainslide%03d.png' % i)
|
||||||
image = os.path.join(doc.get_temp_folder(), image_file)
|
thumbnail = os.path.join(doc.get_thumbnail_folder(), 'slide%d.png' % i)
|
||||||
service_item.add_capability(ItemCapabilities.HasThumbnails)
|
service_item.add_capability(ItemCapabilities.HasThumbnails)
|
||||||
doc.close_presentation()
|
doc.close_presentation()
|
||||||
return True
|
return True
|
||||||
|
@ -120,21 +120,6 @@
|
|||||||
<a href="#" id="controller-previous" data-role="button" data-icon="arrow-l">${prev}</a>
|
<a href="#" id="controller-previous" data-role="button" data-icon="arrow-l">${prev}</a>
|
||||||
<a href="#" id="controller-next" data-role="button" data-icon="arrow-r" data-iconpos="right">${next}</a>
|
<a href="#" id="controller-next" data-role="button" data-icon="arrow-r" data-iconpos="right">${next}</a>
|
||||||
</div>
|
</div>
|
||||||
<div data-role="controlgroup" data-type="horizontal" style="float:left">
|
|
||||||
<a href="#settings" id="controller-settings" data-role="button" data-icon="gear" data-rel="dialog">${settings}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div data-role="page" id="settings">
|
|
||||||
<div data-role="header" data-position="inline" data-theme="b">
|
|
||||||
<h1>${settings}</h1>
|
|
||||||
</div>
|
|
||||||
<div data-role="content">
|
|
||||||
Display thumbnails:
|
|
||||||
<div data-role="controlgroup" data-type="horizontal">
|
|
||||||
<a href="#" id="display-thumbnails" data-role="button">Yes</a>
|
|
||||||
<a href="#" id="dont-display-thumbnails" data-role="button">No</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div data-role="page" id="alerts">
|
<div data-role="page" id="alerts">
|
||||||
|
@ -98,7 +98,7 @@ window.OpenLP = {
|
|||||||
if (slide["notes"])
|
if (slide["notes"])
|
||||||
text += ("<div style='font-size:smaller;font-weight:normal'>" + slide["notes"] + "</div>");
|
text += ("<div style='font-size:smaller;font-weight:normal'>" + slide["notes"] + "</div>");
|
||||||
text = text.replace(/\n/g, '<br />');
|
text = text.replace(/\n/g, '<br />');
|
||||||
if (slide["img"] && OpenLP.showThumbnails)
|
if (slide["img"])
|
||||||
text += "<img src='" + slide["img"].replace("/thumbnails/", "/thumbnails80x80/") + "'>";
|
text += "<img src='" + slide["img"].replace("/thumbnails/", "/thumbnails80x80/") + "'>";
|
||||||
var li = $("<li data-icon=\"false\">").append(
|
var li = $("<li data-icon=\"false\">").append(
|
||||||
$("<a href=\"#\">").html(text));
|
$("<a href=\"#\">").html(text));
|
||||||
@ -251,17 +251,6 @@ window.OpenLP = {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
displayThumbnails: function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
var target = $(event.target);
|
|
||||||
OpenLP.showThumbnails = target.text() == "No" ? false : true;
|
|
||||||
var dt = new Date();
|
|
||||||
dt.setTime(dt.getTime() + 365 * 24 * 60 * 60 * 1000);
|
|
||||||
document.cookie = "displayThumbs=" + OpenLP.showThumbnails + "; expires=" +
|
|
||||||
dt.toGMTString() + "; path=/";
|
|
||||||
OpenLP.loadController();
|
|
||||||
$("#settings").dialog("close");
|
|
||||||
},
|
|
||||||
search: function (event) {
|
search: function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var query = OpenLP.escapeString($("#search-text").val())
|
var query = OpenLP.escapeString($("#search-text").val())
|
||||||
@ -341,24 +330,12 @@ window.OpenLP = {
|
|||||||
},
|
},
|
||||||
escapeString: function (string) {
|
escapeString: function (string) {
|
||||||
return string.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")
|
return string.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")
|
||||||
},
|
}
|
||||||
showThumbnails: false
|
|
||||||
}
|
}
|
||||||
// Initial jQueryMobile options
|
// Initial jQueryMobile options
|
||||||
$(document).bind("mobileinit", function(){
|
$(document).bind("mobileinit", function(){
|
||||||
$.mobile.defaultDialogTransition = "none";
|
$.mobile.defaultDialogTransition = "none";
|
||||||
$.mobile.defaultPageTransition = "none";
|
$.mobile.defaultPageTransition = "none";
|
||||||
var cookies = document.cookie;
|
|
||||||
if( cookies )
|
|
||||||
{
|
|
||||||
var allcookies = cookies.split(";")
|
|
||||||
for(ii = 0; ii < allcookies.length; ii++)
|
|
||||||
{
|
|
||||||
var parts = allcookies[ii].split("=");
|
|
||||||
if(parts.length == 2 && parts[0] == "displayThumbs")
|
|
||||||
OpenLP.showThumbnails = (parts[1]=='true');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
// Service Manager
|
// Service Manager
|
||||||
$("#service-manager").live("pagebeforeshow", OpenLP.loadService);
|
$("#service-manager").live("pagebeforeshow", OpenLP.loadService);
|
||||||
@ -378,8 +355,6 @@ $("#controller-blank").live("click", OpenLP.blankDisplay);
|
|||||||
$("#controller-theme").live("click", OpenLP.themeDisplay);
|
$("#controller-theme").live("click", OpenLP.themeDisplay);
|
||||||
$("#controller-desktop").live("click", OpenLP.desktopDisplay);
|
$("#controller-desktop").live("click", OpenLP.desktopDisplay);
|
||||||
$("#controller-show").live("click", OpenLP.showDisplay);
|
$("#controller-show").live("click", OpenLP.showDisplay);
|
||||||
$("#display-thumbnails").live("click", OpenLP.displayThumbnails);
|
|
||||||
$("#dont-display-thumbnails").live("click", OpenLP.displayThumbnails);
|
|
||||||
// Alerts
|
// Alerts
|
||||||
$("#alert-submit").live("click", OpenLP.showAlert);
|
$("#alert-submit").live("click", OpenLP.showAlert);
|
||||||
// Search
|
// Search
|
||||||
|
@ -503,7 +503,8 @@ class HttpRouter(RegistryProperties):
|
|||||||
item['tag'] = str(index + 1)
|
item['tag'] = str(index + 1)
|
||||||
item['text'] = str(frame['text'])
|
item['text'] = str(frame['text'])
|
||||||
item['html'] = str(frame['html'])
|
item['html'] = str(frame['html'])
|
||||||
elif current_item.is_image():
|
elif current_item.is_image() and not frame['image'] and Settings().value('remotes/thumbnails'):
|
||||||
|
# and not frame['title'].endswith('pdf') and not frame['title'].endswith('xps'):
|
||||||
item['tag'] = str(index + 1)
|
item['tag'] = str(index + 1)
|
||||||
thumbnail_path = os.path.sep + os.path.join('images', 'thumbnails', frame['title'])
|
thumbnail_path = os.path.sep + os.path.join('images', 'thumbnails', frame['title'])
|
||||||
item['img'] = urllib.request.pathname2url(thumbnail_path)
|
item['img'] = urllib.request.pathname2url(thumbnail_path)
|
||||||
@ -515,9 +516,11 @@ class HttpRouter(RegistryProperties):
|
|||||||
item['title'] = str(frame['display_title'])
|
item['title'] = str(frame['display_title'])
|
||||||
if current_item.is_capable(ItemCapabilities.HasNotes):
|
if current_item.is_capable(ItemCapabilities.HasNotes):
|
||||||
item['notes'] = str(frame['notes'])
|
item['notes'] = str(frame['notes'])
|
||||||
if current_item.is_capable(ItemCapabilities.HasThumbnails):
|
if current_item.is_capable(ItemCapabilities.HasThumbnails) and \
|
||||||
|
Settings().value('remotes/thumbnails'):
|
||||||
# If the file is under our app directory tree send the portion after the match
|
# If the file is under our app directory tree send the portion after the match
|
||||||
data_path = AppLocation.get_data_path()
|
data_path = AppLocation.get_data_path()
|
||||||
|
print(frame)
|
||||||
if frame['image'][0:len(data_path)] == data_path:
|
if frame['image'][0:len(data_path)] == data_path:
|
||||||
item['img'] = urllib.request.pathname2url(frame['image'][len(data_path):])
|
item['img'] = urllib.request.pathname2url(frame['image'][len(data_path):])
|
||||||
item['text'] = str(frame['title'])
|
item['text'] = str(frame['title'])
|
||||||
|
@ -62,6 +62,9 @@ class RemoteTab(SettingsTab):
|
|||||||
self.twelve_hour_check_box = QtGui.QCheckBox(self.server_settings_group_box)
|
self.twelve_hour_check_box = QtGui.QCheckBox(self.server_settings_group_box)
|
||||||
self.twelve_hour_check_box.setObjectName('twelve_hour_check_box')
|
self.twelve_hour_check_box.setObjectName('twelve_hour_check_box')
|
||||||
self.server_settings_layout.addRow(self.twelve_hour_check_box)
|
self.server_settings_layout.addRow(self.twelve_hour_check_box)
|
||||||
|
self.thumbnails_check_box = QtGui.QCheckBox(self.server_settings_group_box)
|
||||||
|
self.thumbnails_check_box.setObjectName('thumbnails_check_box')
|
||||||
|
self.server_settings_layout.addRow(self.thumbnails_check_box)
|
||||||
self.left_layout.addWidget(self.server_settings_group_box)
|
self.left_layout.addWidget(self.server_settings_group_box)
|
||||||
self.http_settings_group_box = QtGui.QGroupBox(self.left_column)
|
self.http_settings_group_box = QtGui.QGroupBox(self.left_column)
|
||||||
self.http_settings_group_box.setObjectName('http_settings_group_box')
|
self.http_settings_group_box.setObjectName('http_settings_group_box')
|
||||||
@ -163,6 +166,7 @@ class RemoteTab(SettingsTab):
|
|||||||
self.left_layout.addStretch()
|
self.left_layout.addStretch()
|
||||||
self.right_layout.addStretch()
|
self.right_layout.addStretch()
|
||||||
self.twelve_hour_check_box.stateChanged.connect(self.on_twelve_hour_check_box_changed)
|
self.twelve_hour_check_box.stateChanged.connect(self.on_twelve_hour_check_box_changed)
|
||||||
|
self.thumbnails_check_box.stateChanged.connect(self.on_thumbnails_check_box_changed)
|
||||||
self.address_edit.textChanged.connect(self.set_urls)
|
self.address_edit.textChanged.connect(self.set_urls)
|
||||||
self.port_spin_box.valueChanged.connect(self.set_urls)
|
self.port_spin_box.valueChanged.connect(self.set_urls)
|
||||||
self.https_port_spin_box.valueChanged.connect(self.set_urls)
|
self.https_port_spin_box.valueChanged.connect(self.set_urls)
|
||||||
@ -176,6 +180,7 @@ class RemoteTab(SettingsTab):
|
|||||||
self.stage_url_label.setText(translate('RemotePlugin.RemoteTab', 'Stage view URL:'))
|
self.stage_url_label.setText(translate('RemotePlugin.RemoteTab', 'Stage view URL:'))
|
||||||
self.live_url_label.setText(translate('RemotePlugin.RemoteTab', 'Live view URL:'))
|
self.live_url_label.setText(translate('RemotePlugin.RemoteTab', 'Live view URL:'))
|
||||||
self.twelve_hour_check_box.setText(translate('RemotePlugin.RemoteTab', 'Display stage time in 12h format'))
|
self.twelve_hour_check_box.setText(translate('RemotePlugin.RemoteTab', 'Display stage time in 12h format'))
|
||||||
|
self.thumbnails_check_box.setText(translate('RemotePlugin.RemoteTab', 'Show thumbnails of non-text slides in remote and stage view.'))
|
||||||
self.android_app_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Android App'))
|
self.android_app_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Android App'))
|
||||||
self.qr_description_label.setText(
|
self.qr_description_label.setText(
|
||||||
translate('RemotePlugin.RemoteTab', 'Scan the QR code or click <a href="https://play.google.com/store/'
|
translate('RemotePlugin.RemoteTab', 'Scan the QR code or click <a href="https://play.google.com/store/'
|
||||||
@ -240,6 +245,8 @@ class RemoteTab(SettingsTab):
|
|||||||
self.address_edit.setText(Settings().value(self.settings_section + '/ip address'))
|
self.address_edit.setText(Settings().value(self.settings_section + '/ip address'))
|
||||||
self.twelve_hour = Settings().value(self.settings_section + '/twelve hour')
|
self.twelve_hour = Settings().value(self.settings_section + '/twelve hour')
|
||||||
self.twelve_hour_check_box.setChecked(self.twelve_hour)
|
self.twelve_hour_check_box.setChecked(self.twelve_hour)
|
||||||
|
self.thumbnails = Settings().value(self.settings_section + '/thumbnails')
|
||||||
|
self.thumbnails_check_box.setChecked(self.thumbnails)
|
||||||
local_data = AppLocation.get_directory(AppLocation.DataDir)
|
local_data = AppLocation.get_directory(AppLocation.DataDir)
|
||||||
if not os.path.exists(os.path.join(local_data, 'remotes', 'openlp.crt')) or \
|
if not os.path.exists(os.path.join(local_data, 'remotes', 'openlp.crt')) or \
|
||||||
not os.path.exists(os.path.join(local_data, 'remotes', 'openlp.key')):
|
not os.path.exists(os.path.join(local_data, 'remotes', 'openlp.key')):
|
||||||
@ -271,6 +278,7 @@ class RemoteTab(SettingsTab):
|
|||||||
Settings().setValue(self.settings_section + '/https enabled', self.https_settings_group_box.isChecked())
|
Settings().setValue(self.settings_section + '/https enabled', self.https_settings_group_box.isChecked())
|
||||||
Settings().setValue(self.settings_section + '/ip address', self.address_edit.text())
|
Settings().setValue(self.settings_section + '/ip address', self.address_edit.text())
|
||||||
Settings().setValue(self.settings_section + '/twelve hour', self.twelve_hour)
|
Settings().setValue(self.settings_section + '/twelve hour', self.twelve_hour)
|
||||||
|
Settings().setValue(self.settings_section + '/thumbnails', self.thumbnails)
|
||||||
Settings().setValue(self.settings_section + '/authentication enabled', self.user_login_group_box.isChecked())
|
Settings().setValue(self.settings_section + '/authentication enabled', self.user_login_group_box.isChecked())
|
||||||
Settings().setValue(self.settings_section + '/user id', self.user_id.text())
|
Settings().setValue(self.settings_section + '/user id', self.user_id.text())
|
||||||
Settings().setValue(self.settings_section + '/password', self.password.text())
|
Settings().setValue(self.settings_section + '/password', self.password.text())
|
||||||
@ -285,6 +293,15 @@ class RemoteTab(SettingsTab):
|
|||||||
if check_state == QtCore.Qt.Checked:
|
if check_state == QtCore.Qt.Checked:
|
||||||
self.twelve_hour = True
|
self.twelve_hour = True
|
||||||
|
|
||||||
|
def on_thumbnails_check_box_changed(self, check_state):
|
||||||
|
"""
|
||||||
|
Toggle the thumbnail check box.
|
||||||
|
"""
|
||||||
|
self.thumbnails = False
|
||||||
|
# we have a set value convert to True/False
|
||||||
|
if check_state == QtCore.Qt.Checked:
|
||||||
|
self.thumbnails = True
|
||||||
|
|
||||||
def https_changed(self):
|
def https_changed(self):
|
||||||
"""
|
"""
|
||||||
Invert the HTTP group box based on Https group settings
|
Invert the HTTP group box based on Https group settings
|
||||||
|
@ -44,7 +44,8 @@ __default_settings__ = {
|
|||||||
'remotes/user id': 'openlp',
|
'remotes/user id': 'openlp',
|
||||||
'remotes/password': 'password',
|
'remotes/password': 'password',
|
||||||
'remotes/authentication enabled': False,
|
'remotes/authentication enabled': False,
|
||||||
'remotes/ip address': '0.0.0.0'
|
'remotes/ip address': '0.0.0.0',
|
||||||
|
'remotes/thumbnails': True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ __default_settings__ = {
|
|||||||
'remotes/user id': 'openlp',
|
'remotes/user id': 'openlp',
|
||||||
'remotes/password': 'password',
|
'remotes/password': 'password',
|
||||||
'remotes/authentication enabled': False,
|
'remotes/authentication enabled': False,
|
||||||
'remotes/ip address': '0.0.0.0'
|
'remotes/ip address': '0.0.0.0',
|
||||||
|
'remotes/ip address': True
|
||||||
}
|
}
|
||||||
ZERO_URL = '0.0.0.0'
|
ZERO_URL = '0.0.0.0'
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources'))
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources'))
|
||||||
|
Loading…
Reference in New Issue
Block a user