#-*- encoding: iso-8859-1 -*-
#-*- coding: iso-8859-1 -*-
import sys
import PyQt4
from pyHed.components import *
from pyHed.common import *
import frameCustom
class FrameCustomBtn(frameCustom.FrameCustom):
"""
This class shows the close button and the side panel (left side). Although, this class doesn't have data base integration. You should use this class
if you want to create a frame or a operation that pyHed don't have. You can also use this class to create frames to show information (ex: about screen).
Renato 01/06/2008. Rewrite by Edgar em 08/maio/2009
"""
def __init__(self, parent, params=None):
# change the default height of the pnlButtons by the component style
if pyHedConsts.defaultStyle:
self.heightPnlButtons = 26
else:
self.heightPnlButtons = 36
self.wLeft = 200
super(FrameCustomBtn, self).__init__(parent)
def onPaint(self):
super(FrameCustomBtn, self).onPaint()
# Side panel
self.pnlSubMenu = components.Panel(self, width=200, height=self.height(), bgColor='#F8F8F8')
# Button's panel
self.pnlButtons = components.Panel(self, width=self.width()-self.pnlSubMenu.width(), height=self.heightPnlButtons, x=self.wLeft, y=0, bgColor='#F8F8F8')
# main panel
self.pnlMain = components.Panel(self, width=self.pnlButtons.width(), height=self.height()-self.pnlButtons.height(), x=self.pnlSubMenu.width(), y=self.pnlButtons.height(), bgColor='#FFFFFF')
# close button
self.btnClose = components.Button(parent=self.PnlButtons, text=pyHedConsts.translation.getItem('framecustombtn', 'close_button'), icon='%s/icon_fechar.gif' % pyHedConsts.pyHedImagePath, x=self.PnlButtons.width() - 110, y=4, width=80, hint=pyHedConsts.translation.getItem('framecustombtn', 'hint_close_button'))
self.connect(self.btnClose, PyQt4.QtCore.SIGNAL('clicked()'), self.closeFrame)
def hidePnlSubMenu(self):
"""
Hides the pnlSubMenu (left panel) and maximize the others
Edgar, 02/set/2008
"""
# maximize the pnlMain
self.pnlMain.setFixedWidth(self.pnlSubMenu.width() + self.pnlMain.width())
self.pnlMain.setGeometry(0, self.pnlButtons.height(), self.pnlSubMenu.width() + self.pnlMain.width(), self.pnlMain.height())
# maximize the pnlButtons
self.pnlButtons.setFixedWidth(self.width())
self.pnlButtons.setGeometry(0, 0, self.pnlSubMenu.width() + self.pnlButtons.width(), self.pnlButtons.height())
# realocate the close button
self.btnClose.setGeometry(self.btnClose.x() + self.pnlSubMenu.width(), 4, self.btnClose.width(), self.btnClose.height() - 2)
# hides pnlSubMenu
self.pnlSubMenu.setVisible(False)
def __getPnlButtons(self):
return self.pnlButtons
def __getPnlSubMenu(self):
return self.pnlSubMenu
def __getPnlMain(self):
return self.pnlMain
PnlButtons = property(__getPnlButtons)
PnlMain = property(__getPnlMain)
PnlSubMenu = property(__getPnlSubMenu)