本文整理汇总了Python中mate_invest.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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 )
示例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)
示例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) )
示例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");
示例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) )
示例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()
示例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))
示例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()
示例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) )
示例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()
示例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) )
示例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
示例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
示例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