move popups out of trunk

This commit is contained in:
Zach Tibbitts 2007-03-01 23:13:42 +00:00
parent 4f264b3fd0
commit 9d143dbe14
3 changed files with 0 additions and 393 deletions

View File

@ -1,147 +0,0 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="PopupNotifierConfig">
<property name="title" translatable="yes">Popup Notifier Configuration</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox3">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_EDGE</property>
<child>
<widget class="GtkButton" id="pref_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">1</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Notifications of the following Severity Level and above will be displayed:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">40</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHScrollbar" id="severity_selector">
<property name="visible">True</property>
<property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
<property name="inverted">False</property>
<property name="adjustment">1 1 4 1 1 0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="severity_descriptor">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -1,132 +0,0 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="PopupNotifier">
<property name="visible">True</property>
<property name="title" translatable="yes">Popup Notification</property>
<property name="type">GTK_WINDOW_POPUP</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_SPLASHSCREEN</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">True</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkImage" id="notification_image">
<property name="visible">True</property>
<property name="stock">gtk-dialog-warning</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="notification">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">False</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="hide_notification" last_modification_time="Mon, 30 Oct 2006 15:43:19 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -1,114 +0,0 @@
# Popup Notifier plugin
class plugin_PopupNotifier:
def __init__(self, path, deluge_core, deluge_interface):
# print "PopupNotifierI being created now"
self.parent = deluge_interface
self.location = path
import dcommon, dgtk, pref
try:
import pynotify
self.pynotify = pynotify # We must save this, because as a plugin, our globals will die
except:
dgtk.show_popup_warning(self. parent.window, "PopupNotifier: not all necessary dependencies are installed. To install them, on Ubuntu run: apt-get python-notify notification-daemon")
return
if not self.pynotify.init("Deluge"):
dgtk.show_popup_warning(self. parent.window, "PopupNotifier: Cannot initialize pynotify, no notifications will be shown.")
self.severities = { "I": 1, "W": 2, "C": 3, "F": 4 }
self.severityTexts = {
self.severities["I"]: "Informative - can be easily ignored",
self.severities["W"]: "Warning - may be of interest",
self.severities["C"]: "Critical - should never be ignored",
self.severities["F"]: "Fatal - normal operation will probably not continue" }
self.severityToUrgency = { "I": pynotify.URGENCY_LOW,
"W": pynotify.URGENCY_NORMAL,
"C": pynotify.URGENCY_NORMAL,
"F": pynotify.URGENCY_CRITICAL }
self.config = pref.Preferences(dcommon.CONFIG_DIR + '/popupnotify.conf')
userSeverity = self.config.get('plugin_popupnotifier_severity', default=self.severities["W"])
self.minSeverity = int(userSeverity)
if self.minSeverity is None:
self.minSeverity = self.severities['I']
self.icon = "file://" + dccommon.get_pixmap("deluge32.png")
# Connect signal in the parent
# self.handlerID = self.parent.messageList.connect("insert-text", self.signal)
def unload(self):
# print "PopupNotifierI is shutting down now"
# self.parent.messageList.disconnect(self.handlerID)
pass
def update(self):
# print "PopupNotifier Updating..."
pass
def signal(self, textbuffer, iter, text, length):
# print "Signal occured, need to show: ", text
severity = text[0]
if self.severities[severity] >= self.minSeverity:
startIndex = text.find("] ")+2
note = self.pynotify.Notification("Deluge", text[startIndex:], self.icon)
note.set_urgency(self.severityToUrgency[severity])
if not note.show():
print "Failed to send notification:", text
def configure(self):
self.gladefile = self.location + "/PopupNotifierConfig.glade"
self.wTree = gtk.glade.XML(self.gladefile, "PopupNotifierConfig")
self.dlg = self.wTree.get_widget("PopupNotifierConfig")
self.severitySelector = self.wTree.get_widget("severity_selector")
self.severitySelector.set_value(self.minSeverity)
self.severitySelector.connect("change-value", self.dlgChangeValue)
self.severityDescriptor = self.wTree.get_widget("severity_descriptor")
# self.descriptorTextBuffer = gtk.TextBuffer()
# self.severityDescriptor.set_buffer(self.descriptorTextBuffer)
self.dlgShowText()
# Show and run
self.dlg.show_all()
if self.dlg.run() == 1:
self.minSeverity = int(self.severitySelector.get_value())
self.config.set('plugin_popupnotifier_severity', self.minSeverity)
# else:
# print "Cancelled"
self.dlg.destroy()
self.config.save_to_file()
def dlgChangeValue(self, range, scroll, value):
self.severitySelector.set_value(round(value))
self.dlgShowText()
return True
def dlgShowText(self):
severity = int(self.severitySelector.get_value())
self.severityDescriptor.set_text(self.severityTexts[severity])
### MAIN
register_plugin("Popup Notifier", # The name of the plugin
plugin_PopupNotifier, # The plugin's class
"0.2", # The plugin's version number
"Popup Notifier plugin\n\nWritten by Kripkenstein", # A description of the plugin
config=True, # If the plugin can be configured
default=False, # If the plugin should be loaded by default
requires="0.5.0", # Required version of Deluge
interface="gtk", # Required Deluge interface
required_plugins=None # Any plugins that must be loaded before this
)