Exemple #1
0
    def __init__(self, parent, entity=None, dependencies=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.label.setPixmap(GuiUtils.get_icon_pixmap('warning_large.png'))

        self.entity = entity
        self.dependencies = dependencies

        self.init_gui()
Exemple #2
0
 def initDialog(self):
     # Fetch references
     logoPixMap = GuiUtils.get_icon_pixmap("un_habitat.jpg")
     self.lblLogo.setPixmap(logoPixMap)
     dirP = os.path.dirname(__file__)
     normPath = str(dirP) + '\stdm\summary.txt'
     # absPath=os.path.join(str(dir),'\stdm\summary.txt')
     aboutStream = open(os.path.normpath(normPath))
     about = aboutStream.read()
Exemple #3
0
    def __init__(self, column, parent, host):
        # Use a different pixmap
        px = GuiUtils.get_icon_pixmap('hierarchy.png')
        kwargs = {}
        kwargs['parent'] = parent
        kwargs['pixmap'] = px
        kwargs['host'] = host

        ForeignKeyLineEdit.__init__(self, column, **kwargs)
Exemple #4
0
    def setMessage(self, message, notificationType, stylesheet, font_color):
        '''
        Set display properties
        '''
        # Background color
        if notificationType == ERROR:
            # Set icon resource and frame background color
            notifPixMap = GuiUtils.get_icon_pixmap("remove.png")
        elif notificationType == SUCCESS:
            notifPixMap = GuiUtils.get_icon_pixmap("success.png")
        elif notificationType == INFORMATION:
            notifPixMap = GuiUtils.get_icon_pixmap("info_small.png")
        elif notificationType == WARNING:
            notifPixMap = GuiUtils.get_icon_pixmap("warning.png")

        self.lblNotifIcon.setPixmap(notifPixMap)
        self.lblNotifMessage.setText(message)
        self.frame.setStyleSheet(stylesheet)
        self.lblNotifMessage.setStyleSheet(font_color)
Exemple #5
0
    def _createDocNameItem(self, docName):
        """
        Create a template document standard item.
        """
        # Set icon
        icon = QIcon()
        icon.addPixmap(GuiUtils.get_icon_pixmap("document.png"), QIcon.Normal,
                       QIcon.Off)

        dnItem = QStandardItem(icon, docName)

        return dnItem
Exemple #6
0
    def _createNewUserMapping(self, username):
        '''
        Adds a new user to the list of user mappings
        '''
        # Set icon
        icon = QIcon()
        icon.addPixmap(GuiUtils.get_icon_pixmap("user.png"), QIcon.Normal, QIcon.Off)

        userItem = QStandardItem(icon, username)
        userItem.setCheckable(True)
        userItem.setCheckState(Qt.Unchecked)

        return userItem
Exemple #7
0
    def __init__(self, *args, **kwargs):
        # Use a different pixmap
        px = GuiUtils.get_icon_pixmap('code.png')
        kwargs['pixmap'] = px

        self._code = None
        self._current_profile = current_profile()
        self._admin_hierarchy_code = None

        ForeignKeyLineEdit.__init__(self, *args, **kwargs)
        self.code_generator = CodeGenerator(self.entity, self.column)
        self.code_columns = code_columns(self.entity, self.column.name)
        self.setText('')
Exemple #8
0
    def _createNewRoleItem(self, rolename):
        '''
        Creates a custom role item for use in a QStandardItemModel
        '''
        # Set icon
        icon = QIcon()
        icon.addPixmap(GuiUtils.get_icon_pixmap("roles.png"), QIcon.Normal,
                       QIcon.Off)

        roleItem = QStandardItem(icon, rolename)
        roleItem.setCheckable(True)
        roleItem.setCheckState(Qt.Unchecked)

        return roleItem
Exemple #9
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)

        self.lblClose.setPixmap(GuiUtils.get_icon_pixmap('close_msg.png'))

        # Unique identifier for the message
        self.code = str(uuid4())

        # Set event filter for closing the message
        self.lblClose.installEventFilter(self)

        # Set labels to maximum transparency so that they do not inherit the background color of the frame
        clearBGStyle = "background-color: rgba(255, 255, 255, 0);"
        self.lblNotifIcon.setStyleSheet(clearBGStyle)
        self.lblNotifMessage.setStyleSheet("color: rgb(255, 255, 255);" + clearBGStyle)
Exemple #10
0
    def __init__(self, column, host=None, parent=None):
        # Use a different pixmap

        self._current_profile = current_profile()

        QLineEdit.__init__(self, parent)

        self.column = column
        self._entity = self.column.entity

        self.layer = self.create_layer()
        self.host = host
        # Configure load button
        self.btn_load = QToolButton(parent)
        self.btn_load.setCursor(Qt.PointingHandCursor)
        self.btn_load.setFocusPolicy(Qt.NoFocus)
        px = GuiUtils.get_icon_pixmap('expression.png')

        self.btn_load.setIcon(QIcon(px))
        self.btn_load.setIconSize(px.size())
        self.btn_load.setStyleSheet('background: transparent; padding: 0px; '
                                    'border: none;')

        frame_width = self.set_button_minimum_size(self.btn_load)

        # Ensure that text does not overlay button
        padding = self.btn_load.sizeHint().width() + frame_width + 1

        self.setStyleSheet('padding-right: ' + str(padding * 2) + 'px;')

        # Set layout
        self.button_layout = QHBoxLayout(self)

        self.button_layout.addWidget(self.btn_load, 0, Qt.AlignRight)

        self.button_layout.setSpacing(0)
        self.button_layout.setMargin(5)

        # Readonly as text generated automatically
        self.setReadOnly(True)

        # Current model object
        self._current_item = None
Exemple #11
0
    def __init__(
            self,
            document_model=None,
            fileManager=None,
            mode=UPLOAD_MODE,
            parent=None,
            canRemove=True,
            view_manager=None
    ):
        QWidget.__init__(self, parent)
        self.setupUi(self)

        self.lblClose.setPixmap(GuiUtils.get_icon_pixmap('close.png'))

        self.initGui()
        self.fileInfo = None
        self.fileUUID = None
        self.document_model = document_model
        self.fileManager = fileManager
        self._mode = mode
        self._displayName = ""
        self._docSize = 0
        self._srcDoc = None
        self._fileName = ""
        self._canRemove = canRemove
        self._view_manager = view_manager

        self.curr_profile = current_profile()
        self.removed_doc = []
        self.lblClose.installEventFilter(self)
        self.lblName.installEventFilter(self)
        self._source_entity = ""
        self._doc_type = ""
        self._doc_type_id = None
        # Set defaults
        self.fileNameColor = "#5555ff"
        self.fileMetaColor = "#8f8f8f"
Exemple #12
0
 def _set_tip_icon(self):
     # Set the information icon
     self._px = GuiUtils.get_icon_pixmap('user_tip.png')
     self.setPixmap(self._px)
Exemple #13
0
    def __init__(self, column, parent=None, pixmap=None, host=None):
        """
        Class constructor.
        :param column: Column object containing foreign key information.
        :type column: BaseColumn
        :param parent: Parent widget for the control.
        :type parent: QWidget
        :param pixmap: Pixmap to use for the line edit button.
        :type pixmap: QPixmap
        """

        QLineEdit.__init__(self, parent)

        self.column = column
        self._entity = self.column.entity
        self.entity_dialog = host

        # Configure load button
        self.btn_load = QToolButton(parent)
        self.btn_load.setCursor(Qt.PointingHandCursor)
        self.btn_load.setFocusPolicy(Qt.NoFocus)
        px = GuiUtils.get_icon_pixmap('select_record.png')
        if not pixmap is None:
            px = pixmap
        self.btn_load.setIcon(QIcon(px))
        self.btn_load.setIconSize(px.size())
        self.btn_load.setStyleSheet('background: transparent; padding: 0px; '
                                    'border: none;')
        self.btn_load.clicked.connect(self.on_load_foreign_key_browser)

        clear_px = GuiUtils.get_icon_pixmap('clear.png')

        self.btn_clear = QToolButton(parent)
        self.btn_clear.setCursor(Qt.PointingHandCursor)
        self.btn_clear.setFocusPolicy(Qt.NoFocus)
        self.btn_clear.setIcon(QIcon(clear_px))
        self.btn_clear.setIconSize(clear_px.size())
        self.btn_clear.setStyleSheet('background: transparent; padding: 0px; '
                                     'border: none;')

        self.btn_clear.clicked.connect(self.clear_line_edit)

        frame_width = self.set_button_minimum_size(self.btn_load)
        self.set_button_minimum_size(self.btn_clear)
        # Ensure that text does not overlay button
        padding = self.btn_load.sizeHint().width() + frame_width + 1

        self.setStyleSheet('padding-right: ' + str(padding * 2) + 'px;')

        # Set layout
        self.button_layout = QHBoxLayout(self)

        self.button_layout.addWidget(self.btn_clear, 0, Qt.AlignRight)
        self.button_layout.addWidget(self.btn_load, 0, Qt.AlignRight)

        self.button_layout.setSpacing(0)
        self.button_layout.setMargin(5)

        self.btn_clear.setVisible(False)
        # Readonly as text is loaded from the related entity
        self.setReadOnly(True)

        # Current model object
        self._current_item = None