summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorDaniel Napora <napcok@gmail.com>2013-09-22 23:50:55 +0200
committerDaniel Napora <napcok@gmail.com>2013-09-22 23:50:55 +0200
commit84060477ead5c0a97c862cac80ca75adc3697032 (patch)
tree26d086398a8f47bd4af5521a466c5be3716bfaa6 /usr
parent55d479337299c57225739f7cd3ec04d8ed2d9976 (diff)
downloadmageiawelcome-84060477ead5c0a97c862cac80ca75adc3697032.tar
mageiawelcome-84060477ead5c0a97c862cac80ca75adc3697032.tar.gz
mageiawelcome-84060477ead5c0a97c862cac80ca75adc3697032.tar.bz2
mageiawelcome-84060477ead5c0a97c862cac80ca75adc3697032.tar.xz
mageiawelcome-84060477ead5c0a97c862cac80ca75adc3697032.zip
Ability to select multiple packages and install them with one click
Diffstat (limited to 'usr')
-rw-r--r--usr/share/mageiawelcome/css/style.css16
-rw-r--r--usr/share/mageiawelcome/helpers.py8
-rw-r--r--usr/share/mageiawelcome/index.html39
-rw-r--r--usr/share/mageiawelcome/mageiawelcome.py19
4 files changed, 62 insertions, 20 deletions
diff --git a/usr/share/mageiawelcome/css/style.css b/usr/share/mageiawelcome/css/style.css
index c7ba10a..bb1383e 100644
--- a/usr/share/mageiawelcome/css/style.css
+++ b/usr/share/mageiawelcome/css/style.css
@@ -79,7 +79,7 @@ div#slide-pager li a:hover{text-decoration:underline;color:#EEE;}
#rpmdrake_info{background:#FFCC00;color:#111;line-height:29px;border-bottom: 1px solid #111;text-align:center;text-shadow: none;}
div#applist {width:100%;clear:both;padding:0;margin:0;}
ul.filter, ul.list{float:left;margin-top:0;}
-ul.filter {width: 139px;background: #FFF;margin:0;height:425px;
+ul.filter {width: 169px;background: #FFF;margin:0;height:425px;
}
@@ -89,7 +89,7 @@ ul.filter li {display:block;
}
ul.filter li.current,ul.filter li.current:hover {background-color: #0A5C93; color: #FFF;}
ul.filter li:hover {background-color: #e5e5e5; color: #333;}
-ul.list {width: 660px;height:425px; overflow-x:hidden;overflow-y:auto;padding:0;list-style-type:none;border-left:1px solid #262F45;}
+ul.list {width: 630px;height:425px; overflow-x:hidden;overflow-y:auto;padding:0;list-style-type:none;border-left:1px solid #262F45;}
ul.list img.icon {height:32px;width:32px; float:left;margin:6px;}
ul.list li {width: 660px;height:54px;margin: 0;position:relative;border-bottom:1px solid #262F45;padding:2px;}
@@ -97,15 +97,17 @@ ul.list li:hover {background:rgba(0, 0, 0, 0.2); }
ul.list li h6 {margin:0;margin-top:6px;}
ul.list li p.description {margin-top:0;}
-ul.list li button.cmd,ul.list li button.inst {position:absolute; left:576px; top:28px;width:66px;float:right;}
+ul.list li button.cmd,ul.list li button.inst {position:absolute; left:540px; top:28px;width:72px;float:right;}
ul.list li button.uninst {display:none;}
/*ul.list li:hover button.uninst {display:block;position:absolute; left:64px; bottom:1px;}*/
ul.list li.urpme {background:rgba(0, 0, 0, 0.4);
background-image:url('../img/ok.png');
background-repeat:no-repeat;
- background-position:40px 36px;
+ background-position:48px 14px;
}
ul.list li.urpme:hover {background-color:rgba(0, 0, 0, 0.3);}
-ul.list li span.label{position:absolute; top:2px; right:26px;}
-
-
+ul.list li span.label{position:absolute; top:2px; right:56px;}
+.chkbox {float:left;width:30px;height:54px;}
+.chkbox input[type='checkbox']{margin-top: 14px;}
+#selectedRPMS{position:absolute;bottom:44px;left:2px;background:rgba(0, 0, 0, 0.6); padding:3px;border-radius:3px;font-size:11px; z-index:200;width:165px;}
+#install_all {position:absolute;bottom:14px;left:22px;}
diff --git a/usr/share/mageiawelcome/helpers.py b/usr/share/mageiawelcome/helpers.py
index 027da77..3468892 100644
--- a/usr/share/mageiawelcome/helpers.py
+++ b/usr/share/mageiawelcome/helpers.py
@@ -14,16 +14,16 @@ def get_listapp():
if (r[6] == 'false'):
start_btn = ""
else:
- start_btn = "<button class='cmd small pill green' data-run='"+ r[6] + "'><i class='icon-ok-sign'> </i> start</button>"
+ start_btn = "<button class='cmd small pill green' data-run='"+ r[6] + "'><i class='icon-ok-sign'> </i> Launch</button>"
if (r[7] != ''):
label = "<span class='label red'>" + r[7] + "</span>"
else:
label = ""
if ( not os.path.isfile(r[5])):# DO ZAINSTALOWANIA
- listapp += "<li class='" + r[3] +"' id='" + r[0] + "'><img class=icon src=img/" + r[0] + ".png /> \
-<h6>" + r[2] + "</h6><p class=description>" + r[4] + "</p>" + start_btn + label + "<button class='inst small pill' data-rpm='" + r[1] + "'><i class='icon-circle-arrow-down'> </i> install</button></li>"
+ listapp += "<li class='" + r[3] +"' id='" + r[0] + "'><img class=icon src=img/" + r[0] + ".png /><div class='chkbox'><input type='checkbox' datasrc='" + r[1] +"'></div> \
+<h6>" + r[2] + "</h6><p class=description>" + r[4] + "</p>" + start_btn + label + "<button class='inst small pill' data-rpm='" + r[1] + "'><i class='icon-circle-arrow-down'> </i> Install</button></li>"
else: # JEST ZAINSTALOWANY
- listapp += "<li class='urpme " + r[3] +"' id='" + r[0] + "'><img class=icon src=img/" + r[0] + ".png /> \
+ listapp += "<li class='urpme " + r[3] +"' id='" + r[0] + "'><img class=icon src=img/" + r[0] + ".png /><div class='chkbox'></div> \
<h6>" + r[2] + "</h6><p class=description>" + r[4] + "</p>" + start_btn + label + "<button class='uninst small pill red' data-rpm='" + r[1] + "'><i class='icon-minus-sign'> </i> remove</button></li>"
return listapp
\ No newline at end of file
diff --git a/usr/share/mageiawelcome/index.html b/usr/share/mageiawelcome/index.html
index c7efc76..7f9d8e8 100644
--- a/usr/share/mageiawelcome/index.html
+++ b/usr/share/mageiawelcome/index.html
@@ -49,7 +49,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
});
//APPLIST
$('.filtr').click(function() {
- var cat = this.id;
+ cat = this.id;
$(this).addClass('current');
$(this).siblings().removeClass('current');
$('ul#lista_applikacji li').hide();
@@ -85,13 +85,36 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
send('"' + link + '"');
});
// RUN DRAKS AND APPLICATIONS
- $('.cmd').click(function(){send('"run ' + ($(this).data("run")) + '"');});
+ $('#lista_applikacji').on('click','button.cmd', function(){send('"run ' + ($(this).data("run")) + '"');});
//URPMI FROM APPLIST
- $('#lista_applikacji li button').not('.cmd').click(function(){
+ $('#lista_applikacji').on('click','button.inst', function(){
var rpm = $(this).data('rpm');
- send('"gurpmi ' + rpm + '"');
+ send('"gurpmi ' + cat +' ' + rpm + '"');
});
-
+ // INSTALL SELECTED
+
+ // APPLIST - INSTALL SELECTED
+ $('#lista_applikacji').on('click','input:checkbox', function() {
+ selected = [];
+ $('#lista_applikacji input:checkbox').each(function () {
+ var $this = $(this),
+ rpm = $this.attr('datasrc');
+ if ($(this).prop('checked')) {
+ selected.push(rpm);
+ }
+ });
+ $('span#count_rpms').text(selected.length);
+ //$('span#selectedRPMS').tooltip('destroy');
+ $('div#selectedPKGS').html(selected.join(' '));
+ //$('span#selectedRPMS').tooltip('show');
+ });
+ $('#install_all').on('click','button.install_all',function(){
+ var rpms = selected.join(' ');
+ send('"install_selected ' + cat +' '+ rpms + '"');
+ selected = [];
+ $('span#count_rpms').text(selected.length);
+ $('div#selectedPKGS').html(' ');
+ });
});
// ]]>
</script>
@@ -228,7 +251,11 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<li class="filtr" id="graphics">&nbsp;&nbsp;Graphics</li>
<li class="filtr" id="system">&nbsp;&nbsp;System</li>
<li class="filtr" id="programming">&nbsp;&nbsp;Programming</li>
-
+
+<div id="selectedRPMS" class="tooltip" title="tooltip" data-placement="top">Selected packages: <span id="count_rpms">0</span><br />
+<div id="selectedPKGS"></div></div>
+<div id="install_all">
+<button class="install_all small pill"><i class='icon-circle-arrow-down'> </i> Install selected</button></div>
</ul>
<ul class="list" id="lista_applikacji">
$applist
diff --git a/usr/share/mageiawelcome/mageiawelcome.py b/usr/share/mageiawelcome/mageiawelcome.py
index f787d61..c65114b 100644
--- a/usr/share/mageiawelcome/mageiawelcome.py
+++ b/usr/share/mageiawelcome/mageiawelcome.py
@@ -134,16 +134,29 @@ def main():
elif msg.startswith("gurpmi"):
print msg
- name = msg.split(' ')[1]
args = shlex.split(msg)
+ cat = args.pop(1)
print args
proc = subprocess.Popen(args, stdout=subprocess.PIPE)
proc.wait()
print proc.returncode
if (proc.returncode == 0):
- web_send('$("li#'+ name +'").addClass("urpme");$("li#'+name+' button").not(".cmd").html("<i class=icon-minus-sign> </i> remove").addClass("uninst").removeClass("inst")')
+ listapp = get_listapp()
+ web_send('$("ul#lista_applikacji").html("'+listapp+'");$("li#'+cat+'").trigger("click");')
+ else: pass
+ elif msg.startswith("install_selected"):
+ print msg
+ msg2 = msg.replace('install_selected','gurpmi')
+ args = shlex.split(msg2)
+ cat = args.pop(1)
+ print args
+ proc = subprocess.Popen(args, stdout=subprocess.PIPE)
+ proc.wait()
+ print proc.returncode
+ if (proc.returncode == 0):
+ listapp = get_listapp()
+ web_send('$("ul#lista_applikacji").html("'+listapp+'");$("li#'+cat+'").trigger("click");')
else: pass
-
if again: pass
else: time.sleep(0.1)