本文整理汇总了Python中Code.QT.QTUtil.tamEscritorio方法的典型用法代码示例。如果您正苦于以下问题:Python QTUtil.tamEscritorio方法的具体用法?Python QTUtil.tamEscritorio怎么用?Python QTUtil.tamEscritorio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Code.QT.QTUtil
的用法示例。
在下文中一共展示了QTUtil.tamEscritorio方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: recuperarVideo
# 需要导入模块: from Code.QT import QTUtil [as 别名]
# 或者: from Code.QT.QTUtil import tamEscritorio [as 别名]
def recuperarVideo(self, siTam=True, anchoDefecto=None, altoDefecto=None):
dic = self.recuperarDicVideo()
wE, hE = QTUtil.tamEscritorio()
if dic:
wE, hE = QTUtil.tamEscritorio()
x, y = dic["_POSICION_"].split(",")
x = int(x)
y = int(y)
if not ( 0 <= x <= (wE - 50) ):
x = 0
if not ( 0 <= y <= (hE - 50) ):
y = 0
self.move(x, y)
if siTam:
if "_SIZE_" not in dic:
w, h = self.width(),self.height()
for k in dic:
if k.startswith( "_TAMA" ):
w, h = dic[k].split(",")
else:
w, h = dic["_SIZE_"].split(",")
w = int(w)
h = int(h)
if w > wE:
w = wE
elif w < 20:
w = 20
if h > (hE - 40):
h = hE - 40
elif h < 20:
h = 20
self.resize(w, h)
for grid in self.liGrids:
grid.recuperarVideo(dic)
grid.ponAnchosColumnas()
for sp, name in self.liSplitters:
k = "SP_%s" % name
if k in dic:
sp.setSizes(dic[k])
return True
else:
if anchoDefecto or altoDefecto:
if anchoDefecto is None:
anchoDefecto = self.width()
if altoDefecto is None:
altoDefecto = self.height()
if anchoDefecto > wE:
anchoDefecto = wE
if altoDefecto > (hE - 40):
altoDefecto = hE - 40
self.resize(anchoDefecto, altoDefecto)
return False
示例2: recuperarVideo
# 需要导入模块: from Code.QT import QTUtil [as 别名]
# 或者: from Code.QT.QTUtil import tamEscritorio [as 别名]
def recuperarVideo(self, dicVideo):
if dicVideo:
wE, hE = QTUtil.tamEscritorio()
x, y = dicVideo["_POSICION_"].split(",")
x = int(x)
y = int(y)
if not ( 0 <= x <= (wE - 50) ):
x = 0
if not ( 0 <= y <= (hE - 50) ):
y = 0
self.move(x, y)
if "_SIZE_" not in dicVideo:
w, h = self.width(),self.height()
for k in dicVideo:
if k.startswith( "_TAMA" ):
w, h = dicVideo[k].split(",")
else:
w, h = dicVideo["_SIZE_"].split(",")
w = int(w)
h = int(h)
if w > wE:
w = wE
elif w < 20:
w = 20
if h > hE:
h = hE
elif h < 20:
h = 20
self.resize(w, h)
示例3: __init__
# 需要导入模块: from Code.QT import QTUtil [as 别名]
# 或者: from Code.QT.QTUtil import tamEscritorio [as 别名]
def __init__(self, owner, dbf, dClaves, gestor, estado, siElegir):
titulo = _("Choose a game to view") if siElegir else _("PGN viewer")
icono = Iconos.PGN()
extparam = "pgnelegir"
QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)
self.siElegir = siElegir
self.gestor = gestor
self.dClaves = dClaves = copy.deepcopy(dClaves)
self.seHaBorradoAlgo = False # Para que se haga un touch antiguo al DB y lo regenere la proxima vez
siRepite = estado is not None
if siRepite:
self.estado = estado
else:
self.estado = EstadoWpgn()
self.dbf = dbf
if siRepite:
self.estado.recuperaDBF(dbf)
else:
self.dbf.leer()
# Filtro
self.liFiltro = self.estado.liFiltro if siRepite else []
# Status bar-> antes que grid porque se actualiza en gridNumDatos
self.status = QtGui.QStatusBar(self)
self.status.setFixedHeight(22)
# Lista
oColumnas = Columnas.ListaColumnas()
oColumnas.nueva("numero", _("N."), 50, siCentrado=True)
def creaCol(clave, rotulo, siCentrado=True):
tam = max(dClaves[clave], len(rotulo), 11)
oColumnas.nueva(clave, rotulo, tam * 6, siCentrado=siCentrado)
# # Claves segun orden estandar
liBasic = ("EVENT", "SITE", "DATE", "ROUND", "WHITE", "BLACK", "RESULT", "ECO", "FEN", "WHITEELO", "BLACKELO" )
self.liOrdenClaves = [] # nos servira en el exterior, para paste pgn y para mostrar info
for clave in liBasic:
if clave in dClaves:
rotulo = TrListas.pgnLabel(clave)
creaCol(clave, rotulo, clave != "EVENT")
self.liOrdenClaves.append(clave)
for clave in dClaves:
if clave.upper() not in liBasic:
rotulo = TrListas.pgnLabel(clave)
creaCol(clave.upper(), rotulo, clave != "EVENT")
self.liOrdenClaves.append(clave.upper())
dicVideoGrid = self.estado.dicVideoGrid if siRepite else None
self.grid = Grid.Grid(self, oColumnas, siSelecFilas=True, dicVideo=dicVideoGrid, siSeleccionMultiple=True)
if siRepite:
self.grid.goto(self.estado.recno, 0)
else:
self.grid.gotop()
if siRepite:
self.estado.recuperaWindow(self)
else:
n = self.grid.anchoColumnas() + 20
w, h = QTUtil.tamEscritorio()
self.resize(min(w * 9 / 10, n), h * 8 / 10)
# Toolbar
if siElegir:
liAcciones = [( _("Choose"), Iconos.Aceptar(), self.elegir ), None,
( _("Cancel"), Iconos.Cancelar(), self.cancelar ), None,
( _("First"), Iconos.Inicio(), self.grid.gotop ),
( _("Last"), Iconos.Final(), self.grid.gobottom ), None,
( _("Filter"), Iconos.Filtrar(), self.filtrar ), None,
]
else:
liAcciones = [
( _("Close"), Iconos.MainMenu(), self.cancelar ), None,
( _("View"), Iconos.Ver(), self.elegir ), None,
( _("Edit"), Iconos.Modificar(), self.editar ), None,
( _("Save"), Iconos.Grabar(), self.guardar ), None,
( _("First"), Iconos.Inicio(), self.grid.gotop ),
( _("Last"), Iconos.Final(), self.grid.gobottom ), None,
( _("Filter"), Iconos.Filtrar(), self.filtrar ), None,
( _("Remove"), Iconos.Borrar(), self.borrar ), None,
( _("Utilities"), Iconos.Utilidades(), self.utilidades ), None
]
tb = Controles.TBrutina(self, liAcciones)
# Layout
layout = Colocacion.V().control(tb).control(self.grid).control(self.status).margen(3)
self.setLayout(layout)
self.recuperarVideo(siTam=False)
self.ponStatus()
示例4: dameCategoria
# 需要导入模块: from Code.QT import QTUtil [as 别名]
# 或者: from Code.QT.QTUtil import tamEscritorio [as 别名]
def dameCategoria(wParent, configuracion, procesador):
rival = configuracion.rival
menu = QTVarios.LCMenu(wParent)
menu.opcion(None, "%s: %d %s" % (_("Total score"), configuracion.puntuacion(), _("pts")), Iconos.NuevaPartida())
menu.separador()
menu.opcion(None, "%s: %s" % (_("Opponent"), rival.rotuloPuntos()), Iconos.Motor(), siDeshabilitado=False)
menu.separador()
# ---------- CATEGORIAS
ant = 1
for x in range(6):
cat = rival.categorias.numero(x)
txt = cat.nombre()
nm = cat.nivelHecho
nh = cat.hecho
if nm > 0:
txt += " %s %d" % (_("Level"), nm)
if nh:
if "B" in nh:
txt += " +%s:%d" % ( _("White"), nm + 1)
if "N" in nh:
txt += " +%s:%d" % ( _("Black"), nm + 1)
# if "B" not in nh:
# txt += " ... %s:%d"%( _( "White" )[0],nm+1)
# elif "N" not in nh:
# txt += " ... %s:%d"%( _( "Black" )[0],nm+1)
# else:
# txt += " ... %s:%d"%( _( "White" )[0],nm+1)
siDesHabilitado = (ant == 0)
ant = nm
menu.opcion(str(x), txt, cat.icono(), siDeshabilitado=siDesHabilitado)
# ----------- RIVAL
menu.separador()
menuRival = menu.submenu(_("Change opponent"))
puntuacion = configuracion.puntuacion()
icoNo = Iconos.Motor_No()
icoSi = Iconos.Motor_Si()
icoActual = Iconos.Motor_Actual()
grpNo = Iconos.Grupo_No()
grpSi = Iconos.Grupo_Si()
for grupo in configuracion.grupos.liGrupos:
nombre = _X(_("%1 group"), grupo.nombre)
if grupo.minPuntos > 0:
nombre += " (+%d %s)" % (grupo.minPuntos, _("pts") )
siDes = (grupo.minPuntos > puntuacion)
if siDes:
icoG = grpNo
icoM = icoNo
else:
icoG = grpSi
icoM = icoSi
submenu = menuRival.submenu(nombre, icoG)
for rv in grupo.liRivales:
siActual = rv.clave == rival.clave
ico = icoActual if siActual else icoM
submenu.opcion("MT_" + rv.clave, rv.rotuloPuntos(), ico, siDes or siActual)
menuRival.separador()
# ----------- RIVAL
menu.separador()
menu.opcion("ayuda", _("Help"), Iconos.Ayuda())
cursor = QtGui.QCursor.pos()
resp = menu.lanza()
if resp is None:
return None
elif resp == "ayuda":
titulo = _("Competition")
ancho, alto = QTUtil.tamEscritorio()
ancho = min(ancho, 700)
txt = _("<br><b>The aim is to obtain the highest possible score</b> :<ul><li>The current point score is displayed in the title bar.</li><li>To obtain points it is necessary to win on different levels in different categories.</li><li>To overcome a level it is necessary to win against the engine with white and with black.</li><li>The categories are ranked in the order of the following table:</li><ul><li><b>Beginner</b> : 5</li><li><b>Amateur</b> : 10</li><li><b>Master candidate</b> : 20</li><li><b>Master</b> : 40</li><li><b>Grandmaster candidate</b> : 80</li><li><b>Grandmaster</b> : 160</li></ul><li>The score for each game is calculated by multiplying the playing level with the score of the category.</li><li>The engines are divided into groups.</li><li>To be able to play with an opponent of a particular group a minimum point score is required. The required score is shown next to the group label.</li></ul>")
Info.info(wParent, _("Lucas Chess"), titulo, txt, ancho, Iconos.pmAyudaGR())
return None
elif resp.startswith("MT_"):
procesador.cambiaRival(resp[3:])
QtGui.QCursor.setPos(cursor)
procesador.competicion()
return None
else:
categoria = rival.categorias.numero(int(resp))
return categoria