[POS-commit] r1118 - stoq/trunk/stoq/lib
Evandro Vale Miquelito
evandro at async.com.br
Thu Sep 1 20:55:37 BRT 2005
Author: evandro
Date: Thu Sep 1 20:55:36 2005
New Revision: 1118
Modified:
stoq/trunk/stoq/lib/parameters.py
stoq/trunk/stoq/lib/stoqconfig.py
Log:
Adding a small improvement. Now we have a parameter to set a default
maximum number of results to be showed in each search dialog.
We can also get easily all the objects just typing RETURN in a search bar.
Modified: stoq/trunk/stoq/lib/parameters.py
==============================================================================
--- stoq/trunk/stoq/lib/parameters.py (original)
+++ stoq/trunk/stoq/lib/parameters.py Thu Sep 1 20:55:36 2005
@@ -102,6 +102,9 @@
* EDIT_SELLABLE_PRICE(integer): Can we change the price attribute
of a SellableItem object during a
sale ?
+
+ * MAX_SEARCH_RESULTS(integer): The maximum number of results we must
+ show after searching in a SearchBar.
"""
import gettext
@@ -162,6 +165,7 @@
HAS_DELIVERY_MODE=1,
STOCK_BALANCE_PRECISION=2,
EDIT_SELLABLE_PRICE=1,
+ MAX_SEARCH_RESULTS=600,
ACCEPT_ORDER_PRODUCTS=1)
def __init__(self, conn):
@@ -326,6 +330,10 @@
def EDIT_SELLABLE_PRICE(self):
return self.get_integer_parameter('EDIT_SELLABLE_PRICE')
+ @property
+ def MAX_SEARCH_RESULTS(self):
+ return self.get_integer_parameter('MAX_SEARCH_RESULTS')
+
def sysparam(conn):
return ParameterAccess(conn)
Modified: stoq/trunk/stoq/lib/stoqconfig.py
==============================================================================
--- stoq/trunk/stoq/lib/stoqconfig.py (original)
+++ stoq/trunk/stoq/lib/stoqconfig.py Thu Sep 1 20:55:36 2005
@@ -37,11 +37,14 @@
from stoqlib.exceptions import DatabaseError, _warn
from stoqlib.database import set_model_connection_func
from stoqlib.gui.dialogs import notify_dialog
+from stoqlib.gui.search import set_max_search_results
from stoqlib.gui.gtkadds import register_iconsets
from stoq.gui.components.login import LoginDialog
from stoq.lib.configparser import StoqConfigParser
-from stoq.lib.runtime import new_transaction, set_current_user
+from stoq.lib.parameters import sysparam
+from stoq.lib.runtime import (new_transaction, set_current_user,
+ get_connection)
from stoq.domain.person import PersonAdaptToUser
from stoq.domain.tables import check_tables
@@ -125,6 +128,10 @@
# Registering some new important stock icons
register_iconsets()
+ conn = get_connection()
+ max_search_results = sysparam(conn).MAX_SEARCH_RESULTS
+ set_max_search_results(max_search_results)
+
set_model_connection_func(new_transaction)
assert self.validate_user()
More information about the POS-commit
mailing list