• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mate_invest.debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mate_invest.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: show_run_hide

	def show_run_hide(self, explanation = ""):
		expl = self.ui.get_object("explanation")
		expl.set_markup(explanation)
		self.dialog.show_all()
		if explanation == "":
			expl.hide()
		# returns 1 if help is clicked
		while self.dialog.run() == 1:
			pass
		self.dialog.destroy()

		mate_invest.STOCKS = {}

		def save_symbol(model, path, iter, data):
			#if int(model[iter][1]) == 0 or float(model[iter][2]) < 0.0001:
			#	return

			if not model[iter][0] in mate_invest.STOCKS:
				mate_invest.STOCKS[model[iter][0]] = { 'label': model[iter][1], 'purchases': [] }
				
			mate_invest.STOCKS[model[iter][0]]["purchases"].append({
				"amount": float(model[iter][2]),
				"bought": float(model[iter][3]),
				"comission": float(model[iter][4]),
				"exchange": float(model[iter][5])
			})
		self.model.foreach(save_symbol, None)
		try:
			cPickle.dump(mate_invest.STOCKS, file(mate_invest.STOCKS_FILE, 'w'))
			mate_invest.debug('Stocks written to file')
		except Exception, msg:
			mate_invest.error('Could not save stocks file: %s' % msg)
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:32,代码来源:preferences.py


示例2: __init__

	def __init__(self):
		self.state = STATE_UNKNOWN
		self.statechange_callback = None

		try:
			# get an event loop
			loop = DBusGMainLoop()

			# get the NetworkManager object from D-Bus
			mate_invest.debug("Connecting to Network Manager via D-Bus")
			bus = dbus.SystemBus(mainloop=loop)
			nmobj = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
			nm = dbus.Interface(nmobj, 'org.freedesktop.NetworkManager')

			# connect the signal handler to the bus
			bus.add_signal_receiver(self.handler, None,
					'org.freedesktop.NetworkManager',
					'org.freedesktop.NetworkManager',
					'/org/freedesktop/NetworkManager')

			# get the current status of the network manager
			self.state = nm.state()
			mate_invest.debug("Current Network Manager status is %d" % self.state)
		except Exception, msg:
			mate_invest.error("Could not connect to the Network Manager: %s" % msg )
开发者ID:MotoHoss,项目名称:mate-applets,代码行数:25,代码来源:networkmanager.py


示例3: set_update_interval

	def set_update_interval(self, interval):
		if self.timeout_id != None:
			mate_invest.debug("Canceling refresh timer")
			GObject.source_remove(self.timeout_id)
			self.timeout_id = None
		if interval > 0:
			mate_invest.debug("Setting refresh timer to %s:%02d.%03d" % ( interval / 60000, interval % 60000 / 1000, interval % 1000) )
			self.timeout_id = GObject.timeout_add(interval, self.refresh)
开发者ID:david-xie,项目名称:mate-applets,代码行数:8,代码来源:quotes.py


示例4: save_quotes

	def save_quotes(self, data):
		mate_invest.debug("Storing quotes")
		try:
			f = open(mate_invest.QUOTES_FILE, 'w')
			f.write(data)
			f.close()
		except Exception, msg:
			mate_invest.error("Could not save the retrieved quotes file to %s: %s" % (mate_invest.QUOTES_FILE, msg) )
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:8,代码来源:quotes.py


示例5: __init__

	def __init__(self, tickers):
		Thread.__init__(self)
		_IdleObject.__init__(self)
		self.tickers = tickers
		self.retrieved = False
		self.data = []
		self.currencies = []
                mate_invest.debug("QuotesRetriever created");
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:8,代码来源:quotes.py


示例6: save_currencies

	def save_currencies(self, data):
		mate_invest.debug("Storing currencies to %s" % mate_invest.CURRENCIES_FILE)
		try:
			f = open(mate_invest.CURRENCIES_FILE, 'w')
			f.write(data)
			f.close()
		except Exception as msg:
			mate_invest.error("Could not save the retrieved currencies to %s: %s" % (mate_invest.CURRENCIES_FILE, msg) )
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:8,代码来源:quotes.py


示例7: on_currency_retriever_completed

	def on_currency_retriever_completed(self, retriever):
		if retriever.retrieved == False:
			mate_invest.error("Failed to retrieve currency rates!")
		else:
			mate_invest.debug("CurrencyRetriever completed")
			self.save_currencies(retriever.data)
			self.load_currencies()
		self.update_tooltip()
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:8,代码来源:quotes.py


示例8: run

	def run(self):
		quotes_url = QUOTES_URL % {"s": self.tickers}
		try:
			quotes_file = urlopen(quotes_url, proxies = mate_invest.PROXY)
			self.data = quotes_file.readlines ()
			quotes_file.close ()
		except Exception, msg:
			mate_invest.debug("Error while retrieving quotes data (url = %s): %s" % (quotes_url, msg))
开发者ID:david-xie,项目名称:mate-applets,代码行数:8,代码来源:quotes.py


示例9: handler

	def handler(self,signal=None):
		if isinstance(signal, dict):
			state = signal.get('State')
			if state != None:
				mate_invest.debug("Network Manager change state %d => %d" % (self.state, state) );
				self.state = state

				# notify about state change
				if self.statechange_callback != None:
					self.statechange_callback()
开发者ID:MotoHoss,项目名称:mate-applets,代码行数:10,代码来源:networkmanager.py


示例10: load_currencies

	def load_currencies(self):
		mate_invest.debug("Loading currencies from %s" % mate_invest.CURRENCIES_FILE)
		try:
			f = open(mate_invest.CURRENCIES_FILE, 'r')
			data = f.readlines()
			f.close()

			self.convert_currencies(self.parse_yahoo_csv(csv.reader(data)))
		except Exception as msg:
			mate_invest.error("Could not load the currencies from %s: %s" % (mate_invest.CURRENCIES_FILE, msg) )
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:10,代码来源:quotes.py


示例11: on_retriever_completed

	def on_retriever_completed(self, retriever):
		if retriever.retrieved == False:
                        mate_invest.debug("QuotesRetriever failed");
                        self.update_tooltip(_('Invest could not connect to Yahoo! Finance'))

		else:
                        mate_invest.debug("QuotesRetriever completed");
                        # cache the retrieved csv file
                        self.save_quotes(retriever.data)
                        # load the cache and parse it
                        self.load_quotes()
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:11,代码来源:quotes.py


示例12: load_quotes

	def load_quotes(self):
		mate_invest.debug("Loading quotes");
		try:
			f = open(mate_invest.QUOTES_FILE, 'r')
			data = f.readlines()
			f.close()

			self.populate(self.parse_yahoo_csv(csv.reader(data)))
			self.updated = True
			self.last_updated = datetime.datetime.fromtimestamp(getmtime(mate_invest.QUOTES_FILE))
			self.update_tooltip()
		except Exception, msg:
			mate_invest.error("Could not load the cached quotes file %s: %s" % (mate_invest.QUOTES_FILE, msg) )
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:13,代码来源:quotes.py


示例13: __init__

	def __init__(self, ui):
		self.ui = ui
		
		#Time ranges of the plot
		self.time_ranges = ["1d", "5d", "3m", "6m", "1y", "5y", "my"]
		
		# Window Properties
		win = ui.get_object("window")
		win.set_title(_("Financial Chart"))
		
		try:
			pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(join(mate_invest.ART_DATA_DIR, "invest_neutral.svg"), 96,96)
			self.ui.get_object("plot").set_from_pixbuf(pixbuf)
		except Exception, msg:
			mate_invest.debug("Could not load 'invest-neutral.svg' file: %s" % msg)
			pass
开发者ID:thassan,项目名称:mate-applets,代码行数:16,代码来源:chart.py


示例14: refresh

	def refresh(self):
		mate_invest.debug("Refreshing")

		# when nm tells me I am offline, stop the update interval
		if mate_invest.nm.offline():
			mate_invest.debug("We are offline, stopping update timer")
			self.set_update_interval(0)
			return False

		if len(mate_invest.STOCKS) == 0:
			return True

		tickers = '+'.join(mate_invest.STOCKS.keys())
		quotes_retriever = QuotesRetriever(tickers)
		quotes_retriever.connect("completed", self.on_retriever_completed)
		quotes_retriever.start()

		return True
开发者ID:david-xie,项目名称:mate-applets,代码行数:18,代码来源:quotes.py


示例15: __init__

	def __init__(self, ui):
		self.ui = ui
		
		#Time ranges of the plot (parameter / combo-box t)
		self.time_ranges = ["1d", "5d", "3m", "6m", "1y", "5y", "my"]
		
		#plot types (parameter / combo-box q)
		self.plot_types = ["l", "b", "c"]

		#plot scales (parameter / combo-box l)
		self.plot_scales = ["off", "on"]

		# Window Properties
		win = ui.get_object("window")
		win.set_title(_("Financial Chart"))
		
		try:
			pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(join(mate_invest.ART_DATA_DIR, "invest_neutral.svg"), 96,96)
			self.ui.get_object("plot").set_from_pixbuf(pixbuf)
		except Exception, msg:
			mate_invest.debug("Could not load 'invest-neutral.svg' file: %s" % msg)
			pass
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:22,代码来源:chart.py


示例16: len

				self.avg_quotes_change = 0
				
			# mark quotes to finally be valid
			self.quotes_valid = True

		except Exception, msg:
			mate_invest.debug("Failed to populate quotes: %s" % msg)
			mate_invest.debug(quotes)
			self.quotes_valid = False

		# start retrieving currency conversion rates
		if mate_invest.CONFIG.has_key("currency"):
			target_currency = mate_invest.CONFIG["currency"]
			symbols = []

			mate_invest.debug("These currencies occur: %s" % self.currencies)
			for currency in self.currencies:
				if currency == target_currency:
					continue

				mate_invest.debug("%s will be converted to %s" % ( currency, target_currency ))
				symbol = currency + target_currency + "=X"
				symbols.append(symbol)

			if len(symbols) > 0:
				tickers = '+'.join(symbols)
				quotes_retriever = QuotesRetriever(tickers)
				quotes_retriever.connect("completed", self.on_currency_retriever_completed)
				quotes_retriever.start()

	def convert_currencies(self, quotes):
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:31,代码来源:quotes.py


示例17: float

				"comission": float(model[iter][4]),
				"exchange": float(model[iter][5])
			})
		self.model.foreach(save_symbol, None)
		try:
			cPickle.dump(mate_invest.STOCKS, file(mate_invest.STOCKS_FILE, 'w'))
			mate_invest.debug('Stocks written to file')
		except Exception, msg:
			mate_invest.error('Could not save stocks file: %s' % msg)

		mate_invest.CONFIG = {}
		if self.currency_code != None and len(self.currency_code) == 3:
			mate_invest.CONFIG['currency'] = self.currency_code
		try:
			cPickle.dump(mate_invest.CONFIG, file(mate_invest.CONFIG_FILE, 'w'))
			mate_invest.debug('Configuration written to file')
		except Exception, msg:
			mate_invest.debug('Could not save configuration file: %s' % msg)

	def sync_ui(self):
		pass

	def on_add_stock(self, w):
		iter = self.model.append(["GOOG", "Google Inc.", 0.0, 0.0, 0.0, 0.0])
		path = self.model.get_path(iter)
		self.treeview.set_cursor(path, self.treeview.get_column(0), True)

	def on_remove_stock(self, w):
		model, paths = self.treeview.get_selection().get_selected_rows()
		for path in paths:
			model.remove(model.get_iter(path))
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:31,代码来源:preferences.py


示例18: run

	def run(self):
		self.image = Gtk.Image()
		try: sock = urllib.urlopen(self.image_url, proxies = mate_invest.PROXY)
		except Exception, msg:
			mate_invest.debug("Error while opening %s: %s" % (self.image_url, msg))
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:5,代码来源:chart.py


示例19: applet_factory

def applet_factory(applet, iid, data):
	mate_invest.debug('Starting invest instance: %s %s'% ( applet, iid ))
	mate_invest.applet.InvestApplet(applet)
	return True
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:4,代码来源:invest-applet.py


示例20: in

	standalone = False

	try:
		opts, args = getopt.getopt(sys.argv[1:], "hdw", ["help", "debug", "window"])
	except getopt.GetoptError:
		# Unknown args were passed, we fallback to behave as if
		# no options were passed
		opts = []
		args = sys.argv[1:]

	for o, a in opts:
		if o in ("-h", "--help"):
			usage()
		elif o in ("-d", "--debug"):
			mate_invest.DEBUGGING = True
			mate_invest.debug("Debugging enabled")
			# these messages cannot be turned by mate_invest.DEBUGGING at their originating location,
			# because that variable was set here to be True
			mate_invest.debug("Data Dir: %s" % mate_invest.SHARED_DATA_DIR)
			mate_invest.debug("Detected PROXY: %s" % mate_invest.PROXY)
		elif o in ("-w", "--window"):
			standalone = True

	if standalone:
		build_window()
		Gtk.main()
	else:
		MatePanelApplet.Applet.factory_main(
			"InvestAppletFactory",
			True,
			MatePanelApplet.Applet.__gtype__,
开发者ID:lukefromdc,项目名称:mate-applets,代码行数:31,代码来源:invest-applet.py



注:本文中的mate_invest.debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap