Пример #1
0
    def initUI(self):
        style=QCommonStyle()
        top=QVBoxLayout()
        top.setSpacing(2)
            
        self.tabs = MyTabWidget(self)
        top.addWidget(self.tabs)
                            
        self.tabManager.addAllTabs(self.tabs)
        
        buttons=QHBoxLayout()
        buttons.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        
        self.cancelButton=QPushButton("Cancel", self)
        self.cancelButton.clicked.connect(self._cancel)
        self.cancelButton.setIcon(style.standardIcon(QStyle.SP_DialogCancelButton))
        buttons.addWidget(self.cancelButton)

        self.okButton=QPushButton("Ok", self)
        self.okButton.clicked.connect(self._ok)
        self.okButton.setDefault(True)
        self.okButton.setIcon(style.standardIcon(QStyle.SP_DialogOkButton))
        buttons.addWidget(self.okButton)
        
        top.addLayout(buttons)
        self.setLayout(top)
        self.setWindowTitle('Options')
        self.setGeometry(0, 0, 400, 500)
    def __init__(self, parent):
        super(ErrorMessageDialog, self).__init__(parent)
        
        self._errorPixmap = None
        self._warningPixmap = None
        self._infoPixmap = None
        try:
            from PyQt4.QtGui import QCommonStyle, QStyle
            style = QCommonStyle()
            self._errorPixmap = style.standardIcon(QStyle.SP_MessageBoxCritical).pixmap(14,14)
            if self._errorPixmap.isNull():
                self._errorPixmap = None
            self._warningPixmap = style.standardIcon(QStyle.SP_MessageBoxWarning).pixmap(14,14)
            if self._warningPixmap.isNull():
                self._warningPixmap = None
            self._infoPixmap = style.standardIcon(QStyle.SP_MessageBoxInformation).pixmap(14,14)
            if self._infoPixmap.isNull():
                self._infoPixmap = None
        except:
            pass

        if self._errorPixmap is None:
            self._errorPixmap = QIcon(get_settings().get_resource("images", "error.png")).pixmap(14,14)
        if self._warningPixmap is None:
            self._warningPixmap = QIcon(get_settings().get_resource("images", "warning.png")).pixmap(14,14)
        if self._infoPixmap is None:
            self._infoPixmap = QIcon(get_settings().get_resource("images", "warning.png")).pixmap(14,14)
            
        layout = QVBoxLayout(self)
        self._initInputUI(layout)
        self.__createBottomLayout(layout)
        self._initDone()
        
        size = self.sizeHint()
        self.setMaximumHeight(size.height())
Пример #3
0
 def _createPathPage(self):
     try:
         from PyQt4.QtGui import QCommonStyle
         style = QCommonStyle()
     except:
         style = None
     
     w = QWidget(self)
     layout = QVBoxLayout(w)
     
     inputWidget = QWidget(self)
     inputLayout = QHBoxLayout(inputWidget)
     inputLayout.setContentsMargins(0, 0, 0, 0)
     
     inputLayout.addWidget(QLabel("Path:", self))
     self._pathEdit = QLineEdit(self)
     if hasattr(self._pathEdit, "setPlaceholderText"):
         self._pathEdit.setPlaceholderText(u"Directory Path")
     inputLayout.addWidget(self._pathEdit, 1)
     
     browseButton = QPushButton(self)
     browseButton.setAutoDefault(False)
     if style != None:
         browseIcon = style.standardIcon(QStyle.SP_DirOpenIcon)
     else:
         browseIcon = None
     
     if browseIcon and not browseIcon.isNull():
         browseButton.setIcon(browseIcon)
     else:
         browseButton.setText("Browse...")
     browseButton.clicked.connect(self._browse)
     inputLayout.addWidget(browseButton, 0, Qt.AlignHCenter)
     
     layout.addWidget(inputWidget, 0)        
     return w, layout
Пример #4
0
 def __init__(self, parent, logger, ownName, otherName, ownPicFile, otherPicFile, otherID, sendAction):
     super(ChatWidget, self).__init__(parent)
     
     self.logger = logger
     self._firstShowEvent = True
     
     self._offline = False
     if sendAction is not None:
         self._blocked = sendAction.getPeerState(otherID) == PrivacySettings.STATE_BLOCKED
     else:
         self._blocked = False
     self._delivering = False
     self._lastTimeRow = 0
     self._textChanged = False
     self._keepEntryText = False
     self._markdownEnabled = False
     self._md = None
     
     self._typingTimer = QTimer(self)
     self._typingTimer.timeout.connect(self._checkTyping)
     self._typingTimer.start(1000)
     self._entryWasEmpty = True
     self._selfWasTyping = False
     self._otherWasTyping = False
     self._lastTimeSelfTyped = None
     self._lastTimePartnerTyped = None
     
     self._otherID = otherID
     
     self._otherName = otherName
     self._ownName = ownName
     
     self._sendAction = sendAction
     
     self._errIcon = None
     self._warnIcon = None
     try:
         from PyQt4.QtGui import QCommonStyle, QStyle
         style = QCommonStyle()
         self._errIcon = style.standardIcon(QStyle.SP_MessageBoxCritical)
         if self._errIcon.isNull():
             self._errIcon = None
         self._warnIcon = style.standardIcon(QStyle.SP_MessageBoxWarning)
         if self._warnIcon.isNull():
             self._warnIcon = None
     except:
         pass
     
     if self._errIcon is None:
         self._errIcon = QIcon(get_settings().get_resource("images", "error.png"))
     if self._warnIcon is None:
         self._warnIcon = QIcon(get_settings().get_resource("images", "warning.png"))
     
     self._initMessageModel()
     self._initMessageTable()
     self._initTextEntry()
     
     mainLayout = QVBoxLayout(self)
     mainLayout.setSpacing(0)
     
     self._addTopLayout(mainLayout)
     mainLayout.addWidget(self.table)
     mainLayout.addWidget(self.entry)
     
     # initialize GUI
     self._updateOtherName()
     self._updateOwnName()
     self.setOwnIconPath(ownPicFile)
     self.setOtherIconPath(otherPicFile)
             
     # TODO option to change behavior
     self.entry.returnPressed.connect(self.eventTriggered)
     
     self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)
     
     get_notification_center().connectPeerAppended(self._peerUpdated)
     get_notification_center().connectPeerUpdated(self._peerUpdated)
     get_notification_center().connectPeerRemoved(self._peerRemoved)
     get_notification_center().connectAvatarChanged(self._avatarChanged)
     get_notification_center().connectDisplayedPeerNameChanged(self._displayedPeerNameChanged)
     get_notification_center().connectPrivacySettingsChanged(self._privacySettingsChanged)
     
     if get_peers() != None:
         self._setOffline(not get_peers().isPeerID(pID=self._otherID))
     else:
         self._setOffline(True)
         
     self.setAcceptDrops(True)
Пример #5
0
 def getIcon(self):
     from PyQt4.QtGui import QCommonStyle, QStyle
     style = QCommonStyle()
     return style.standardIcon(QStyle.SP_MessageBoxWarning)
Пример #6
0
 def __init__(self, base):
     QCommonStyle.__init__(self)
     self._base = base