[WebUI][#2009] Add About window
- Add an About window to see version details like GTKUI. - The author and license text were left out as unnecessary. - Added a daemon get_version method since daemon version was not available through the json-api. - Fix LookupResource to ensure path exists when rendering.
This commit is contained in:
parent
c01679de1f
commit
9264cb749e
|
@ -182,6 +182,11 @@ class Daemon(object):
|
||||||
"""Returns a list of the exported methods."""
|
"""Returns a list of the exported methods."""
|
||||||
return self.rpcserver.get_method_list()
|
return self.rpcserver.get_method_list()
|
||||||
|
|
||||||
|
@export()
|
||||||
|
def get_version(self):
|
||||||
|
"""Returns the daemon version"""
|
||||||
|
return get_version()
|
||||||
|
|
||||||
@export(1)
|
@export(1)
|
||||||
def authorized_call(self, rpc):
|
def authorized_call(self, rpc):
|
||||||
"""Determines if session auth_level is authorized to call RPC.
|
"""Determines if session auth_level is authorized to call RPC.
|
||||||
|
|
|
@ -21,12 +21,16 @@ button::-moz-focus-inner {
|
||||||
background-image: url('../icons/deluge.png') !important;
|
background-image: url('../icons/deluge.png') !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tbar-deluge-text.x-item-disabled * {
|
.x-deluge-logo {
|
||||||
|
background-image: url('../ui_images/deluge-about.png');
|
||||||
|
}
|
||||||
|
|
||||||
|
#tbar-deluge-text * {
|
||||||
color: black !important;
|
color: black !important;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tbar-deluge-text.x-item-disabled {
|
#tbar-deluge-text {
|
||||||
opacity: 1 !important;
|
opacity: 1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,129 @@
|
||||||
|
/**
|
||||||
|
* Deluge.AboutWindow.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
|
* the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
|
* See LICENSE for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
Ext.namespace('Deluge.about');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Deluge.about.AboutWindow
|
||||||
|
* @extends Ext.Window
|
||||||
|
*/
|
||||||
|
Deluge.about.AboutWindow = Ext.extend(Ext.Window, {
|
||||||
|
id: 'AboutWindow',
|
||||||
|
title: _('About Deluge'),
|
||||||
|
height: 330,
|
||||||
|
width: 270,
|
||||||
|
iconCls: 'x-deluge-main-panel',
|
||||||
|
resizable: false,
|
||||||
|
plain: true,
|
||||||
|
layout: {
|
||||||
|
type: 'vbox',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
buttonAlign: 'center',
|
||||||
|
|
||||||
|
initComponent: function() {
|
||||||
|
Deluge.about.AboutWindow.superclass.initComponent.call(this);
|
||||||
|
this.addEvents({
|
||||||
|
build_ready: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
var libtorrent = function() {
|
||||||
|
deluge.client.core.get_libtorrent_version({
|
||||||
|
success: function(lt_version) {
|
||||||
|
comment += '<br/>' + _('libtorrent:') + ' ' + lt_version;
|
||||||
|
Ext.getCmp('about_comment').setText(comment, false);
|
||||||
|
self.fireEvent('build_ready');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var client_version = deluge.version;
|
||||||
|
|
||||||
|
var comment =
|
||||||
|
_(
|
||||||
|
'A peer-to-peer file sharing program\nutilizing the BitTorrent protocol.'
|
||||||
|
).replace('\n', '<br/>') +
|
||||||
|
'<br/><br/>' +
|
||||||
|
_('Client:') +
|
||||||
|
' ' +
|
||||||
|
client_version +
|
||||||
|
'<br/>';
|
||||||
|
deluge.client.web.connected({
|
||||||
|
success: function(connected) {
|
||||||
|
if (connected) {
|
||||||
|
deluge.client.daemon.get_version({
|
||||||
|
success: function(server_version) {
|
||||||
|
comment +=
|
||||||
|
_('Server:') + ' ' + server_version + '<br/>';
|
||||||
|
libtorrent();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.fireEvent('build_ready');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: function() {
|
||||||
|
this.fireEvent('build_ready');
|
||||||
|
},
|
||||||
|
scope: this,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.add([
|
||||||
|
{
|
||||||
|
xtype: 'box',
|
||||||
|
style: 'padding-top: 5px',
|
||||||
|
height: 80,
|
||||||
|
width: 240,
|
||||||
|
cls: 'x-deluge-logo',
|
||||||
|
hideLabel: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'label',
|
||||||
|
style: 'padding-top: 10px; font-weight: bold; font-size: 16px;',
|
||||||
|
text: _('Deluge') + ' ' + client_version,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'label',
|
||||||
|
id: 'about_comment',
|
||||||
|
style: 'padding-top: 10px; text-align:center; font-size: 12px;',
|
||||||
|
html: comment,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'label',
|
||||||
|
style: 'padding-top: 10px; font-size: 10px;',
|
||||||
|
text: _('Copyright 2007-2018 Deluge Team'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'label',
|
||||||
|
style: 'padding-top: 5px; font-size: 12px;',
|
||||||
|
html:
|
||||||
|
'<a href="https://deluge-torrent.org" target="_blank">deluge-torrent.org</a>',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
this.addButton(_('Close'), this.onCloseClick, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
show: function() {
|
||||||
|
this.on('build_ready', function() {
|
||||||
|
Deluge.about.AboutWindow.superclass.show.call(this);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onCloseClick: function() {
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Ext.namespace('Deluge');
|
||||||
|
|
||||||
|
Deluge.About = function() {
|
||||||
|
new Deluge.about.AboutWindow().show();
|
||||||
|
};
|
|
@ -20,9 +20,9 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
id: 'tbar-deluge-text',
|
id: 'tbar-deluge-text',
|
||||||
disabled: true,
|
|
||||||
text: _('Deluge'),
|
text: _('Deluge'),
|
||||||
iconCls: 'x-deluge-main-panel',
|
iconCls: 'x-deluge-main-panel',
|
||||||
|
handler: this.onAboutClick,
|
||||||
},
|
},
|
||||||
new Ext.Toolbar.Separator(),
|
new Ext.Toolbar.Separator(),
|
||||||
{
|
{
|
||||||
|
@ -161,6 +161,11 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
|
||||||
window.open('http://dev.deluge-torrent.org/wiki/UserGuide');
|
window.open('http://dev.deluge-torrent.org/wiki/UserGuide');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onAboutClick: function() {
|
||||||
|
var about = new Deluge.about.AboutWindow();
|
||||||
|
about.show();
|
||||||
|
},
|
||||||
|
|
||||||
onPreferencesClick: function() {
|
onPreferencesClick: function() {
|
||||||
deluge.preferences.show();
|
deluge.preferences.show();
|
||||||
},
|
},
|
||||||
|
|
|
@ -251,8 +251,8 @@ class LookupResource(resource.Resource, component.Component):
|
||||||
if path in self.__paths:
|
if path in self.__paths:
|
||||||
filename = os.path.basename(request.path).decode()
|
filename = os.path.basename(request.path).decode()
|
||||||
for directory in self.__paths[path]:
|
for directory in self.__paths[path]:
|
||||||
if os.path.join(directory, filename):
|
path = os.path.join(directory, filename)
|
||||||
path = os.path.join(directory, filename)
|
if os.path.isfile(path):
|
||||||
log.debug('Serving path: %s', path)
|
log.debug('Serving path: %s', path)
|
||||||
mime_type = mimetypes.guess_type(path)
|
mime_type = mimetypes.guess_type(path)
|
||||||
request.setHeader(b'content-type', mime_type[0].encode())
|
request.setHeader(b'content-type', mime_type[0].encode())
|
||||||
|
@ -461,6 +461,12 @@ class TopLevel(resource.Resource):
|
||||||
self.putChild(b'flag', Flag())
|
self.putChild(b'flag', Flag())
|
||||||
self.putChild(b'icons', LookupResource('Icons', rpath('icons')))
|
self.putChild(b'icons', LookupResource('Icons', rpath('icons')))
|
||||||
self.putChild(b'images', LookupResource('Images', rpath('images')))
|
self.putChild(b'images', LookupResource('Images', rpath('images')))
|
||||||
|
self.putChild(
|
||||||
|
b'ui_images',
|
||||||
|
LookupResource(
|
||||||
|
'UI_Images', common.resource_filename('deluge.ui.data', 'pixmaps')
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
js = ScriptResource()
|
js = ScriptResource()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue