Skip to content

Commit 3f2bacb

Browse files
committed
Merge branch 'master' into prices_table
2 parents bc46d47 + 100401a commit 3f2bacb

29 files changed

Lines changed: 1818 additions & 1790 deletions

OpenNumismat/Collection/Collection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,7 @@ def isNeedBackup(self):
18221822

18231823
@waitCursorDecorator
18241824
def vacuum(self):
1825+
QSqlQuery("PRAGMA page_size=4096", self.db)
18251826
QSqlQuery("VACUUM", self.db)
18261827

18271828
@staticmethod

OpenNumismat/SettingsDialog.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,24 @@ class MainSettingsPage(QWidget):
5858
("Український", 'uk'),
5959
)
6060
Currencies = (
61+
('ARS', QT_TRANSLATE_NOOP("Currency", "ARS - Argentine peso")),
62+
('AUD', QT_TRANSLATE_NOOP("Currency", "AUD - Australian dollar")),
6163
('BRL', QT_TRANSLATE_NOOP("Currency", "BRL - Brazilian real")),
6264
('BYN', QT_TRANSLATE_NOOP("Currency", "BYN - Belarusian ruble")),
65+
('CAD', QT_TRANSLATE_NOOP("Currency", "CAD - Canadian dollar")),
66+
('CHF', QT_TRANSLATE_NOOP("Currency", "CHF - Swiss franc")),
6367
('CZK', QT_TRANSLATE_NOOP("Currency", "CZK - Czech koruna")),
6468
('EUR', QT_TRANSLATE_NOOP("Currency", "EUR - Euro")),
6569
('GBP', QT_TRANSLATE_NOOP("Currency", "GBP - Pound sterling")),
6670
('HUF', QT_TRANSLATE_NOOP("Currency", "HUF - Hungarian forint")),
71+
('INR', QT_TRANSLATE_NOOP("Currency", "INR - Indian rupee")),
72+
('NOK', QT_TRANSLATE_NOOP("Currency", "NOK - Norwegian krone")),
6773
('PLN', QT_TRANSLATE_NOOP("Currency", "PLN - Polish złoty")),
6874
('RUB', QT_TRANSLATE_NOOP("Currency", "RUB - Russian ruble")),
6975
('SEK', QT_TRANSLATE_NOOP("Currency", "SEK - Swedish krona")),
7076
('TRY', QT_TRANSLATE_NOOP("Currency", "TRY - Turkish lira")),
7177
('UAH', QT_TRANSLATE_NOOP("Currency", "UAH - Ukrainian hryvnia")),
72-
('USD', QT_TRANSLATE_NOOP("Currency", "USD - United States dollar"))
78+
('USD', QT_TRANSLATE_NOOP("Currency", "USD - United States dollar")),
7379
)
7480

7581
def __init__(self, collection, parent=None):

OpenNumismat/SummaryDialog.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ def fillSummary(self, model, filter_=None):
7070
sql = self.makeSql(sql, filter_)
7171
query = QSqlQuery(sql, model.database())
7272
while query.next():
73-
quantity = query.record().value('quantity')
74-
if not isinstance(quantity, int):
73+
try:
74+
quantity = int(query.record().value('quantity'))
75+
except (ValueError, TypeError):
7576
quantity = 1
7677
quantity_owned += quantity
7778
count_owned += 1
@@ -194,7 +195,10 @@ def fillSummary(self, model, filter_=None):
194195
price2 = record.value(2)
195196
price3 = record.value(3)
196197
price4 = record.value(4)
197-
quantity = int(record.value(5) or 1)
198+
try:
199+
quantity = int(record.value('quantity'))
200+
except (ValueError, TypeError):
201+
quantity = 1
198202

199203
try:
200204
if grade[:2] in ('UN', 'MS'):

OpenNumismat/TabView.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class TabView(QTabWidget):
3030
def __init__(self, parent):
3131
super().__init__(parent)
3232

33+
self.collection = None
34+
3335
tabBar = TabBar(self)
3436
self.setTabBar(tabBar)
3537

@@ -47,7 +49,8 @@ def __init__(self, parent):
4749
self.__createActions()
4850

4951
def mouseDoubleClickEvent(self, _event):
50-
self.newList()
52+
if self.collection and self.collection.isOpen():
53+
self.newList()
5154

5255
def tabDClicked(self, index):
5356
self.renamePage(index)
@@ -337,18 +340,19 @@ def openPageEvent(self):
337340
def updateOpenPageMenu(self):
338341
menu = self.__actions['open']
339342
menu.clear()
340-
closedPages = self.collection.pages().closedPages()
341-
hasClosedPages = len(closedPages)
342-
menu.setEnabled(hasClosedPages)
343-
if hasClosedPages:
344-
for pageParam in closedPages:
345-
act = QAction(pageParam.title, self)
346-
act.setData(pageParam)
347-
act.triggered.connect(self.openPageEvent)
348-
menu.addAction(act)
349-
350-
menu.addSeparator()
351-
menu.addAction(self.__actions['removeAll'])
343+
if self.collection:
344+
closedPages = self.collection.pages().closedPages()
345+
hasClosedPages = len(closedPages)
346+
menu.setEnabled(hasClosedPages)
347+
if hasClosedPages:
348+
for pageParam in closedPages:
349+
act = QAction(pageParam.title, self)
350+
act.setData(pageParam)
351+
act.triggered.connect(self.openPageEvent)
352+
menu.addAction(act)
353+
354+
menu.addSeparator()
355+
menu.addAction(self.__actions['removeAll'])
352356

353357
def currentListView(self):
354358
return self.currentWidget().listView

OpenNumismat/db/demo_bg.db

0 Bytes
Binary file not shown.

OpenNumismat/db/demo_ca.db

0 Bytes
Binary file not shown.

OpenNumismat/db/demo_cs.db

0 Bytes
Binary file not shown.

OpenNumismat/db/demo_de.db

0 Bytes
Binary file not shown.

OpenNumismat/db/demo_el.db

0 Bytes
Binary file not shown.

OpenNumismat/db/demo_en.db

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)