def __init__(self, parent=None): QWidget.__init__(self, parent) self.searchButton = ToolButton('test', QIcon('images/search.png'), self) self.searchButton.setCursor(Qt.PointingHandCursor) self.searchButton.clicked.connect(self.searchClicked) self.setStyleSheet('QLineEdit{background-color: #FFF; color: #000; ' 'border: 1px solid #D6D6D6; padding: 2px}')
class SearchBar(QLineEdit): searchClicked = pyqtSignal() def __init__(self, parent=None): QWidget.__init__(self, parent) self.searchButton = ToolButton('test', QIcon('images/search.png'), self) self.searchButton.setCursor(Qt.PointingHandCursor) self.searchButton.clicked.connect(self.searchClicked) self.setStyleSheet('QLineEdit{background-color: #FFF; color: #000; ' 'border: 1px solid #D6D6D6; padding: 2px}') def resizeEvent(self, e): size = self.searchButton.sizeHint() self.searchButton.move(self.rect().right() - size.width() - 5, (self.height() - size.height())/2)
def createVmListSidePanel(self): position = Workspace.Left vmList = VMList() vmList.startOrGotoVm.connect(self.startOrGotoVm) mapButton = ChoiceButton(u'虚拟机', QIcon('images/virtualbox.png')) container = SideContainer() container.setContentWidget(vmList) container.setStyleSheet('QTreeView {border: none}') toolbar = ToolBar('虚拟机') toolbar.setStyleSheet('ToolBar{border-bottom: 1px solid #818A9A}') application.addToolBar(toolbar.id(), position, 0) minimizeButton = ToolButton(u'最小化', QIcon('images/hide-left.png')) minimizeButton.clicked.connect( self.sideAreas[position].hidePanelClicked) refreshButton = ToolButton(u'刷新', QIcon('images/refresh.png')) toolbar.addButton(refreshButton) toolbar.addButton(minimizeButton) container.setToolBar(toolbar) self.addPanel(mapButton, container, position, ChoiceBar.ChoiceBar_Top)
def createControlSidePanel(self): position = Workspace.Right panel = ControlSidePanel() controlButton = ChoiceButton(u'控制', QIcon('images/control.png')) container = SideContainer() container.setContentWidget(panel) toolbar = ToolBar('控制') toolbar.setStyleSheet('ToolBar{border-bottom: 1px solid #818A9A}') application.addToolBar(toolbar.id(), position, 0) minimizeButton = ToolButton(u'最小化', QIcon('images/hide-right.png')) minimizeButton.clicked.connect( self.sideAreas[position].hidePanelClicked) toolbar.addButton(minimizeButton) container.setToolBar(toolbar) self.addPanel(controlButton, container, position)
def createHistorySidePanel(self): position = Workspace.Left gMap = GMap() mapButton = ChoiceButton(u'历史', QIcon('images/history.png')) container = SideContainer() container.setContentWidget(gMap) toolbar = ToolBar('历史') toolbar.setStyleSheet('ToolBar{border-bottom: 1px solid #818A9A}') application.addToolBar(toolbar.id(), position, 1) minimizeButton = ToolButton(u'最小化', QIcon('images/hide-left.png')) minimizeButton.clicked.connect( self.sideAreas[position].hidePanelClicked) toolbar.addButton(minimizeButton) container.setToolBar(toolbar) self.addPanel(mapButton, container, position)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.text = QLabel(self) self.text.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.closeButton = ToolButton(u'关闭', QIcon('images/close.png'), self) self.durationTimer = QTimer() self.durationTimer.setSingleShot(True) self.durationTimer.timeout.connect(self.hideBranding) self.effect = None self.duration = 5000 self.fps = 30 self.effectTimer = QTimer() self.effects = { Branding.Effect_Fade: (self.fadeIn, self.fadeOut), Branding.Effect_Slide_Y_Down: (self.slideInYDown, self.slideOutYUp) } self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.setFixedHeight(0) self.setStyleSheet('background: #F00')