add parameter 'nb_rooms' in queries
This commit is contained in:
parent
825dc0b5b1
commit
b6379f7f37
9 changed files with 71 additions and 7 deletions
|
|
@ -145,6 +145,7 @@ class Flatboob(ReplApplication):
|
|||
query.area_max = self.ask_int('Enter max area')
|
||||
query.cost_min = self.ask_int('Enter min cost')
|
||||
query.cost_max = self.ask_int('Enter max cost')
|
||||
query.nb_rooms = self.ask_int('Enter number of rooms')
|
||||
|
||||
self.change_path('/housings')
|
||||
for backend, housing in self.do('search_housings', query):
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@ class MainWindow(QtMainWindow):
|
|||
query['area_max'] = querydlg.ui.areaMax.value()
|
||||
query['cost_min'] = querydlg.ui.costMin.value()
|
||||
query['cost_max'] = querydlg.ui.costMax.value()
|
||||
try:
|
||||
query['nb_rooms'] = int(querydlg.ui.nbRooms.itemText(querydlg.ui.nbRooms.currentIndex()))
|
||||
except ValueError:
|
||||
query['nb_rooms'] = 0
|
||||
self.config.set('queries', name, query)
|
||||
self.config.save()
|
||||
|
||||
|
|
@ -112,6 +116,7 @@ class MainWindow(QtMainWindow):
|
|||
query.area_max = int(q['area_max']) or None
|
||||
query.cost_min = int(q['cost_min']) or None
|
||||
query.cost_max = int(q['cost_max']) or None
|
||||
query.nb_rooms = int(q['nb_rooms']) or None
|
||||
|
||||
self.process = QtDo(self.weboob, self.addHousing)
|
||||
self.process.do('search_housings', query)
|
||||
|
|
@ -123,8 +128,8 @@ class MainWindow(QtMainWindow):
|
|||
return
|
||||
|
||||
item = QListWidgetItem()
|
||||
item.setText(u'<h2>%s</h2><i>%s — %s%s (%s)</i><br />%s' % (housing.title, housing.date.strftime('%Y-%m-%d') if housing.date else 'Unknown',
|
||||
housing.cost, housing.currency, housing.backend, housing.text))
|
||||
item.setText(u'<h2>%s</h2><i>%s — %sm² — %s%s (%s)</i><br />%s' % (housing.title, housing.date.strftime('%Y-%m-%d') if housing.date else 'Unknown',
|
||||
housing.area, housing.cost, housing.currency, housing.backend, housing.text))
|
||||
item.setData(Qt.UserRole, housing)
|
||||
|
||||
if housing.photos is NotLoaded:
|
||||
|
|
@ -225,11 +230,13 @@ class MainWindow(QtMainWindow):
|
|||
def display_photo(self):
|
||||
if not self.housing.photos:
|
||||
self.ui.photoUrlLabel.setText('')
|
||||
self.ui.photoLabel.setText('')
|
||||
return
|
||||
|
||||
if self.displayed_photo_idx >= len(self.housing.photos):
|
||||
self.displayed_photo_idx = len(self.housing.photos) - 1
|
||||
if self.displayed_photo_idx < 0:
|
||||
self.ui.photoLabel.setText('')
|
||||
self.ui.photoUrlLabel.setText('')
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,51 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Number of rooms</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="nbRooms">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>N/A</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class Query(CapBaseObject):
|
|||
self.add_field('area_max', int)
|
||||
self.add_field('cost_min', int)
|
||||
self.add_field('cost_max', int)
|
||||
self.add_field('nb_rooms', int)
|
||||
|
||||
class City(CapBaseObject):
|
||||
def __init__(self, id):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue