This repository has been archived by the owner on May 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
/
PantallaDatabase.py
110 lines (84 loc) · 3.19 KB
/
PantallaDatabase.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from PyQt4 import QtGui
from Code import BookGuide
from Code import DBgames
from Code.QT import Colocacion
from Code.QT import Controles
from Code.QT import Iconos
from Code.QT import QTVarios
from Code.QT import WBG_Games
from Code.QT import WBG_InfoMove
from Code.QT import WBG_Summary
class WBDatabase(QTVarios.WDialogo):
def __init__(self, wParent, procesador):
icono = Iconos.DatabaseC()
extparam = "database"
titulo = _("Database of complete games")
QTVarios.WDialogo.__init__(self, wParent, titulo, icono, extparam)
self.procesador = procesador
self.configuracion = procesador.configuracion
self.dbGames = DBgames.DBgames(self.configuracion.ficheroDBgames)
dicVideo = self.recuperarDicVideo()
self.bookGuide = BookGuide.BookGuide(self)
self.wsummary = WBG_Summary.WSummary(procesador, self, self.dbGames, siMoves=False)
self.wgames = WBG_Games.WGames(procesador, self, self.dbGames, self.wsummary, siMoves=False)
self.registrarGrid(self.wsummary.grid)
self.registrarGrid(self.wgames.grid)
self.ultFocus = None
self.tab = Controles.Tab()
self.tab.nuevaTab(self.wgames, _("Games"))
self.tab.nuevaTab(self.wsummary, _("Summary"))
self.tab.dispatchChange(self.tabChanged)
self.tab.ponTipoLetra(puntos=procesador.configuracion.puntosTB)
self.infoMove = WBG_InfoMove.WInfomove(self, siMoves=False)
self.splitter = splitter = QtGui.QSplitter()
splitter.addWidget(self.tab)
splitter.addWidget(self.infoMove)
layout = Colocacion.H().control(splitter).margen(5)
self.setLayout(layout)
self.recuperarVideo(anchoDefecto=1200, altoDefecto=600)
if not dicVideo:
dicVideo = {
'SPLITTER': [800, 380],
'TREE_1': 25,
'TREE_2': 25,
'TREE_3': 50,
'TREE_4': 661,
}
sz = dicVideo.get("SPLITTER", None)
if sz:
self.splitter.setSizes(sz)
self.inicializa()
def cambiaDBgames(self, fich):
self.dbGames.close()
self.dbGames = DBgames.DBgames(self.configuracion.ficheroDBgames)
self.setdbGames()
self.wsummary.actualizaPV("")
def setdbGames(self):
self.tab.ponValor(0, self.dbGames.rotulo())
self.wsummary.setdbGames(self.dbGames)
self.wgames.setdbGames(self.dbGames)
def tabChanged(self, ntab):
QtGui.QApplication.processEvents()
tablero = self.infoMove.tablero
tablero.desactivaTodas()
if ntab == 0:
self.wgames.actualiza()
else:
self.wsummary.gridActualiza()
def inicializa(self):
self.wsummary.setInfoMove(self.infoMove)
self.wgames.setInfoMove(self.infoMove)
self.setdbGames()
self.wsummary.actualizaPV("")
self.wgames.actualiza(True)
def terminar(self):
self.salvar()
self.accept()
def salvar(self):
dicExten = {
"SPLITTER": self.splitter.sizes(),
}
self.guardarVideo(dicExten)
self.dbGames.close()
def closeEvent(self, event):
self.salvar()