+++ /dev/null
-# Authors: Amaury Medeiros and Paulo Ouriques
-# Software License: GPL
-
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
-
-from ui.pcsapp import PcsApp
-from ui.pcsdevicewidget import PcsDeviceWidget
-from ui.pcsuiutils import *
-from ui.pcsbutton import *
-from ui.tsuigeneralmethods import *
-
-from ui.pcscustombuttons import PcsCustomButton as customButton
-
-from pcswindowmanager import *
-
-class PcsBackup(PcsApp):
-
- def __init__(self, deviceInfo, parent=None):
- PcsApp.__init__(self, parent)
- self.deviceInfo = deviceInfo
-
- if (self.deviceInfo != None):
- self.windowManager = PcsWindowManager(self.deviceInfo, self)
-
- self.setWindowIcon(QIcon(BACKUP_IMAGE))
- self.setWindowTitle("%s Backup" % APPLICATION_NAME)
-
- self.hLayout = QHBoxLayout()
- self.hLayout.setMargin(8)
- self.vLayout = QVBoxLayout()
-
- spc = QSpacerItem(0,50)
- self.optionsLayout = QVBoxLayout()
- self.optionsLayout.addItem(spc)
- self._addButtons()
- self.optionsLayout.addItem(spc)
-
- self.deviceWidget = PcsDeviceWidget(1)
- self.deviceWidget.addBorder()
- self.deviceWidget.addDeviceName()
- self.deviceWidget.setDeviceInfo(self.deviceInfo)
-
- self.optionsBorderLayout = QGridLayout()
- self.optionsBorderLabel = QLabel()
- self.optionsBorderLabel.setFixedSize(208, 205)
- self.optionsBorderLabel.setPixmap(QPixmap(DEVICE_BACKUP_BORDER))
- self.optionsBorderLayout.addWidget(self.optionsBorderLabel, 0, 0, Qt.AlignCenter)
- self.optionsBorderLayout.addLayout(self.optionsLayout, 0, 0, Qt.AlignCenter)
- self.hLayout.addLayout(self.optionsBorderLayout)
- self.hLayout.addWidget(self.deviceWidget)
-
- #FIXE ME
- l1 = QLabel("<font style='color: #333333'; size=2>Main</font>")
- self.vLayout.addItem(TOP_SPACER)
- self.vLayout.addWidget(l1)
- self.vLayout.addLayout(self.hLayout)
- informationLayout = QHBoxLayout()
- spc = QSpacerItem(10, 0)
- iconAlert = QLabel()
- iconAlert.setPixmap(QPixmap(ICON_ALERT))
- information = QLabel("<font style='color:"\
- "#333333'; size=2>"\
- "Select an action.</font>")
- informationLayout.addItem(spc)
- informationLayout.addWidget(iconAlert)
- informationLayout.addWidget(information, Qt.AlignLeft)
- self.vLayout.addLayout(informationLayout)
- self.vLayout.setMargin(8)
- self.setLayout(self.vLayout)
-
- def openBackupWizard(self):
-
- if(self.deviceInfo and self.deviceInfo.ip != None):
- backup_wizard = self.windowManager.getNewBackup()
- centralize(backup_wizard)
- backup_wizard.setGeometry(self.geometry())
- backup_wizard.exec_()
- self.setVisible(False)
- self.setGeometry(backup_wizard.geometry())
- else:
- showMessageBox("No devices were found.", "")
-
- def openBackupManagerDialog(self):
- if(self.deviceInfo and self.deviceInfo.ip != None):
- backupManager = self.windowManager.getBackupManager()
- centralize(backupManager)
- backupManager.show()
- self.setVisible(False)
- else:
- showMessageBox("No devices were found.", "")
-
- def openRestoreBackupDialog(self):
- if(self.deviceInfo and self.deviceInfo.ip != None):
- restoreBackup = self.windowManager.getRestoreBackup()
- centralize(restoreBackup)
- restoreBackup.show()
- self.setVisible(False)
- else:
- showMessageBox("No devices were found.", "")
-
- def _addButtons(self):
- infList = [("New Backup ", ICON_NEW_BACKUP),
- ("Manage Backups", ICON_MANAGER_BACKUP),
- ("Restore Backups ", ICON_RESTORE_BACKUP)]
- buttonsList = []
- for inf in infList:
- buttonOptions = PcsButton(inf[0])
- buttonOptions.setStyleSheet("background-image\
- :url("+ BUTTON_WITH_ICON_BG +");\
- qproperty-icon:url("+inf[1]+");\
- min-height:50px; min-width:188px;\
- max-height:50px; max-width:188px;\
- qproperty-iconSize: 43px 36px")
- self.optionsLayout.addWidget(buttonOptions)
- buttonsList.append(buttonOptions)
-
- self.connect(buttonsList[0], SIGNAL("clicked()"),
- self.openBackupWizard)
- self.connect(buttonsList[1], SIGNAL("clicked()"),
- self.openBackupManagerDialog)
- self.connect(buttonsList[2], SIGNAL("clicked()"),
- self.openRestoreBackupDialog)
-