mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-14 05:26:28 +00:00
More fixes for labels plugin webui
Disabled options and remove for filters No Label and All Removed All from torrent menu Fixed No Label not working in torrent menu Bumped version to 0.2
This commit is contained in:
parent
a359374547
commit
88db73e244
@ -357,13 +357,6 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
|
|||||||
|
|
||||||
name: 'Label',
|
name: 'Label',
|
||||||
|
|
||||||
noLabelItem: {
|
|
||||||
text: _('No Label'),
|
|
||||||
label: '',
|
|
||||||
handler: this.onTorrentMenuClick,
|
|
||||||
scope: this
|
|
||||||
},
|
|
||||||
|
|
||||||
createMenu: function() {
|
createMenu: function() {
|
||||||
this.labelMenu = new Ext.menu.Menu({
|
this.labelMenu = new Ext.menu.Menu({
|
||||||
items: [{
|
items: [{
|
||||||
@ -388,14 +381,22 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
|
|||||||
|
|
||||||
setFilter: function(filter) {
|
setFilter: function(filter) {
|
||||||
filter.show_zero = true;
|
filter.show_zero = true;
|
||||||
|
|
||||||
filter.list.on('contextmenu', this.onLabelContextMenu, this);
|
filter.list.on('contextmenu', this.onLabelContextMenu, this);
|
||||||
filter.header.on('contextmenu', this.onLabelHeaderContextMenu, this);
|
filter.header.on('contextmenu', this.onLabelHeaderContextMenu, this);
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateTorrentMenu: function(states) {
|
updateTorrentMenu: function(states) {
|
||||||
for (var state in states) {
|
this.torrentMenu.removeAll(true);
|
||||||
if (!state) continue;
|
this.torrentMenu.addMenuItem({
|
||||||
|
text: _('No Label'),
|
||||||
|
label: '',
|
||||||
|
handler: this.onTorrentMenuClick,
|
||||||
|
scope: this
|
||||||
|
});
|
||||||
|
for (var state in states) {
|
||||||
|
if (!state || state == 'All' ) continue;
|
||||||
this.torrentMenu.addMenuItem({
|
this.torrentMenu.addMenuItem({
|
||||||
text: state,
|
text: state,
|
||||||
label: state,
|
label: state,
|
||||||
@ -415,9 +416,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onEnable: function() {
|
onEnable: function() {
|
||||||
this.torrentMenu = new Ext.menu.Menu({
|
this.torrentMenu = new Ext.menu.Menu();
|
||||||
items: [ this.noLabelItem ]
|
|
||||||
});
|
|
||||||
|
|
||||||
this.tmSep = deluge.menus.torrent.add({
|
this.tmSep = deluge.menus.torrent.add({
|
||||||
xtype: 'menuseparator'
|
xtype: 'menuseparator'
|
||||||
@ -472,21 +471,15 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
|
|||||||
var statesArray = [];
|
var statesArray = [];
|
||||||
|
|
||||||
for (state in states) {
|
for (state in states) {
|
||||||
statesArray.push(state);
|
if (!state || state == 'All') continue;
|
||||||
|
statesArray.push(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
var none = statesArray.shift();
|
|
||||||
var all = statesArray.shift();
|
|
||||||
|
|
||||||
this.torrentMenu.removeAll(true);
|
|
||||||
this.torrentMenu.addMenuItem(this.noLabelItem);
|
|
||||||
|
|
||||||
statesArray.push(label.toLowerCase());
|
statesArray.push(label.toLowerCase());
|
||||||
statesArray.sort();
|
statesArray.sort();
|
||||||
statesArray.unshift(all);
|
|
||||||
|
|
||||||
console.log(states);
|
//console.log(states);
|
||||||
console.log(statesArray);
|
//console.log(statesArray);
|
||||||
|
|
||||||
states = {}
|
states = {}
|
||||||
|
|
||||||
@ -500,12 +493,14 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
|
|||||||
onLabelContextMenu: function(dv, i, node, e) {
|
onLabelContextMenu: function(dv, i, node, e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!this.labelMenu) this.createMenu();
|
if (!this.labelMenu) this.createMenu();
|
||||||
var r = dv.getRecord(node);
|
var r = dv.getRecord(node).get('filter');
|
||||||
if (dv.getRecord(node).get('filter')) {
|
if ( !r || r == 'All') {
|
||||||
|
this.labelMenu.items.get(1).setDisabled(true);
|
||||||
|
this.labelMenu.items.get(2).setDisabled(true);
|
||||||
|
} else {
|
||||||
this.labelMenu.items.get(1).setDisabled(false);
|
this.labelMenu.items.get(1).setDisabled(false);
|
||||||
this.labelMenu.items.get(2).setDisabled(false);
|
this.labelMenu.items.get(2).setDisabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
dv.select(i);
|
dv.select(i);
|
||||||
this.labelMenu.showAt(e.getXY());
|
this.labelMenu.showAt(e.getXY());
|
||||||
},
|
},
|
||||||
|
@ -36,7 +36,7 @@ from setuptools import setup
|
|||||||
__plugin_name__ = "Label"
|
__plugin_name__ = "Label"
|
||||||
__author__ = "Martijn Voncken"
|
__author__ = "Martijn Voncken"
|
||||||
__author_email__ = "mvoncken@gmail.com"
|
__author_email__ = "mvoncken@gmail.com"
|
||||||
__version__ = "0.1"
|
__version__ = "0.2"
|
||||||
__url__ = "http://deluge-torrent.org"
|
__url__ = "http://deluge-torrent.org"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
__description__ = "Allows labels to be assigned to torrents"
|
__description__ = "Allows labels to be assigned to torrents"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user