示例#1
0
class PurchaseViewer(gtk.Window):
    def __init__(self):
        gtk.Window.__init__(self)
        self.set_title('Purchases')
        self.search = SearchContainer(self.get_columns())
        self.search.set_summary_label('price')
        self.add(self.search)
        self._setup_searching()
        self._create_filters()

    def _setup_searching(self):
        self.query = StormQueryExecuter(store)
        self.search.set_query_executer(self.query)
        self.query.set_table(Sale)

    def _create_filters(self):
        self.search.set_text_field_columns(['description'])
        self.search.add_filter(DateSearchFilter('Date:'),
                               columns=['date'])

    def get_columns(self):
        return [Column('description', data_type=str, title='Description',
                       expand=True),
                Column('price', data_type=currency, title='Price'),
                Column('date', data_type=datetime.date, width=90)]
示例#2
0
class TaskViewer(gtk.Window):
    def __init__(self):
        gtk.Window.__init__(self)
        self.set_title('Tasks')
        self.search = SearchContainer(self.get_columns())
        self.add(self.search)
        self._setup_searching()
        self._create_filters()

    def _setup_searching(self):
        self.query = SQLAlchemyQueryExecuter(session)
        self.search.set_query_executer(self.query)
        self.query.set_table(Task)

    def _create_filters(self):
        categories = [(c.name, c.id) for c in session.query(Category).select()]
        categories.insert(0, ('Any', None))
        self.category_filter = ComboSearchFilter(
            'Category:', categories)
        self.search.add_filter(
            self.category_filter,
            SearchFilterPosition.TOP, ['id'])

        self.search.set_text_field_columns(['title'])
        self.search.add_filter(DateSearchFilter('Date:'),
                               columns=['date'])

    def get_columns(self):
        return [
            Column('title', data_type=str, title='Title',
                   expand=True),
            Column('category.name', title='Category'),
            Column('date', data_type=datetime.date, width=90)
            ]
示例#3
0
文件: tasks.py 项目: Schevo/kiwi
 def __init__(self):
     gtk.Window.__init__(self)
     self.set_title('Tasks')
     self.search = SearchContainer(self.get_columns())
     self.add(self.search)
     self._setup_searching()
     self._create_filters()
示例#4
0
 def __init__(self):
     gtk.Window.__init__(self)
     self.set_title('Purchases')
     self.search = SearchContainer(self.get_columns())
     self.search.set_summary_label('price')
     self.add(self.search)
     self._setup_searching()
     self._create_filters()
示例#5
0
文件: tasks.py 项目: Schevo/kiwi
class TaskViewer(gtk.Window):
    def __init__(self):
        gtk.Window.__init__(self)
        self.set_title('Tasks')
        self.search = SearchContainer(self.get_columns())
        self.add(self.search)
        self._setup_searching()
        self._create_filters()

    def _setup_searching(self):
        self.query = SQLObjectQueryExecuter()
        self.query.set_query(self._executer_query)
        self.search.set_query_executer(self.query)
        self.query.set_table(Task)

    def _create_filters(self):
        categories = [(c.name, c.id) for c in Category.select()]
        categories.insert(0, ('Any', None))
        self.category_filter = ComboSearchFilter(
            'Category:', categories)
        self.search.add_filter(
            self.category_filter,
            SearchFilterPosition.TOP, ['categoryID'])

        self.search.set_text_field_columns(['title'])
        self.search.add_filter(DateSearchFilter('Date:'),
                               columns=['date'])

    def _executer_query(self, query, conn):
        category_id = self.category_filter.get_state().value
        if category_id is not None:
            query = AND(Category.q.id == category_id, query)
        return Task.select(query)

    def get_columns(self):
        return [
            Column('title', data_type=str, title='Title',
                   expand=True),
            Column('category.name', title='Category'),
            Column('date', data_type=datetime.date, width=90)
            ]
示例#6
0
文件: financial.py 项目: romaia/stoq
 def __init__(self, page, columns):
     self.page = page
     self.model = page.model
     SearchContainer.__init__(self, columns)