Enable Windows Notifications

This commit is contained in:
Safihre committed 2015-12-15 11:35:26 +01:00
1 parent 33f45a4256
commit 164114ab82
8 files changed
+263 -125

No files matched your search

+206 -123
View File
@@ -69,7 +69,189 @@
</fieldset>
</div><!-- /col1 -->
</div><!-- /section -->
<div class="section" id="growl">
<!--#if $have_ncenter#-->
<div class="section">
<div class="col2">
<h3>$T('section-NC')</h3>
</div><!-- /col2 -->
<div class="col1">
<fieldset>
<div class="field-pair">
<label class="config" for="ncenter_enable">$T('opt-ncenter_enable')</label>
<input type="checkbox" name="ncenter_enable" id="ncenter_enable" value="1" <!--#if int($ncenter_enable) > 0 then 'checked="checked"' else ""#--> />
<span class="desc">$T('explain-ncenter_enable')</span>
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_startup">$T($notify_texts['startup'])</label>
<input type="checkbox" name="ncenter_prio_startup" id="ncenter_prio_startup" value="1" <!--#if int($ncenter_prio_startup) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_download">$T($notify_texts['download'])</label>
<input type="checkbox" name="ncenter_prio_download" id="ncenter_prio_download" value="1" <!--#if int($ncenter_prio_download) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_pp">$T($notify_texts['pp'])</label>
<input type="checkbox" name="ncenter_prio_pp" id="ncenter_prio_pp" value="1" <!--#if int($ncenter_prio_pp) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_complete">$T($notify_texts['complete'])</label>
<input type="checkbox" name="ncenter_prio_complete" id="ncenter_prio_complete" value="1" <!--#if int($ncenter_prio_complete) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_failed">$T($notify_texts['failed'])</label>
<input type="checkbox" name="ncenter_prio_failed" id="ncenter_prio_failed" value="1" <!--#if int($ncenter_prio_failed) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_queue_done">$T($notify_texts['queue_done'])</label>
<input type="checkbox" name="ncenter_prio_queue_done" id="ncenter_prio_queue_done" value="1" <!--#if int($ncenter_prio_queue_done) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_disk_full">$T($notify_texts['disk_full'])</label>
<input type="checkbox" name="ncenter_prio_disk_full" id="ncenter_prio_disk_full" value="1" <!--#if int($ncenter_prio_disk_full) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_warning">$T($notify_texts['warning'])</label>
<input type="checkbox" name="ncenter_prio_warning" id="ncenter_prio_warning" value="1" <!--#if int($ncenter_prio_warning) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_error">$T($notify_texts['error'])</label>
<input type="checkbox" name="ncenter_prio_error" id="ncenter_prio_error" value="1" <!--#if int($ncenter_prio_error) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_other">$T($notify_texts['other'])</label>
<input type="checkbox" name="ncenter_prio_other" id="ncenter_prio_other" value="1" <!--#if int($ncenter_prio_other) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<button class="btn btn-default saveButton"><span class="glyphicon glyphicon-ok"></span> $T('button-saveChanges')</button>
<button class="btn btn-default" type="button" id="test_notification"><span class="glyphicon glyphicon-comment"></span> $T('testNotify')</button>
<span id="testnotice-result" class="icon path darkred">&nbsp;</span>
</div>
</fieldset>
</div><!-- /col1 -->
</div><!-- /section -->
<!--#end if#-->
<!--#if $nt#-->
<div class="section">
<div class="col2">
<h3>$T('section-AC')</h3>
</div><!-- /col2 -->
<div class="col1">
<fieldset>
<div class="field-pair">
<label class="config" for="acenter_enable">$T('opt-acenter_enable')</label>
<input type="checkbox" name="acenter_enable" id="acenter_enable" value="1" <!--#if int($acenter_enable) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_startup">$T($notify_texts['startup'])</label>
<input type="checkbox" name="acenter_prio_startup" id="acenter_prio_startup" value="1" <!--#if int($acenter_prio_startup) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_download">$T($notify_texts['download'])</label>
<input type="checkbox" name="acenter_prio_download" id="acenter_prio_download" value="1" <!--#if int($acenter_prio_download) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_pp">$T($notify_texts['pp'])</label>
<input type="checkbox" name="acenter_prio_pp" id="acenter_prio_pp" value="1" <!--#if int($acenter_prio_pp) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_complete">$T($notify_texts['complete'])</label>
<input type="checkbox" name="acenter_prio_complete" id="acenter_prio_complete" value="1" <!--#if int($acenter_prio_complete) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_failed">$T($notify_texts['failed'])</label>
<input type="checkbox" name="acenter_prio_failed" id="acenter_prio_failed" value="1" <!--#if int($acenter_prio_failed) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_queue_done">$T($notify_texts['queue_done'])</label>
<input type="checkbox" name="acenter_prio_queue_done" id="acenter_prio_queue_done" value="1" <!--#if int($acenter_prio_queue_done) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_disk_full">$T($notify_texts['disk_full'])</label>
<input type="checkbox" name="acenter_prio_disk_full" id="acenter_prio_disk_full" value="1" <!--#if int($acenter_prio_disk_full) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_warning">$T($notify_texts['warning'])</label>
<input type="checkbox" name="acenter_prio_warning" id="acenter_prio_warning" value="1" <!--#if int($acenter_prio_warning) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_error">$T($notify_texts['error'])</label>
<input type="checkbox" name="acenter_prio_error" id="acenter_prio_error" value="1" <!--#if int($acenter_prio_error) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="acenter_prio_other">$T($notify_texts['other'])</label>
<input type="checkbox" name="acenter_prio_other" id="acenter_prio_other" value="1" <!--#if int($acenter_prio_other) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<button class="btn btn-default saveButton"><span class="glyphicon glyphicon-ok"></span> $T('button-saveChanges')</button>
<button class="btn btn-default" type="button" id="test_windows_notification"><span class="glyphicon glyphicon-comment"></span> $T('testNotify')</button>
<span id="testnotice-result" class="icon path darkred">&nbsp;</span>
</div>
</fieldset>
</div><!-- /col1 -->
</div><!-- /section -->
<!--#end if#-->
<!--#if $have_ntfosd#-->
<div class="section">
<div class="col2">
<h3>$T('section-OSD') <a href="$helpuri$help_uri#toc4" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></h3>
</div><!-- /col2 -->
<div class="col1">
<fieldset>
<div class="field-pair">
<label class="config" for="ntfosd_enable">$T('opt-ntfosd_enable')</label>
<input type="checkbox" name="ntfosd_enable" id="ntfosd_enable" value="1" <!--#if int($ntfosd_enable) > 0 then 'checked="checked"' else ""#--> <!--#if not $have_ntfosd then 'readonly="readonly" disabled="disabled"' else "" #--> />
<span class="desc">$T('explain-ntfosd_enable')</span>
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_startup">$T($notify_texts['startup'])</label>
<input type="checkbox" name="ntfosd_prio_startup" id="ntfosd_prio_startup" value="1" <!--#if int($ntfosd_prio_startup) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_download">$T($notify_texts['download'])</label>
<input type="checkbox" name="ntfosd_prio_download" id="ntfosd_prio_download" value="1" <!--#if int($ntfosd_prio_download) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_pp">$T($notify_texts['pp'])</label>
<input type="checkbox" name="ntfosd_prio_pp" id="ntfosd_prio_pp" value="1" <!--#if int($ntfosd_prio_pp) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_complete">$T($notify_texts['complete'])</label>
<input type="checkbox" name="ntfosd_prio_complete" id="ntfosd_prio_complete" value="1" <!--#if int($ntfosd_prio_complete) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_failed">$T($notify_texts['failed'])</label>
<input type="checkbox" name="ntfosd_prio_failed" id="ntfosd_prio_failed" value="1" <!--#if int($ntfosd_prio_failed) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_queue_done">$T($notify_texts['queue_done'])</label>
<input type="checkbox" name="ntfosd_prio_queue_done" id="ntfosd_prio_queue_done" value="1" <!--#if int($ntfosd_prio_queue_done) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_disk_full">$T($notify_texts['disk_full'])</label>
<input type="checkbox" name="ntfosd_prio_disk_full" id="ntfosd_prio_disk_full" value="1" <!--#if int($ntfosd_prio_disk_full) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_warning">$T($notify_texts['warning'])</label>
<input type="checkbox" name="ntfosd_prio_warning" id="ntfosd_prio_warning" value="1" <!--#if int($ntfosd_prio_warning) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_error">$T($notify_texts['error'])</label>
<input type="checkbox" name="ntfosd_prio_error" id="ntfosd_prio_error" value="1" <!--#if int($ntfosd_prio_error) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_other">$T($notify_texts['other'])</label>
<input type="checkbox" name="ntfosd_prio_other" id="ntfosd_prio_other" value="1" <!--#if int($ntfosd_prio_other) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<button class="btn btn-default saveButton"><span class="glyphicon glyphicon-ok"></span> $T('button-saveChanges')</button>
<button class="btn btn-default" type="button" id="test_osd"><span class="glyphicon glyphicon-comment"></span> $T('testNotify')</button>
<span id="testosd-result" class="icon path darkred">&nbsp;</span>
</div>
</fieldset>
</div><!-- /col1 -->
</div><!-- /section -->
<!--#end if#-->
<div class="section" id="growl">
<div class="col2">
<h3>$T('growlSettings') <a href="$helpuri$help_uri#toc3" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></h3>
</div><!-- /col2 -->
@@ -138,128 +320,6 @@
</fieldset>
</div><!-- /col1 -->
</div><!-- /section -->
<!--#if $have_ncenter#-->
<div class="section">
<div class="col2">
<h3>$T('section-NC')</h3>
</div><!-- /col2 -->
<div class="col1">
<fieldset>
<div class="field-pair">
<label class="config" for="ncenter_enable">$T('opt-ncenter_enable')</label>
<input type="checkbox" name="ncenter_enable" id="ncenter_enable" value="1" <!--#if int($ncenter_enable) > 0 then 'checked="checked"' else ""#--> <!--#if not $have_ncenter then 'readonly="readonly" disabled="disabled"' else "" #--> />
<span class="desc">$T('explain-ncenter_enable')</span>
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_startup">$T($notify_texts['startup'])</label>
<input type="checkbox" name="ncenter_prio_startup" id="ncenter_prio_startup" value="1" <!--#if int($ncenter_prio_startup) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_download">$T($notify_texts['download'])</label>
<input type="checkbox" name="ncenter_prio_download" id="ncenter_prio_download" value="1" <!--#if int($ncenter_prio_download) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_pp">$T($notify_texts['pp'])</label>
<input type="checkbox" name="ncenter_prio_pp" id="ncenter_prio_pp" value="1" <!--#if int($ncenter_prio_pp) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_complete">$T($notify_texts['complete'])</label>
<input type="checkbox" name="ncenter_prio_complete" id="ncenter_prio_complete" value="1" <!--#if int($ncenter_prio_complete) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_failed">$T($notify_texts['failed'])</label>
<input type="checkbox" name="ncenter_prio_failed" id="ncenter_prio_failed" value="1" <!--#if int($ncenter_prio_failed) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_queue_done">$T($notify_texts['queue_done'])</label>
<input type="checkbox" name="ncenter_prio_queue_done" id="ncenter_prio_queue_done" value="1" <!--#if int($ncenter_prio_queue_done) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_disk_full">$T($notify_texts['disk_full'])</label>
<input type="checkbox" name="ncenter_prio_disk_full" id="ncenter_prio_disk_full" value="1" <!--#if int($ncenter_prio_disk_full) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_warning">$T($notify_texts['warning'])</label>
<input type="checkbox" name="ncenter_prio_warning" id="ncenter_prio_warning" value="1" <!--#if int($ncenter_prio_warning) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_error">$T($notify_texts['error'])</label>
<input type="checkbox" name="ncenter_prio_error" id="ncenter_prio_error" value="1" <!--#if int($ncenter_prio_error) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ncenter_prio_other">$T($notify_texts['other'])</label>
<input type="checkbox" name="ncenter_prio_other" id="ncenter_prio_other" value="1" <!--#if int($ncenter_prio_other) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<button class="btn btn-default saveButton"><span class="glyphicon glyphicon-ok"></span> $T('button-saveChanges')</button>
<button class="btn btn-default" type="button" id="test_notification"><span class="glyphicon glyphicon-comment"></span> $T('testNotify')</button>
<span id="testnotice-result" class="icon path darkred">&nbsp;</span>
</div>
</fieldset>
</div><!-- /col1 -->
</div><!-- /section -->
<!--#end if#-->
<!--#if $have_ntfosd#-->
<div class="section">
<div class="col2">
<h3>$T('section-OSD') <a href="$helpuri$help_uri#toc4" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></h3>
</div><!-- /col2 -->
<div class="col1">
<fieldset>
<div class="field-pair">
<label class="config" for="ntfosd_enable">$T('opt-ntfosd_enable')</label>
<input type="checkbox" name="ntfosd_enable" id="ntfosd_enable" value="1" <!--#if int($ntfosd_enable) > 0 then 'checked="checked"' else ""#--> <!--#if not $have_ntfosd then 'readonly="readonly" disabled="disabled"' else "" #--> />
<span class="desc">$T('explain-ntfosd_enable')</span>
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_startup">$T($notify_texts['startup'])</label>
<input type="checkbox" name="ntfosd_prio_startup" id="ntfosd_prio_startup" value="1" <!--#if int($ntfosd_prio_startup) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_download">$T($notify_texts['download'])</label>
<input type="checkbox" name="ntfosd_prio_download" id="ntfosd_prio_download" value="1" <!--#if int($ntfosd_prio_download) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_pp">$T($notify_texts['pp'])</label>
<input type="checkbox" name="ntfosd_prio_pp" id="ntfosd_prio_pp" value="1" <!--#if int($ntfosd_prio_pp) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_complete">$T($notify_texts['complete'])</label>
<input type="checkbox" name="ntfosd_prio_complete" id="ntfosd_prio_complete" value="1" <!--#if int($ntfosd_prio_complete) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_failed">$T($notify_texts['failed'])</label>
<input type="checkbox" name="ntfosd_prio_failed" id="ntfosd_prio_failed" value="1" <!--#if int($ntfosd_prio_failed) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_queue_done">$T($notify_texts['queue_done'])</label>
<input type="checkbox" name="ntfosd_prio_queue_done" id="ntfosd_prio_queue_done" value="1" <!--#if int($ntfosd_prio_queue_done) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_disk_full">$T($notify_texts['disk_full'])</label>
<input type="checkbox" name="ntfosd_prio_disk_full" id="ntfosd_prio_disk_full" value="1" <!--#if int($ntfosd_prio_disk_full) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_warning">$T($notify_texts['warning'])</label>
<input type="checkbox" name="ntfosd_prio_warning" id="ntfosd_prio_warning" value="1" <!--#if int($ntfosd_prio_warning) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_error">$T($notify_texts['error'])</label>
<input type="checkbox" name="ntfosd_prio_error" id="ntfosd_prio_error" value="1" <!--#if int($ntfosd_prio_error) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<label class="config" for="ntfosd_prio_other">$T($notify_texts['other'])</label>
<input type="checkbox" name="ntfosd_prio_other" id="ntfosd_prio_other" value="1" <!--#if int($ntfosd_prio_other) > 0 then 'checked="checked"' else ""#--> />
</div>
<div class="field-pair">
<button class="btn btn-default saveButton"><span class="glyphicon glyphicon-ok"></span> $T('button-saveChanges')</button>
<button class="btn btn-default" type="button" id="test_osd"><span class="glyphicon glyphicon-comment"></span> $T('testNotify')</button>
<span id="testosd-result" class="icon path darkred">&nbsp;</span>
</div>
</fieldset>
</div><!-- /col1 -->
</div><!-- /section -->
<!--#end if#-->
<div class="section" id="prowl">
<div class="col2">
<h3>$T('section-Prowl')</h3>
@@ -650,6 +710,29 @@
}
});
});
\$('#test_windows_notification').click(function () {
\$.ajax({
type: "GET",
url: "../../tapi",
data: {mode: 'test_windows', apikey: '$session', output: 'json' },
beforeSend: function () {
\$('#test_notification').attr("disabled", "disabled");
\$('#testnotice-result').removeClass("success failure").addClass("loading").html('$T('post-Verifying')');
console.log('asdas')
},
complete: function () {
\$('#test_notification').removeAttr("disabled");
\$('#testnotice-result').removeClass("loading");
},
success: function (data) {
if (data.status == true) {
\$('#testnotice-result').addClass("success").html('$T('smpl-notesent')');
} else {
\$('#testnotice-result').addClass("failure").html(data.error);
}
}
});
});
\$('#test_pushbullet').click(function () {
var data = { mode: 'test_pushbullet', apikey: '$session', output: 'json' };
\$("#pushbullet").extractFormDataTo(data);
@@ -155,7 +155,9 @@ input[type="checkbox"]+.desc {
.infoTableSeperator.alt {
background-color: #F8F8F8;
}
.success {
color: #5cb85c !important;
}
.typeahead.dropdown-menu {
padding: 0;
min-width: 300px;
+6
View File
@@ -719,6 +719,11 @@ def _api_test_email(name, output, kwargs):
res = None
return report(output, error=res)
def _api_test_windows(name, output, kwargs):
""" API: send a test to Windows, return result """
logging.info("Sending test notification")
res = sabnzbd.growler.send_windows('SABnzbd', T('Test Notification'), 'other')
return report(output, error=res)
def _api_test_notif(name, output, kwargs):
""" API: send a test to Notification Center, return result """
@@ -908,6 +913,7 @@ _api_table = {
'retry_all': (_api_retry_all, 2),
'reset_quota': (_api_reset_quota, 2),
'test_email': (_api_test_email, 2),
'test_windows': (_api_test_windows, 2),
'test_notif': (_api_test_notif, 2),
'test_growl': (_api_test_growl, 2),
'test_osd': (_api_test_osd, 2),
+13
View File
@@ -272,6 +272,19 @@ ncenter_prio_error = OptionBool('ncenter', 'ncenter_prio_error', False)
ncenter_prio_queue_done = OptionBool('ncenter', 'ncenter_prio_queue_done', True)
ncenter_prio_other = OptionBool('ncenter', 'ncenter_prio_other', False)
# [acenter]
acenter_enable = OptionBool('acenter', 'acenter_enable', sabnzbd.WIN32)
acenter_prio_startup = OptionBool('acenter', 'acenter_prio_startup', True)
acenter_prio_download = OptionBool('acenter', 'acenter_prio_download', False)
acenter_prio_pp = OptionBool('acenter', 'acenter_prio_pp', False)
acenter_prio_complete = OptionBool('acenter', 'acenter_prio_complete', True)
acenter_prio_failed = OptionBool('acenter', 'acenter_prio_failed', True)
acenter_prio_disk_full = OptionBool('acenter', 'acenter_prio_disk_full', True)
acenter_prio_warning = OptionBool('acenter', 'acenter_prio_warning', False)
acenter_prio_error = OptionBool('acenter', 'acenter_prio_error', False)
acenter_prio_queue_done = OptionBool('acenter', 'acenter_prio_queue_done', True)
acenter_prio_other = OptionBool('acenter', 'acenter_prio_other', False)
# [ntfosd]
ntfosd_enable = OptionBool('ntfosd', 'ntfosd_enable', not sabnzbd.WIN32 and not sabnzbd.DARWIN)
ntfosd_prio_startup = OptionBool('ntfosd', 'ntfosd_prio_startup', True)
+9 -1
View File
@@ -123,6 +123,11 @@ def send_notification(title, msg, gtype):
if sabnzbd.DARWIN_VERSION > 7 and sabnzbd.cfg.ncenter_enable():
if check_classes(gtype, 'ncenter'):
send_notification_center(title, msg, gtype)
# Windows
if sabnzbd.WIN32 and sabnzbd.cfg.acenter_enable():
if check_classes(gtype, 'acenter'):
send_windows(title, msg, gtype)
# Growl
if sabnzbd.cfg.growl_enable() and check_classes(gtype, 'growl'):
@@ -154,7 +159,6 @@ def send_notification(title, msg, gtype):
if have_ntfosd() and sabnzbd.cfg.ntfosd_enable() and check_classes(gtype, 'ntfosd'):
send_notify_osd(title, msg)
def reset_growl():
""" Reset Growl (after changing language) """
global _GROWL, _GROWL_REG
@@ -534,3 +538,7 @@ def send_pushbullet(title, msg, gtype, force=False, test=None):
logging.info('Traceback: ', exc_info=True)
return T('Failed to send pushbullet message')
return ''
def send_windows(title, msg, gtype):
sabnzbd.WINTRAY.sendnotification(title, msg)
return None
+10
View File
@@ -2743,6 +2743,10 @@ LIST_NCENTER = ('ncenter_enable',
'ncenter_prio_startup', 'ncenter_prio_download', 'ncenter_prio_pp', 'ncenter_prio_complete', 'ncenter_prio_failed',
'ncenter_prio_disk_full', 'ncenter_prio_warning', 'ncenter_prio_error', 'ncenter_prio_queue_done', 'ncenter_prio_other'
)
LIST_ACENTER = ('acenter_enable',
'acenter_prio_startup', 'acenter_prio_download', 'acenter_prio_pp', 'acenter_prio_complete', 'acenter_prio_failed',
'acenter_prio_disk_full', 'acenter_prio_warning', 'acenter_prio_error', 'acenter_prio_queue_done', 'acenter_prio_other'
)
LIST_NTFOSD = ('ntfosd_enable',
'ntfosd_prio_startup', 'ntfosd_prio_download', 'ntfosd_prio_pp', 'ntfosd_prio_complete', 'ntfosd_prio_failed',
'ntfosd_prio_disk_full', 'ntfosd_prio_warning', 'ntfosd_prio_error', 'ntfosd_prio_queue_done', 'ntfosd_prio_other'
@@ -2797,6 +2801,8 @@ class ConfigNotify(object):
conf[kw] = config.get_config('pushbullet', kw)()
for kw in LIST_NCENTER:
conf[kw] = config.get_config('ncenter', kw)()
for kw in LIST_ACENTER:
conf[kw] = config.get_config('acenter', kw)()
for kw in LIST_NTFOSD:
conf[kw] = config.get_config('ntfosd', kw)()
conf['notify_texts'] = sabnzbd.growler.NOTIFICATION
@@ -2824,6 +2830,10 @@ class ConfigNotify(object):
msg = config.get_config('ncenter', kw).set(platform_encode(kwargs.get(kw)))
if msg:
return badParameterResponse(T('Incorrect value for %s: %s') % (kw, unicoder(msg)), ajax)
for kw in LIST_ACENTER:
msg = config.get_config('acenter', kw).set(platform_encode(kwargs.get(kw)))
if msg:
return badParameterResponse(T('Incorrect value for %s: %s') % (kw, unicoder(msg)), ajax)
for kw in LIST_NTFOSD:
msg = config.get_config('ntfosd', kw).set(platform_encode(kwargs.get(kw)))
if msg:
+2
View File
@@ -620,8 +620,10 @@ SKIN_TEXT = {
'explain-ntfosd_enable' : TT('Send notifications to NotifyOSD'), #: Don't translate "NotifyOSD"
'opt-ncenter_enable' : TT('Notification Center'),
'explain-ncenter_enable' : TT('Send notifications to Notification Center'),
'opt-acenter_enable' : TT('Enable Windows Notifications'),
'testNotify' : TT('Test Notification'),
'section-NC' : TT('Notification Center'), #: Header for OSX Notfication Center section
'section-AC' : TT('Windows Notifications'),
'section-OSD' : TT('NotifyOSD'), #: Header for Ubuntu's NotifyOSD notifications section
'section-Prowl' : TT('Prowl'), #: Header for Prowl notification section
'opt-prowl_enable' : TT('Enable Prowl notifications'), #: Prowl settings
+14
View File
@@ -94,6 +94,20 @@ class SysTrayIconThread(Thread):
# override this
def doUpdates(self):
pass
# Notification
def sendnotification(self, title, msg):
hicon = self.get_icon(self.icon)
win32gui.Shell_NotifyIcon(win32gui.NIM_MODIFY,
(self.hwnd,
0,
win32gui.NIF_INFO,
win32con.WM_USER+20,
hicon,
"Balloon tooltip",
msg,
200,
title))
def _add_ids_to_menu_options(self, menu_options):
result = []