[gnome-applets/wip/dont-use-deprecated: 87/87] Merge invest-libpanel4 into wip



commit 21d518a6bc9aa654618ceb3eaf838339ae13e548
Merge: 978397b 7a42fdb
Author: Enrico Minack <enrico-minack gmx de>
Date:   Fri Apr 1 19:37:45 2011 -0400

    Merge invest-libpanel4 into wip

 invest-applet/data/Invest_Applet.xml  |   14 +--
 invest-applet/data/financialchart.ui  |    4 +-
 invest-applet/invest/__init__.py      |   42 ++++++-
 invest-applet/invest/about.py         |    7 +-
 invest-applet/invest/applet.py        |  191 +++++++++++++++++++--------------
 invest-applet/invest/chart.py         |   78 ++++++++-----
 invest-applet/invest/help.py          |    4 +-
 invest-applet/invest/invest-applet.py |   26 +++--
 invest-applet/invest/preferences.py   |   10 ++-
 invest-applet/invest/quotes.py        |  100 ++++++++++++------
 invest-applet/invest/widgets.py       |   18 ++--
 11 files changed, 308 insertions(+), 186 deletions(-)
---
diff --cc invest-applet/invest/applet.py
index a0236f2,9b490b2..a1a7823
--- a/invest-applet/invest/applet.py
+++ b/invest-applet/invest/applet.py
@@@ -10,17 -14,34 +14,34 @@@ from invest.widgets import 
  
  Gtk.Window.set_default_icon_from_file(join(invest.ART_DATA_DIR, "invest_neutral.svg"))
  
 -class InvestApplet:
 +class InvestApplet(PanelApplet.Applet):
  	def __init__(self, applet):
+ 		invest.debug("init applet");
  		self.applet = applet
- 		self.applet.setup_menu_from_file (
- 			None, "Invest_Applet.xml",
- 			None, [("About", self.on_about), 
- 					("Help", self.on_help),
- 					("Prefs", self.on_preferences),
- 					("Refresh", self.on_refresh)
- 					])
  
+ 		# name, stock_id, label, accellerator, tooltip, callback
+ 		invest.debug("defining menu actions");
+ 		menu_actions = [("InvestAbout", Gtk.STOCK_HELP, "About", None, None, self.on_about), 
+ 				("InvestHelp", Gtk.STOCK_HELP, "Help", None, None, self.on_help),
+ 				("InvestPrefs", Gtk.STOCK_PREFERENCES, "Prefs", None, None, self.on_preferences),
+ 				("InvestRefresh", Gtk.STOCK_REFRESH, "Refresh", None, None, self.on_refresh)
+ 				]
+ 
+ 		invest.debug("creating action group")
+ 		actiongroup = Gtk.ActionGroup.new("InvestAppletActions")
+ 
+ 		invest.debug("setting translationd domain to %s " % invest.defs.GETTEXT_PACKAGE)
+ 		actiongroup.set_translation_domain(invest.defs.GETTEXT_PACKAGE)
+ 
+ 		# arguments: entries (array of action descriptions), n (the number of entries), userdata (passed to the action callbacks)
+ 		invest.debug("adding action menue to action group")
+ 		# actiongroup.add_actions(menu_actions, len(menu_actions), None)
+ 		actiongroup.add_actions(menu_actions, None)
+ 
+ 		invest.debug("setting up menu from file");
+ 		self.applet.setup_menu_from_file ("/home/enrico/git/gnome-applets/invest-applet/data/Invest_Applet.xml", actiongroup);
+ 
+ 		invest.debug("creating icon");
  		evbox = Gtk.HBox()
  		self.applet_icon = Gtk.Image()
  		self.set_applet_icon(0)
@@@ -116,69 -141,5 +141,71 @@@ class InvestmentsListWindow(Gtk.Window)
  		Calculates the position and moves the window to it.
  		"""
  		self.realize()
+ 		self.set_gravity(Gdk.Gravity.SOUTH_WEST)
  
 +		# Get our own dimensions & position
 +		#(wx, wy) = self.get_origin()
- 		(ax, ay) = self.applet.window.get_origin()
- 
- 		(ww, wh) = self.get_size ()
- 		(aw, ah) = self.applet.window.get_size ()
- 
- 		screen = self.applet.window.get_screen()
- 		monitor = screen.get_monitor_geometry (screen.get_monitor_at_window (self.applet.window))
- 
- 		if self.alignment == PanelApplet.ORIENT_LEFT:
- 			x = ax - ww
- 			y = ay
- 
- 			if (y + wh > monitor.y + monitor.height):
- 				y = monitor.y + monitor.height - wh
- 
- 			if (y < 0):
- 				y = 0
- 				
- 			if (y + wh > monitor.height / 2):
- 				gravity = gtk.gdk.GRAVITY_SOUTH_WEST
- 			else:
- 				gravity = gtk.gdk.GRAVITY_NORTH_WEST
- 					
- 		elif self.alignment == gnomeapplet.ORIENT_RIGHT:
- 			x = ax + aw
- 			y = ay
- 
- 			if (y + wh > monitor.y + monitor.height):
- 				y = monitor.y + monitor.height - wh
- 				
- 			if (y < 0):
- 				y = 0
- 				
- 			if (y + wh > monitor.height / 2):
- 				gravity = gtk.gdk.GRAVITY_SOUTH_EAST
- 			else:
- 				gravity = gtk.gdk.GRAVITY_NORTH_EAST
- 
- 		elif self.alignment == gnomeapplet.ORIENT_DOWN:
- 			x = ax
- 			y = ay + ah
- 
- 			if (x + ww > monitor.x + monitor.width):
- 				x = monitor.x + monitor.width - ww
- 
- 			if (x < 0):
- 				x = 0
- 
- 			gravity = gtk.gdk.GRAVITY_NORTH_WEST
- 		elif self.alignment == gnomeapplet.ORIENT_UP:
- 			x = ax
- 			y = ay - wh
- 
- 			if (x + ww > monitor.x + monitor.width):
- 				x = monitor.x + monitor.width - ww
- 
- 			if (x < 0):
- 				x = 0
- 
- 			gravity = gtk.gdk.GRAVITY_SOUTH_WEST
++#		(ax, ay) = self.applet.window.get_origin()
++#
++#		(ww, wh) = self.get_size ()
++#		(aw, ah) = self.applet.window.get_size ()
++#
++#		screen = self.applet.window.get_screen()
++#		monitor = screen.get_monitor_geometry (screen.get_monitor_at_window (self.applet.window))
++#
++#		if self.alignment == PanelApplet.ORIENT_LEFT:
++#			x = ax - ww
++#			y = ay
++#
++#			if (y + wh > monitor.y + monitor.height):
++#				y = monitor.y + monitor.height - wh
++#
++#			if (y < 0):
++#				y = 0
++#				
++#			if (y + wh > monitor.height / 2):
++#				gravity = gtk.gdk.GRAVITY_SOUTH_WEST
++#			else:
++#				gravity = gtk.gdk.GRAVITY_NORTH_WEST
++#					
++#		elif self.alignment == gnomeapplet.ORIENT_RIGHT:
++#			x = ax + aw
++#			y = ay
++#
++#			if (y + wh > monitor.y + monitor.height):
++#				y = monitor.y + monitor.height - wh
++#				
++#			if (y < 0):
++#				y = 0
++#				
++#			if (y + wh > monitor.height / 2):
++#				gravity = gtk.gdk.GRAVITY_SOUTH_EAST
++#			else:
++#				gravity = gtk.gdk.GRAVITY_NORTH_EAST
++#
++#		elif self.alignment == gnomeapplet.ORIENT_DOWN:
++#			x = ax
++#			y = ay + ah
++#
++#			if (x + ww > monitor.x + monitor.width):
++#				x = monitor.x + monitor.width - ww
++#
++#			if (x < 0):
++#				x = 0
++#
++#			gravity = gtk.gdk.GRAVITY_NORTH_WEST
++#		elif self.alignment == gnomeapplet.ORIENT_UP:
++#			x = ax
++#			y = ay - wh
++#
++#			if (x + ww > monitor.x + monitor.width):
++#				x = monitor.x + monitor.width - ww
++#
++#			if (x < 0):
++#				x = 0
++#
++#			gravity = gtk.gdk.GRAVITY_SOUTH_WEST
++#
++#		self.move(x, y)
++#		self.set_gravity(gravity)
 +
- 		self.move(x, y)
- 		self.set_gravity(gravity)
diff --cc invest-applet/invest/help.py
index 66399c5,49c3668..c2a4a66
--- a/invest-applet/invest/help.py
+++ b/invest-applet/invest/help.py
@@@ -1,8 -1,10 +1,10 @@@
  # -*- coding: utf-8 -*-
- from gi.repository import Gdk, Gtk
+ import pygtk
+ pygtk.require('2.0')
+ from gi.repository import Gtk, Gdk
  
  def show_help():
 -	gtk.show_uri(None, "ghelp:invest-applet", gtk.gdk.CURRENT_TIME)
 +	Gtk.show_uri(None, "ghelp:invest-applet", Gdk.CURRENT_TIME)
  
  def show_help_section(id):
 -	gtk.show_uri(None, "ghelp:invest-applet?%s" % id, gtk.gdk.CURRENT_TIME)
 +	Gtk.show_uri(None, "ghelp:invest-applet?%s" % id, Gdk.CURRENT_TIME)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]