Commit 4038cc9b authored by Romain Bignon's avatar Romain Bignon

added a launcher wrapper for nulog-qt

This wrapper allows you to use BNPorc specifics fragments types.
parent acb77fae
#!/usr/bin/env python2.5
# -*- coding: utf-8 -*-
"""
Copyright(C) 2009 Romain Bignon
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""
from sys import exit,path
path.append('.')
from nucentral.qt import create_nucentral_application
from nulog.client.qt.fetchers.base import BaseFetcher
class BNPFetcher(BaseFetcher):
def getArgs(self):
return self.call('bnporc', self.fragment.type, {}, True)
def count(self, callback):
return self.asyncall('bnporc', self.fragment.type, self.fragment.args, callback=lambda x: self.count_cb(x, callback), errback=self._errorHandler)
def count_cb(self, result, callback):
counter = 0
for line in result['table']:
counter += int(line[1])
return callback(counter)
def fetch(self, callback):
return self.asyncall('bnporc', self.fragment.type, self.fragment.args, callback=callback, errback=self._errorHandler)
if __name__ == "__main__":
app, client = create_nucentral_application(
name="nulog",
resource="nulog3.rcc",
locale=":/locale/nulog")
from nulog.client.qt.fragtypes import frag_types, FragType
frag_types['bnp_accounts'] = FragType('BNP Accounts', BNPFetcher, ('table', 'pie', 'histo',))
frag_types['bnp_coming'] = FragType('BNP Coming Operations', BNPFetcher, ('table', 'pie', 'histo',))
from nulog.client.qt.args import arg_types, ArgType
from nulog.client.qt.args.argfilter import ArgFilterText, ArgFilterForbidden
arg_types['account'] = ArgType('Account', ArgFilterText, None)
arg_types['label'] = ArgType('Label')
arg_types['amount'] = ArgType('Amount', ArgFilterForbidden, unit=u"€")
arg_types['coming'] = ArgType('Coming', ArgFilterForbidden, unit=u"€")
from nulog.client.qt.nulog_window import NuLogMainWindow
window = NuLogMainWindow(app, client, standalone=True)
window.load()
window.show()
exit(app.exec_())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment