Example #1
0
    def __init__(self):
        super(MainAddressView, self).__init__()
        layout = QVBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(0)
        self.addressTB = QLabel()
        self.addressTB.setProperty('class', 'address QLabel')
        # self.addressTB.setMaximumHeight(40)
        # self.addressTB.setMaximumWidth(160)
        # self.address = '1Zho uQKM ethP\nQLYa QYcS sqqM\nNCgb NTYV m'
        self.address = '-' * 34
        self.addressTB.setMargin(10)
        self.addressTB.setTextInteractionFlags(Qt.TextSelectableByMouse)
        self.addressTB.setText(address_show_format(self.address))
        layout.addWidget(self.addressTB)

        btn_layout = QHBoxLayout()
        btn_layout.setMargin(0)
        btn_layout.setSpacing(0)
        self.qr_btn = QPushButton()
        self.qr_btn.setText(u"二维码")
        btn_layout.addWidget(self.qr_btn)

        self.clipboard_btn = QPushButton()
        self.clipboard_btn.setText(u"复制")
        btn_layout.addWidget(self.clipboard_btn)

        layout.addLayout(btn_layout)

        self.setLayout(layout)

        self.qr_btn.clicked.connect(self.show_qr)
        self.clipboard_btn.clicked.connect(self.copy_clipboard)
Example #2
0
    def __init__(self, possible_items):
        QWidget.__init__(self)

        self._editing = True
        self._possible_items = possible_items

        self._list_edit_line = AutoCompleteLineEdit(possible_items, self)
        self._list_edit_line.setMinimumWidth(350)

        layout = QHBoxLayout()
        layout.setMargin(0)

        layout.addWidget(self._list_edit_line)

        dialog_button = QToolButton(self)
        dialog_button.setIcon(resourceIcon("ide/small/add"))
        dialog_button.setIconSize(QSize(16, 16))
        dialog_button.clicked.connect(self.addChoice)

        layout.addWidget(dialog_button)

        self.setLayout(layout)

        self._validation_support = ValidationSupport(self)
        self._valid_color = self._list_edit_line.palette().color(
            self._list_edit_line.backgroundRole())

        self._list_edit_line.setText("")
        self._editing = False

        self._list_edit_line.editingFinished.connect(self.validateList)
        self._list_edit_line.textChanged.connect(self.validateList)

        self.validateList()
Example #3
0
    def __init__(self,
                 caption,
                 default_value=None,
                 caption_size=None,
                 text_size=None):
        QWidget.__init__(self)

        self.description = QLabel(caption)
        self.description.setWordWrap(True)
        if caption_size:
            self.description.setMaximumWidth(caption_size)

        self.line_edit = QLineEdit()
        if default_value:
            self.line_edit.setText(default_value)
        if text_size:
            self.line_edit.setMaximumWidth(text_size)

        hbox = QHBoxLayout()
        hbox.addWidget(self.description)
        hbox.addSpacing(10)
        hbox.addWidget(self.line_edit)
        if text_size:
            hbox.addStretch(1)
        hbox.setMargin(0)
        self.setLayout(hbox)
        self.setContentsMargins(0, 0, 0, 0)
Example #4
0
class WidgetsBar(QGroupBox):
    def __init__(self,parent):
        QFrame.__init__(self,parent)
        self.parent = parent
        self.setFixedHeight(50)
        self.layout = QHBoxLayout(self)
        self.layout.setMargin(0)
        self.setTitle("Widgets")
        
        for text, slot in (
                ("Text", self.parent.addText),
                ("Button", self.parent.addBox),
                ("Sprite", self.parent.addPixmap),
                ("SpriteSheet", self.parent.addPixmap),
                ("&Align", None)):
            button = QPushButton(text,self)
            if eol != 2:
                button.setFocusPolicy(Qt.NoFocus)
            if slot is not None:
                button.clicked.connect(slot)
            '''
            if text == "&Align":
                menu = QMenu(self)
                for text, arg in (
                        ("Align &Left", Qt.AlignLeft),
                        ("Align &Right", Qt.AlignRight),
                        ("Align &Top", Qt.AlignTop),
                        ("Align &Bottom", Qt.AlignBottom)):
                    wrapper = functools.partial(self.setAlignment, arg)
                    self.wrapped.append(wrapper)
                    menu.addAction(text, wrapper)
                button.setMenu(menu)
            '''
            self.layout.addWidget(button)
Example #5
0
    def __init__(self, foldable_data, parent=None):
        QWidget.__init__(self, parent)

        self.foldable = False

        #Contained widgets
        self.fold_button = FoldButton()
        self.noop_button = NoopButton()
        self.name = QLabel()
        self.abstract = foldable_data.abstract
        self.edit_button = EditButton()

        #Layout
        box = QHBoxLayout(self)
        box.setMargin(0)
        box.setAlignment(Qt.AlignLeft)
        box.addWidget(self.fold_button)
        box.addWidget(self.noop_button)
        box.addWidget(self.name)
        box.addWidget(self.abstract)
        box.addStretch()
        box.addWidget(self.edit_button)
        self.setFoldable(True)

        #SIGNALS to update content
        self.connect(foldable_data, SIGNAL('name changed'), self.setName)
        self.connect(foldable_data, SIGNAL('menu changed'), self.setMenu)

        #Initialize content
        self.setName(foldable_data.name)
        self.setMenu(foldable_data.menu)
Example #6
0
class LevelBar(QGroupBox):
    def __init__(self,parent):
        QGroupBox.__init__(self,parent)
        self.parent = parent
        self.setMaximumHeight(100)
        self.setMaximumWidth(300)
        self.layout = QHBoxLayout(self)
        self.layout.setMargin(10)
        self.setTitle("Map")
        
        lab1 = QLabel("Size: ")
        lab2 = QLabel("Orientation: ")
        btn1 = QComboBox()
        btn1.addItem("320x240")
        btn1.addItem("480x320")
        btn1.addItem("640x480")
        btn1.addItem("720x480")
        btn1.addItem("800x480")
        btn1.addItem("852x480")
        btn1.addItem("960x540")
        btn2 = QComboBox()
        btn2.addItem("Portrait")
        btn2.addItem("Landscape")
        
        self.layout.addWidget(lab1)
        self.layout.addWidget(btn1)
        self.layout.addWidget(lab2)
        self.layout.addWidget(btn2)
Example #7
0
    def __init__(self, possible_items):
        QWidget.__init__(self)

        self._editing = True
        self._possible_items = possible_items

        self._list_edit_line = AutoCompleteLineEdit(possible_items, self)
        self._list_edit_line.setMinimumWidth(350)

        layout = QHBoxLayout()
        layout.setMargin(0)

        layout.addWidget(self._list_edit_line)

        dialog_button = QToolButton(self)
        dialog_button.setIcon(resourceIcon("ide/small/add"))
        dialog_button.setIconSize(QSize(16, 16))
        dialog_button.clicked.connect(self.addChoice)

        layout.addWidget(dialog_button)

        self.setLayout(layout)

        self._validation_support = ValidationSupport(self)
        self._valid_color = self._list_edit_line.palette().color(self._list_edit_line.backgroundRole())

        self._list_edit_line.setText("")
        self._editing = False

        self._list_edit_line.editingFinished.connect(self.validateList)
        self._list_edit_line.textChanged.connect(self.validateList)

        self.validateList()
Example #8
0
class ProgressDialog(QDialog):
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.resize(300, 75)
        self.setWindowTitle("Updating")
        self.vw = QWidget(self)
        self.vl = QVBoxLayout(self.vw)
        self.vl.setMargin(10)
        self.label = QLabel(self.vw)
        self.label.setText("<b>Downloading:</b> library.zip")
        self.vl.addWidget(self.label)
        self.horizontalLayoutWidget = QWidget()
        self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget)
        self.horizontalLayout.setMargin(0)
        self.progressbar = QProgressBar(self.horizontalLayoutWidget)
        self.progressbar.setFixedWidth(260)
        self.progressbar.setMinimum(0)
        self.progressbar.setMaximum(100)
        self.stopButton = QPushButton(self.horizontalLayoutWidget)
        self.stopButton.setFlat(True)
        self.stopButton.setIcon(Icons.stop)
        self.stopButton.setFixedSize(16,16)
        self.horizontalLayout.addWidget(self.progressbar)
        self.horizontalLayout.addWidget(self.stopButton)
        self.vl.addWidget(self.horizontalLayoutWidget)
        self.stopButton.clicked.connect(self.forceStop)
        
    def setValue(self,val):
        self.progressbar.setValue(val)
    def forceStop(self):
        self.emit(SIGNAL("forceStop"))
Example #9
0
    def __init__(self, caption, values, default_value, caption_size=None, expand_combo=False):
        QWidget.__init__(self)

        self.values = values

        description = QLabel(caption)
        description.setWordWrap(True)
        if caption_size:
            description.setMaximumWidth(caption_size)

        self.combo = QComboBox()
        for item in values:
            self.combo.addItem(item, item)

        for i in range(0, len(values)):
            if values[i] == default_value:
                self.combo.setCurrentIndex(i)
                break

        hbox = QHBoxLayout()
        hbox.addWidget(description)
        hbox.addSpacing(10)
        if expand_combo:
            hbox.addWidget(self.combo, 1)
        else:
            hbox.addWidget(self.combo)
        hbox.setMargin(0)
        self.setLayout(hbox)
        self.setContentsMargins(0, 0, 0, 0)
Example #10
0
    def __init__(self,
                 caption,
                 values,
                 default_value,
                 caption_size=None,
                 expand_combo=False):
        QWidget.__init__(self)

        self.values = values

        description = QLabel(caption)
        description.setWordWrap(True)
        if caption_size:
            description.setMaximumWidth(caption_size)

        self.combo = QComboBox()
        for item in values:
            self.combo.addItem(item, item)

        for i in range(0, len(values)):
            if values[i] == default_value:
                self.combo.setCurrentIndex(i)
                break

        hbox = QHBoxLayout()
        hbox.addWidget(description)
        hbox.addSpacing(10)
        if expand_combo:
            hbox.addWidget(self.combo, 1)
        else:
            hbox.addWidget(self.combo)
        hbox.setMargin(0)
        self.setLayout(hbox)
        self.setContentsMargins(0, 0, 0, 0)
Example #11
0
    def __init__(self, parent=None):
        super(PlatChooser, self).__init__(parent)
        self.resize(1024, 700)

        self.nm = QNetworkAccessManager()

        self.scriptdir = os.path.dirname(os.path.realpath(__file__))
        self.conn = sqlite3.connect(self.scriptdir + '/../blm.sqlite')
        self.codetable = load_codes(self.conn)
        self.actiontable = load_doc_actions(self.conn)

        top_layout = QHBoxLayout()
        top_layout.setMargin(0)
        self.setLayout(top_layout)

        self.scroller = QScrollArea()
        self.scroller.setFrameStyle(QFrame.NoFrame);
        top_layout.addWidget(self.scroller)
        self.scroller.setWidgetResizable(True)

        scroll_widget = QWidget()
        self.layout = QVBoxLayout()
        scroll_widget.setLayout(self.layout)
        self.scroller.setWidget(scroll_widget)

        self.ignored = set()
        for i in open(self.scriptdir + '/ignored.txt').readlines():
            self.ignored.add(i.strip())

        self.toreview = set()
        for i in open(self.scriptdir + '/to-review.txt').readlines():
            self.toreview.add(i.strip())
    def __init__(self, parent=None, so_pasta=False, filtro=None):
        '''
        Contrutor da classe personalizada
        @param parent: Classe Principal
        @param so_pasta: True - Se sera exibido somente pastas | False - se for exibidos arquivos e pastas
        @param filtro: Filtro usado quando o @so_pasta for verdadeiro\nEx: "All(*);;Imagem (*.jpeg);;Audio (*.wav)"
        '''
        QLineEdit.__init__(self, parent)

        self.so_pasta = so_pasta
        self.filtro = filtro

        self.btLocate = QToolButton(self)
        self.btLocate.setCursor(Qt.PointingHandCursor)
        self.btLocate.setFocusPolicy(Qt.NoFocus)
        if self.so_pasta:
            self.btLocate.setIcon(QIcon("imagens/icones/folder.ico"))
        else:
            self.btLocate.setIcon(QIcon("imagens/icones/view.ico"))
        self.btLocate.setStyleSheet("background: transparent; border: none;")

        layout = QHBoxLayout(self)
        layout.addWidget(self.btLocate, 0, Qt.AlignRight)

        layout.setSpacing(0)
        layout.setMargin(5)

        self.btLocate.setToolTip(QApplication.translate("None", "Localizar", None, QApplication.UnicodeUTF8))
        self.btLocate.clicked.connect(self.abrir_arquivo)
Example #13
0
class StatusWidget(QWidget):
    def __init__(self, parent=None):
        super(QWidget, self).__init__(parent)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        self.setSizePolicy(sizePolicy)
        self.__hlayout = QHBoxLayout(self)
        self.__hlayout.setSpacing(6)
        self.__hlayout.setSizeConstraint(QLayout.SetMinimumSize)
        self.__hlayout.setMargin(0)
        self.__hlayout.setAlignment(Qt.AlignLeft)
        self.__labels = []
        self.__model = None

    def setStatusModel(self, model):
        self.__model = model
        for idx in xrange(0, model.count()):
            label = StatusLabel(self, model.status(idx))
            self.__hlayout.addWidget(label)
            if idx < model.count() - 1:
                line = QFrame(self)
                line.setFrameShape(QFrame.VLine)
                line.setFrameShadow(QFrame.Sunken)
                self.__hlayout.addWidget(line)
            self.__labels.append(label)
Example #14
0
    def __init__(self, sessionBackend, parent):
        super(WebODFWidget, self).__init__(parent)
        self.bridge = None

        self.webODFEditorCreated = False
        self.sessionJoinRequested = False
        self.sessionBackend = sessionBackend
        self.genesisDocumentPath = None

        layout = QHBoxLayout(self)
        layout.setMargin(0)
        self.webView = QWebView(self)
        # prevent drops of urls resulting in loading that url
        # needs to be revisited once WebODF editor also supports text (or image) insertion by D'n'D
        self.webView.setAcceptDrops(False)
        # TODO: reenable for RELEASE
        #self.webView.setContextMenuPolicy(Qt.NoContextMenu)
        layout.addWidget(self.webView)

        self.bridge = JSBridge()
        self.bridge.documentDataChanged.connect(self._SH_endSaveDocument)
        # TODO: find if signal forwarding is supported by PyQt
        self.bridge.sessionJoined.connect(self._SH_sessionJoined)
        self.bridge.sessionLeft.connect(self._SH_sessionLeft)

        self.page = self.webView.page()
        self.networkmanager = WebODFNetworkManager(self.sessionBackend, self)
        self.page.setNetworkAccessManager(self.networkmanager)
        self.page.settings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)

        self.page.mainFrame().javaScriptWindowObjectCleared.connect(self._SH_setJSBridge)
        self.page.loadFinished.connect(self._SH_onLoadFinished)

        self.webView.load(QUrl("http://webodf/editor.html"))
Example #15
0
    def __init__(self, func):
        QFrame.__init__(self)
        self.func = func

        layout = QHBoxLayout()
        layout.setMargin(0)

        self.check = QCheckBox()

        self.spinner = QtGui.QDoubleSpinBox()
        self.spinner.setSingleStep(1)
        self.spinner.setDisabled(True)
        self.spinner.setMinimum(-10000000000)
        self.spinner.setMaximum(10000000000)
        self.spinner.setMaximumWidth(100)
        self.connect(self.spinner, QtCore.SIGNAL('valueChanged(double)'), self.update)

        self.date_spinner = QtGui.QDateEdit()
        self.date_spinner.setDisabled(True)
        self.date_spinner.setDisplayFormat("dd/MM-yyyy")
        self.date_spinner.setMaximumWidth(100)
        self.date_spinner.setCalendarPopup(True)
        self.connect(self.date_spinner, QtCore.SIGNAL('dateChanged(QDate)'), self.update)

        self.connect(self.check, SIGNAL('stateChanged(int)'), self.disabler)

        layout.addWidget(self.check)
        layout.addWidget(self.spinner)
        layout.addWidget(self.date_spinner)


        self.setLayout(layout)

        self.showDate(False)
Example #16
0
    def __init__(self, type_key, title, time_spinner, min_value, minimum=-999999999999, maximum=999999999999):
        QWidget.__init__(self)
        self.__time_spinner = time_spinner
        if time_spinner:
            self.__time_map = ReportStepsModel().getList()
            self.__time_index_map = {}
            for index in range(len(self.__time_map)):
                time = self.__time_map[index]
                self.__time_index_map[time] = index

        self.__type_key = type_key
        self.__spinner = None

        layout = QHBoxLayout()
        layout.setMargin(0)
        self.setLayout(layout)

        self.__checkbox = QCheckBox(title)
        self.__checkbox.setChecked(False)
        layout.addWidget(self.__checkbox)

        layout.addStretch()

        if time_spinner:
            self.__spinner = self.createTimeSpinner(min_value)
        else:
            self.__spinner = self.createDoubleSpinner(minimum, maximum)

        layout.addWidget(self.__spinner)

        self.__checkbox.stateChanged.connect(self.toggleCheckbox)
        self.setLayout(layout)
Example #17
0
    def __init__(self):
        QWidget.__init__(self)
        self._line_edit = ClearableLineEdit()

        self._calendar_button = QToolButton()
        self._calendar_button.setPopupMode(QToolButton.InstantPopup)
        self._calendar_button.setFixedSize(26, 26)
        self._calendar_button.setAutoRaise(True)
        self._calendar_button.setIcon(resourceIcon("calendar.png"))
        self._calendar_button.setStyleSheet("QToolButton::menu-indicator { image: none; }")

        tool_menu = QMenu(self._calendar_button)
        self._calendar_widget = QCalendarWidget(tool_menu)
        action = QWidgetAction(tool_menu)
        action.setDefaultWidget(self._calendar_widget)
        tool_menu.addAction(action)
        self._calendar_button.setMenu(tool_menu)

        layout = QHBoxLayout()
        layout.setMargin(0)
        layout.addWidget(self._line_edit)
        layout.addWidget(self._calendar_button)
        self.setLayout(layout)

        self._calendar_widget.activated.connect(self.setDate)
Example #18
0
    def __init__(self, parent):
        QFrame.__init__(self,parent)

        self.filename = QString()
        self.copiedItem = QByteArray()
        self.pasteOffset = 5
        self.prevPoint = QPoint()
        self.addOffset = 5
        
        self.screenSize = (320, 240)
        self.bgColor = QColor(244,244,244)
        '''0.Portrait 1.Landscape'''
        self.orientation = 0
        self.currentItem = None
        

        self.printer = QPrinter(QPrinter.HighResolution)
        self.printer.setPageSize(QPrinter.Letter)


        '''Header'''
        self.headingBar = HeadingBar(self)
        '''WidgetsBar'''
        self.widgetsBar = WidgetsBar(self)
        '''Property'''
        self.propertyBar = PropertyBar(self)
        
        '''view'''
        viewLayoutWidget = QFrame()
        viewLayoutWidget.setFrameShape(QFrame.StyledPanel)
        viewLayout = QHBoxLayout(viewLayoutWidget)
        #viewLayout.setMargin(10)
        self.view = ScreenView(viewLayoutWidget)
        '''scene'''
        self.scene = QGraphicsScene(self)
        
        #self.scene.selectionChanged.connect(self.setConnect)
        #self.view.setStyleSheet("border: 1px solid red;")
        
        self.setBackgroundColor(self.bgColor)
        self.setScreenSize(self.screenSize)
        
        self.view.setScene(self.scene)
        self.view.setAlignment(Qt.AlignCenter)
        self.connect(self.view, SIGNAL("dropped"),self.addPixmapFile)
        self.scroll_off = 1
        self.setScrollBar()
        
        viewLayout.setMargin(0)
        viewLayout.addWidget(self.view)

        self.wrapped = [] # Needed to keep wrappers alive
        layout = QVBoxLayout(self)
        layout.addWidget(self.headingBar)
        layout.addWidget(viewLayoutWidget)
        layout.addWidget(self.widgetsBar)
        layout.addWidget(self.propertyBar)
        layout.setMargin(0)
        self.setLayout(layout)
Example #19
0
    def _configurarGui(self):
        layout = QHBoxLayout(self)
        layout.setMargin(0)

        self._lista = BarraLista(self._servico)
        layout.addWidget(self._lista)
        
        self.setLayout(layout)
Example #20
0
    def _configurarGui(self):
        layout = QHBoxLayout()
        layout.setMargin(0)
        layout.setAlignment(Qt.AlignCenter)

        self._lblIP = QLabel()
        layout.addWidget(self._lblIP)
        self.setLayout(layout)
Example #21
0
class FilenameWidget(QWidget, NodeWidget):
    data_type = "Filename"
    simple_widget = True
    data_class = StringNode
    def __init__(self, name, data, scheme, parent=None):
        QWidget.__init__(self, parent)
        NodeWidget.__init__(self, name, data, scheme)
        if "FilenameMask" in self.scheme:
            self.filename_mask =  self.scheme["FilenameMask"].get()
        else:
            self.filename_mask = "*"
        if "WithoutPath" in self.scheme:
            self.without_path =  self.scheme["WithoutPath"].get()
        else:
            self.without_path = False

        if self.without_path and "BasePath" in self.scheme:
            self.base_path = self.scheme["BasePath"].get()
        else:
            self.base_path = None


        self.layout = QHBoxLayout(self)
        self.layout.setMargin(0)
        self.layout.setContentsMargins(0,0,0,0)
        self._browse_button = SmallSquareButton("...",self)
        self._browse_button.clicked.connect(self.browse)
        self._text = QLineEdit(self)
        self.layout.addWidget(self._text)
        self.layout.addWidget(self._browse_button)
        self.file_name = unicode(self.data.get())

    def get_actual_filename(self):
        if self.without_path and self.base_path and self.file_name:
            return os.path.abspath(os.path.join(
                os.path.expanduser(self.base_path), self.file_name))
        else:
            return self.file_name


    def load(self):
        self._text.setText(unicode(self.data.get()))
        self._text.textChanged.connect(self.dump)


    def dump(self):
        self.data.set(unicode(self._text.text()),not_notify=self.load)

    def browse(self):
        self.file_name = file_name = unicode(QFileDialog.getOpenFileName(self, "Select file", filter=self.filename_mask))
        if file_name:
            if self.without_path:
                file_name = os.path.basename(file_name)
            self._text.setText(file_name)

    @classmethod
    def _get_default_data(cls, scheme, data):
        return StringNode("")
Example #22
0
    def __init__(self, model, label="", help_link="", custom_filter_button=None):
        """
        :param custom_filter_button:  if needed, add a button that opens a custom filter menu. Useful when search alone
        isn't enough to filter the list.
        :type custom_filter_button: QToolButton
        """
        QWidget.__init__(self)

        self._model = model

        if help_link != "":
            addHelpToWidget(self, help_link)

        layout = QVBoxLayout()

        self._createCheckButtons()

        self._list = QListWidget()
        self._list.setContextMenuPolicy(Qt.CustomContextMenu)
        self._list.setSelectionMode(QAbstractItemView.ExtendedSelection)

        self._search_box = SearchBox()

        check_button_layout = QHBoxLayout()

        check_button_layout.setMargin(0)
        check_button_layout.setSpacing(0)
        check_button_layout.addWidget(QLabel(label))
        check_button_layout.addStretch(1)
        check_button_layout.addWidget(self._checkAllButton)
        check_button_layout.addWidget(self._uncheckAllButton)

        layout.addLayout(check_button_layout)
        layout.addWidget(self._list)

        """
        Inserts the custom filter button, if provided. The caller is responsible for all related actions.
        """
        if custom_filter_button is not None:
            search_bar_layout = QHBoxLayout()
            search_bar_layout.addWidget(self._search_box)
            search_bar_layout.addWidget(custom_filter_button)
            layout.addLayout(search_bar_layout)
        else:
            layout.addWidget(self._search_box)

        self.setLayout(layout)

        self._checkAllButton.clicked.connect(self.checkAll)
        self._uncheckAllButton.clicked.connect(self.uncheckAll)
        self._list.itemChanged.connect(self.itemChanged)
        self._search_box.filterChanged.connect(self.filterList)
        self._list.customContextMenuRequested.connect(self.showContextMenu)

        self._model.selectionChanged.connect(self.modelChanged)
        self._model.modelChanged.connect(self.modelChanged)

        self.modelChanged()
Example #23
0
class Appointment(QWidget):
    
    def __init__(self, parent = None):
        
        super(Appointment, self).__init__(parent)
        
        #std. settings
        self.stdFont = QFont("Arial", 16)
        self.bigFont = QFont("Arial", 48)
        
        #layouts
        self.mainLayout = QHBoxLayout()
        self.leftLayout = QVBoxLayout()
        self.rightLayout = QVBoxLayout()

        #components
        self.participantLabel = QLabel("Participant Name")
        self.participantLabel.setFont(self.stdFont)
        self.eventTitle = QLabel("Event Title")
        self.eventTitle.setFont(self.bigFont)
        self.eventStart = QLabel("Event Start")
        self.eventStart.setFont(self.stdFont)
        self.eventEnd = QLabel("Event End")
        self.eventEnd.setFont(self.stdFont)
        
        self.leftLayout.addWidget(self.eventStart)
        self.leftLayout.addStretch()
        self.leftLayout.addWidget(self.eventEnd)
        
        self.rightLayout.addStretch()
        self.rightLayout.addWidget(self.participantLabel)
        self.rightLayout.addWidget(self.eventTitle)
        self.rightLayout.addStretch()
        
        self.mainLayout.addLayout(self.leftLayout)
        self.mainLayout.addSpacerItem(QSpacerItem(1,128))
        self.mainLayout.addLayout(self.rightLayout)
        
        
        self.setLayout(self.mainLayout)
        self.mainLayout.setMargin(0)
        self.mainLayout.setSpacing(0)
        
        self.setStyleSheet("background-color: #ccc; color: #fff")
        self.setFixedHeight(128)
        
    def setTitle(self, title):
        self.eventTitle.setText(title)
        
    def setStartTime(self,start):
        self.eventStart.setText(start)
    
    def setEndTime(self, end):
        self.eventEnd.setText(end)
        
    def setParticipants(self,participants):
        self.participantLabel.setText(participants)
Example #24
0
class SubWindowH(SubWindowBase):
    """SubWindow with mainLayout = QVBoxLayout"""
    
    def __init__(self, parent):
        SubWindowBase.__init__(self, parent)
        self.mainLayout = QHBoxLayout()
        self.layout().addLayout(self.mainLayout)
        self.mainLayout.setMargin(0)
        self.mainLayout.setSpacing(4)
Example #25
0
 def __init__(self, parent, color2):
     QFrame.__init__(self, parent)
     layout = QHBoxLayout(self)
     layout.setMargin(0)
     layout.setSpacing(0)
     color1 = QColor(color2).lighter(150).name()
     layout.addWidget(PointyLabel(self, color1, color2))
     self.setStyleSheet("QLabel { background-color : QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %s, stop: 1 %s) }" % (color1, color2))
     self.setSizePolicy(QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred))
Example #26
0
 def setup_ui(self):
     self.searchTable = SearchTable()
     self.searchBox = SearchBox()      
     
     self.previousPageButton = QToolButton()
     self.previousPageButton.setFixedSize(40, 31)
     icon0  =  QIcon(":/iconSources/icons/previousPage.png")
     self.previousPageButton.setIcon(icon0)
     self.previousPageButton.setIconSize(QSize(25, 25))
     self.previousPageButton.setCursor(QCursor(Qt.PointingHandCursor))
     self.previousPageButton.setToolTip('上一页')
     
     self.nextPageButton = QToolButton()
     self.nextPageButton.setFixedSize(40, 31)
     icon1  =  QIcon(":/iconSources/icons/nextPage.png")
     self.nextPageButton.setIcon(icon1)
     self.nextPageButton.setIconSize(QSize(25, 25))
     self.nextPageButton.setCursor(QCursor(Qt.PointingHandCursor))
     self.nextPageButton.setToolTip('下一页')
     
     self.jumpNum = QLineEdit('0')
     self.jumpNum.setFixedWidth(39)
     self.jumpNum.setAlignment(Qt.AlignRight)
     
     self.pageNum = QLabel("/ 0")
     self.pageNum.setFixedHeight(35)
     self.pageNum.setFixedWidth(35)
     self.pageNum.setAlignment(Qt.AlignCenter )
     self.pageNum.setToolTip('当前页码/总页数')
     
     self.controlWidget = QWidget()
     controlLayout = QHBoxLayout(self.controlWidget)
     controlLayout.setMargin(0)
     controlLayout.setSpacing(4)
     spacerItem  =  QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     controlLayout.addItem(spacerItem)
     controlLayout.addWidget(self.previousPageButton)
     controlLayout.addWidget(self.jumpNum)
     controlLayout.addWidget(self.pageNum)
     controlLayout.addWidget(self.nextPageButton)
     controlLayout.addItem(spacerItem)
     
     self.controlSearch = QWidget()       
     controlSearchLayout = QVBoxLayout(self.controlSearch)
     controlSearchLayout.setMargin(0)
     controlSearchLayout.setSpacing(2)
     controlSearchLayout.addWidget(self.searchTable)
     controlSearchLayout.addWidget(self.controlWidget)
     
     mainLayout = QVBoxLayout(self)
     mainLayout.setMargin(2)
     mainLayout.setSpacing(2)
     mainLayout.addWidget(self.searchBox)
     mainLayout.addWidget(self.controlSearch)
             
     self.searchByType = 'all'
     self.searchBox.searchComboBox.setCurrentIndex(0)
Example #27
0
    def __init__(self):
        super(QWidget, self).__init__()

        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setWindowOpacity(1.0)
        self.setWindowTitle('Warren')
        self.imagePath = determine_path()
        self.setWindowIcon(QIcon(self.imagePath + 'warren.ico'))
        layout = QHBoxLayout()
        layout.setMargin(0)
        self.dropZone = DropZone.DropZone()
        self.dropZone.setMargin(0)
        self.dropZone.setPixmap(QPixmap(self.imagePath + 'dropzone_nocon.png'))
        # use a little frame until we have nice icons
        #        self.dropZone.setFrameStyle(QFrame.Sunken | QFrame.StyledPanel)
        self.dropZone.dropped.connect(self.dropEvent)
        self.dropZone.entered.connect(self.enterEvent)

        layout.addWidget(self.dropZone)
        self.setLayout(layout)
        self.setMouseTracking(True)
        self.moving = False

        self.clipboard = Clipboard.Clipboard(self)
        self.clipboard.clipboardKey.connect(self.clipboardNewKey)
        self.clipboardKeys = list()
        self.clipboardKey = None

        self.nodeManagerConnected = False
        self.dropData = {'accepted': False, 'url': None, 'content-type': None}

        self.config = Config.Config()
        self.settings = Settings.Settings(self.config)
        self.pastebin = Pastebin.Pastebin(self)
        self.nodeManager = NodeManager.NodeManager(self.config)
        self.setKeepOnTop(self.config['warren'].as_bool('start_on_top'))
        self.connect(self.nodeManager, SIGNAL("nodeConnected()"),
                     self.nodeConnected)
        self.connect(self.nodeManager, SIGNAL("nodeConnected()"),
                     self.pastebin.nodeConnected)
        self.connect(self.nodeManager, SIGNAL("nodeConnectionLost()"),
                     self.nodeNotConnected)
        self.connect(self.nodeManager, SIGNAL("nodeConnectionLost()"),
                     self.pastebin.nodeNotConnected)
        self.connect(self.nodeManager, SIGNAL("pasteCanceledMessage()"),
                     self.pastebin.reject)
        self.connect(self.pastebin,
                     SIGNAL("newPaste(QString, QString, QString)"),
                     self.nodeManager.newPaste)
        self.connect(self.nodeManager, SIGNAL("pasteFinished()"),
                     self.pastebin.reject)

        self.browser = Browser.Browser(self.config)

        self.positionWindow()
        self.show()
Example #28
0
    def __init__(self, model, label="", help_link=""):
        HelpedWidget.__init__(self, "", help_link)

        layout = QVBoxLayout()

        widget = QWidget()
        widget.setLayout(layout)

        self.checkAllButton = QToolButton()
        self.checkAllButton.setIcon(resourceIcon("checked"))
        self.checkAllButton.setIconSize(QSize(16, 16))
        self.checkAllButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
        self.checkAllButton.setAutoRaise(True)
        self.checkAllButton.setToolTip("Select all")

        self.uncheckAllButton = QToolButton()
        self.uncheckAllButton.setIcon(resourceIcon("notchecked"))
        self.uncheckAllButton.setIconSize(QSize(16, 16))
        self.uncheckAllButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
        self.uncheckAllButton.setAutoRaise(True)
        self.uncheckAllButton.setToolTip("Unselect all")

        self.list = QListWidget()
        self.list.setContextMenuPolicy(Qt.CustomContextMenu)
        self.list.setSelectionMode(QAbstractItemView.ExtendedSelection)

        self.search_box = SearchBox()

        check_button_layout = QHBoxLayout()

        check_button_layout.setMargin(0)
        check_button_layout.setSpacing(0)
        check_button_layout.addWidget(QLabel(label))
        check_button_layout.addStretch(1)
        check_button_layout.addWidget(self.checkAllButton)
        check_button_layout.addWidget(self.uncheckAllButton)

        layout.addLayout(check_button_layout)
        layout.addWidget(self.list)
        layout.addWidget(self.search_box)

        self.addWidget(widget)

        self.connect(self.checkAllButton, SIGNAL('clicked()'), self.checkAll)
        self.connect(self.uncheckAllButton, SIGNAL('clicked()'), self.uncheckAll)
        self.connect(self.list, SIGNAL('itemChanged(QListWidgetItem*)'), self.itemChanged)
        self.search_box.filterChanged.connect(self.filterList)
        # self.connect(self.search_box, SIGNAL('filterChanged(str)'), self.filterList)

        self.connect(self.list, SIGNAL('customContextMenuRequested(QPoint)'), self.showContextMenu)

        assert isinstance(model, (SelectableModelMixin, ListModelMixin))
        self.model = model
        self.model.observable().attach(SelectableModelMixin.SELECTION_CHANGED_EVENT, self.modelChanged)
        self.model.observable().attach(ListModelMixin.LIST_CHANGED_EVENT, self.modelChanged)
        self.modelChanged()
Example #29
0
 def __init__(self, lineEdit):
     QObject.__init__(self)
     hbox = QHBoxLayout(lineEdit)
     hbox.setMargin(0)
     lineEdit.setLayout(hbox)
     hbox.addStretch()
     self.counter = QLabel(lineEdit)
     hbox.addWidget(self.counter)
     lineEdit.setStyleSheet("padding-right: 2px;")
     lineEdit.setTextMargins(0, 0, 60, 0)
Example #30
0
 def __init__(self, parent, color2):
     QFrame.__init__(self, parent)
     layout = QHBoxLayout(self)
     layout.setMargin(0)
     layout.setSpacing(0)
     color1 = QColor(color2).lighter(150).name()
     layout.addWidget(PointyLabel(self, color1, color2))
     self.setStyleSheet(
         "QLabel { background-color : QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %s, stop: 1 %s) }"
         % (color1, color2))
Example #31
0
 def __init__(self, lineEdit):
     QObject.__init__(self)
     hbox = QHBoxLayout(lineEdit)
     hbox.setMargin(0)
     lineEdit.setLayout(hbox)
     hbox.addStretch()
     self.counter = QLabel(lineEdit)
     hbox.addWidget(self.counter)
     lineEdit.setStyleSheet("padding-right: 2px;")
     lineEdit.setTextMargins(0, 0, 60, 0)
Example #32
0
 def __init__(self, lineEdit, operation, icon=None):
     hbox = QHBoxLayout(lineEdit)
     hbox.setMargin(0)
     lineEdit.setLayout(hbox)
     hbox.addStretch()
     btnOperation = QPushButton(lineEdit)
     if icon:
         btnOperation.setIcon(QIcon(icon))
     hbox.addWidget(btnOperation)
     btnOperation.clicked.connect(operation)
Example #33
0
 def __init__(self, lineEdit, operation, icon=None):
     hbox = QHBoxLayout(lineEdit)
     hbox.setMargin(0)
     lineEdit.setLayout(hbox)
     hbox.addStretch()
     btnOperation = QPushButton(lineEdit)
     if icon:
         btnOperation.setIcon(QIcon(icon))
     hbox.addWidget(btnOperation)
     btnOperation.clicked.connect(operation)
Example #34
0
    def __init__(self, line_style_set=STYLESET_DEFAULT):
        QWidget.__init__(self)
        self._style = PlotStyle("StyleChooser Internal Style")

        self._styles = STYLES[
            'default'] if not line_style_set in STYLES else STYLES[
                line_style_set]

        self.setMinimumWidth(140)
        self.setMaximumHeight(25)

        layout = QHBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(2)

        self.line_chooser = QComboBox()
        self.line_chooser.setToolTip("Select line style.")
        for style in self._styles:
            self.line_chooser.addItem(*style)

        self.marker_chooser = QComboBox()
        self.marker_chooser.setToolTip("Select marker style.")
        for marker in MARKERS:
            self.marker_chooser.addItem(*marker)

        self.thickness_spinner = QDoubleSpinBox()
        self.thickness_spinner.setToolTip("Line thickness")
        self.thickness_spinner.setMinimum(0.1)
        self.thickness_spinner.setDecimals(1)
        self.thickness_spinner.setSingleStep(0.1)

        self.size_spinner = QDoubleSpinBox()
        self.size_spinner.setToolTip("Marker Size")
        self.size_spinner.setMinimum(0.1)
        self.size_spinner.setDecimals(1)
        self.size_spinner.setSingleStep(0.1)

        # the text content of the spinner varies, but shouldn't push the control out of boundaries
        self.line_chooser.setMinimumWidth(110)
        layout.addWidget(self.line_chooser)
        layout.addWidget(self.thickness_spinner)
        layout.addWidget(self.marker_chooser)
        layout.addWidget(self.size_spinner)

        self.setLayout(layout)

        self.line_chooser.currentIndexChanged.connect(self._updateStyle)
        self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
        self.thickness_spinner.valueChanged.connect(self._updateStyle)
        self.size_spinner.valueChanged.connect(self._updateStyle)

        self._updateLineStyleAndMarker(self._style.line_style,
                                       self._style.marker, self._style.width,
                                       self._style.size)
        self._layout = layout
Example #35
0
class TaskClock(QPushButton):
    def __init__(self, id, parent = None):
        QWidget.__init__(self, parent)
        self.layout = QHBoxLayout()
        self.layout.setSpacing(0)
        self.layout.setMargin(0)
        self.setMaximumSize(resourceManager.get_icon_image_max_size())
        self.setStyleSheet(
          "background-image: url(" + resourceManager.get_image('clock') + ");"
          "background-repeat:no-repeat;"
        )
Example #36
0
    def add_log_row(self, log_content_array):
        # add row to the QTableWidget for logs
        row_count = self.logs_ui.logs_table.rowCount()
        self.logs_ui.logs_table.setRowCount(row_count + 1)
        event_sign_image_path = None
        # log levels:
        # debug
        # info
        # notice
        # warning
        # error
        if log_content_array["log_event_type"] == "info":
            info_png_path = os.path.join(os.path.dirname(__file__),
                                         'resources/img/info.png')
            event_sign_image_path = str(info_png_path)
        elif log_content_array["log_event_type"] == "warning":
            warning_png_path = os.path.join(os.path.dirname(__file__),
                                            'resources/img/warning.png')
            event_sign_image_path = str(warning_png_path)
        elif log_content_array["log_event_type"] == "notice":
            notice_png_path = os.path.join(os.path.dirname(__file__),
                                           'resources/img/notice.png')
            event_sign_image_path = str(notice_png_path)
        elif log_content_array["log_event_type"] == "debug":
            debug_png_path = os.path.join(os.path.dirname(__file__),
                                          'resources/img/debug.png')
            event_sign_image_path = str(debug_png_path)
        elif log_content_array["log_event_type"] == "success":
            debug_png_path = os.path.join(os.path.dirname(__file__),
                                          'resources/img/success.png')
            event_sign_image_path = str(debug_png_path)
        elif log_content_array["log_event_type"] == "error":
            error_png_path = os.path.join(os.path.dirname(__file__),
                                          'resources/img/error.png')
            event_sign_image_path = str(error_png_path)

        image = ImageWidget(event_sign_image_path, self)
        widget = QWidget()
        hbl = QHBoxLayout()
        hbl.setMargin(0)
        hbl.setSpacing(0)
        hbl.addWidget(image)
        widget.setLayout(hbl)
        self.logs_ui.logs_table.setCellWidget(row_count, 0, widget)
        self.logs_ui.logs_table.setItem(
            row_count, 1,
            QTableWidgetItem(log_content_array["log_event_type"]))
        titleitem = QTableWidgetItem(log_content_array["title"])
        titleitem.setTextAlignment(QtCore.Qt.AlignCenter)
        self.logs_ui.logs_table.setItem(row_count, 2, titleitem)
        self.logs_ui.logs_table.setItem(
            row_count, 3, QTableWidgetItem(log_content_array["description"]))

        return 1
Example #37
0
    def createTab(self, url):
        self.tabLayout = QVBoxLayout()
        self.tabLayout.setMargin(0)
        self.tabLayout.setSpacing(0)
        tab = QWidget()
        tab.setLayout(self.tabLayout)

        #-- Creando NavBar
        navBar = QWidget()
        navBar.setMaximumHeight(27)
        backButton = QToolButton()
        backButton.setIcon(QIcon('img/goBack5.png'))
        nextButton = QToolButton()
        nextButton.setIcon(QIcon('img/goNext5.png'))
        stopButton = QToolButton()
        stopButton.setIcon(QIcon('img/stopLoad5.png'))
        buttonGO = QToolButton()
        buttonGO.setIcon(QIcon('img/goGo5.png'))
        self.urlBox = QLineEdit()

        navBarLayout = QHBoxLayout()
        navBarLayout.setMargin(0)
        navBarLayout.setSpacing(0)
        navBarLayout.addWidget(backButton)
        navBarLayout.addWidget(nextButton)
        navBarLayout.addWidget(stopButton)
        navBarLayout.addWidget(self.urlBox)
        navBarLayout.addWidget(buttonGO)
        navBar.setLayout(navBarLayout)


        self.tabLayout.addWidget(navBar)

        #-- Creando la vista Web
        self.web = QWebView()
        self.tabLayout.addWidget(self.web)

        #-- Signals
        self.urlBox.returnPressed.connect(lambda: self.loadURL(self.web, self.urlBox.displayText()))
        buttonGO.clicked.connect(lambda: self.loadURL(self.web, self.urlBox.displayText()))
        backButton.clicked.connect(lambda: self.goBack(self.web, self.urlBox))
        nextButton.clicked.connect(lambda: self.goBack(self.web, self.urlBox))
        #stopButton.clicked.connect(self.stopLoad)
        self.web.loadFinished.connect(lambda:self.loadFinished(self.web,self.urlBox))
        self.web.linkClicked.connect(self.handleLinkClicked)

        #web.urlChanged.connect(self.updateUrlBox)
        #web.connect(web, QtCore.SIGNAL('loadFinished(bool)'), self.loadFinished)
        self.tabBarWidget.setCurrentIndex(self.tabBarWidget.addTab(tab, 'Cargando...'))
        self.web.load(QUrl(str(url)))

        #Set Focus URL Box
        self.urlBox.setFocus()
        self.urlBox.selectAll()
Example #38
0
 def __init__(self, combo, operation, icon=None):
     hbox = QHBoxLayout(combo)
     hbox.setDirection(hbox.RightToLeft)
     hbox.setMargin(0)
     combo.setLayout(hbox)
     hbox.addStretch()
     btnOperation = QPushButton(combo)
     btnOperation.setObjectName('combo_button')
     if icon:
         btnOperation.setIcon(QIcon(icon))
     hbox.addWidget(btnOperation)
     btnOperation.clicked.connect(operation)
Example #39
0
 def __init__(self, combo, operation, icon=None):
     hbox = QHBoxLayout(combo)
     hbox.setDirection(hbox.RightToLeft)
     hbox.setMargin(0)
     combo.setLayout(hbox)
     hbox.addStretch()
     btnOperation = QPushButton(combo)
     btnOperation.setObjectName('combo_button')
     if icon:
         btnOperation.setIcon(QIcon(icon))
     hbox.addWidget(btnOperation)
     btnOperation.clicked.connect(operation)
Example #40
0
    def __init__(self, column, parent=None, pixmap=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

        #Configure load button
        self.btn_load = QToolButton(parent)
        self.btn_load.setCursor(Qt.PointingHandCursor)
        self.btn_load.setFocusPolicy(Qt.NoFocus)
        px = QPixmap(':/plugins/stdm/images/icons/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)

        #set minimum size
        frame_width = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
        msz = self.minimumSizeHint()
        self.setMinimumSize(
            max(msz.width(),
                self.btn_load.sizeHint().height() + frame_width * 2 + 2),
            max(msz.height(),
                self.btn_load.sizeHint().height() + frame_width * 2 + 2))

        #Ensure that text does not overlay button
        r_padding = self.btn_load.sizeHint().width() + frame_width + 1
        self.setStyleSheet('padding-right: ' + str(r_padding) + 'px;')

        #Set layout
        layout = QHBoxLayout(self)
        layout.addWidget(self.btn_load, 0, Qt.AlignRight)
        layout.setSpacing(0)
        layout.setMargin(5)

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

        #Current model object
        self._current_item = None
Example #41
0
    def __init__(self):
        QHBoxLayout.__init__(self)
        self.maximumPageNumber = 0
        self.currentPageNumber = 0

        pageLayout = QHBoxLayout()
        self.addLayout(pageLayout)
        pageLayout.setMargin(0)
        pageLayout.setSpacing(0)
        self.pageLabel = QLabel(self.tr("Page: "))
        self.pageLabel.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        pageLayout.addWidget(self.pageLabel)
        self.currentNumberLineEdit = QLineEdit()
        self.pageLabel.setBuddy(self.currentNumberLineEdit)
        pageLayout.addWidget(self.currentNumberLineEdit)
        self.currentNumberLineEdit.setMaximumWidth(35)
        self.currentNumberLineEdit.setSizePolicy(QSizePolicy.Fixed,
                                                 QSizePolicy.Fixed)
        self.currentNumberLineEdit.setStyleSheet("border-left-width: 2px;"
                                                 "border-right-width: 0px;"
                                                 "border-top-width: 2px;"
                                                 "border-bottom-width: 2px;"
                                                 "border-style: solid;"
                                                 "border-color: gray;")
        self.maximumNumberLineEdit = QLineEdit()
        pageLayout.addWidget(self.maximumNumberLineEdit)
        self.maximumNumberLineEdit.setMaximumWidth(40)
        self.maximumNumberLineEdit.setSizePolicy(QSizePolicy.Fixed,
                                                 QSizePolicy.Fixed)
        self.maximumNumberLineEdit.setStyleSheet("border-left-width: 0px;"
                                                 "border-right-width: 2px;"
                                                 "border-top-width: 2px;"
                                                 "border-bottom-width: 2px;"
                                                 "border-style: solid;"
                                                 "border-color: gray;")
        self.maximumNumberLineEdit.setReadOnly(True)
        self.updateText()

        buttonLayout = QHBoxLayout()
        buttonLayout.setMargin(0)
        buttonLayout.setSpacing(0)
        self.connect(self.currentNumberLineEdit, SIGNAL("editingFinished()"),
                     self.validateText)
        self.previousPageButton = QPushButton(QIcon(":top.png"), "")
        self.connect(self.previousPageButton, SIGNAL("clicked()"),
                     self.previousPageButtonPressed)
        buttonLayout.addWidget(self.previousPageButton)
        self.nextPageButton = QPushButton(QIcon(":down.png"), "")
        self.connect(self.nextPageButton, SIGNAL("clicked()"),
                     self.nextPageButtonPressed)
        buttonLayout.addWidget(self.nextPageButton)
        self.addLayout(buttonLayout)
    def add_log_row(self, log_content_array):
        # add row to the QTableWidget for logs
        row_count = self.logs_ui.logs_table.rowCount()
        self.logs_ui.logs_table.setRowCount(row_count + 1)
        event_sign_image_path = None

        if log_content_array['log_event_type'] == 'info':
            info_png_path = os.path.join(os.path.dirname(__file__),
                                         'resources/img/info.png')
            event_sign_image_path = str(info_png_path)
        elif log_content_array['log_event_type'] == 'warning':
            warning_png_path = os.path.join(os.path.dirname(__file__),
                                            'resources/img/warning.png')
            event_sign_image_path = str(warning_png_path)
        elif log_content_array['log_event_type'] == 'notice':
            notice_png_path = os.path.join(os.path.dirname(__file__),
                                           'resources/img/notice.png')
            event_sign_image_path = str(notice_png_path)
        elif log_content_array['log_event_type'] == 'debug':
            debug_png_path = os.path.join(os.path.dirname(__file__),
                                          'resources/img/debug.png')
            event_sign_image_path = str(debug_png_path)
        elif log_content_array['log_event_type'] == 'success':
            debug_png_path = os.path.join(os.path.dirname(__file__),
                                          'resources/img/success.png')
            event_sign_image_path = str(debug_png_path)
        elif log_content_array['log_event_type'] == 'error':
            error_png_path = os.path.join(os.path.dirname(__file__),
                                          'resources/img/error.png')
            event_sign_image_path = str(error_png_path)

        image = ImageWidget(event_sign_image_path, self)
        widget = QWidget()
        hbl = QHBoxLayout()
        hbl.setMargin(0)
        hbl.setSpacing(0)
        hbl.addWidget(image)
        widget.setLayout(hbl)

        self.logs_ui.logs_table.setCellWidget(row_count, 0, widget)
        self.logs_ui.logs_table.setItem(
            row_count, 1,
            QTableWidgetItem(log_content_array['log_event_type']))

        titleitem = QTableWidgetItem(log_content_array['title'])
        titleitem.setTextAlignment(QtCore.Qt.AlignCenter)

        self.logs_ui.logs_table.setItem(row_count, 2, titleitem)
        self.logs_ui.logs_table.setItem(
            row_count, 3, QTableWidgetItem(log_content_array['description']))

        return 1
Example #43
0
  def __init__(self, parent, text, value):
    QWidget.__init__(self, parent)

    self.text=text
    self.value=value

    hbox=QHBoxLayout(self)
    hbox.setMargin(0)

    hbox.addWidget(QLabel(text%value))

    self.button=QPushButton(QIcon.fromTheme('edit-delete'), '', self)
    hbox.addWidget(self.button)
Example #44
0
    def __init__(self, parent=None, icon=None):
        QLineEdit.__init__(self, parent)

        self.Button = QPushButton(self)
        self.Button.setCursor(Qt.PointingHandCursor)
        self.Button.setFocusPolicy(Qt.NoFocus)
        self.Button.setIcon(QIcon(icon))
        #self.Button.setStyleSheet('background: transparent; border: none;')
        layout = QHBoxLayout(self)
        layout.addWidget(self.Button, 0, Qt.AlignRight)

        layout.setSpacing(0)
        layout.setMargin(1)
Example #45
0
    def __init__(self, caption, parent, selected=False):
        QWidget.__init__(self)

        self.value = selected
        self.radiobutton = QRadioButton(caption, parent)
        self.radiobutton.clicked.connect(self.__on_change)

        hbox = QHBoxLayout()
        hbox.addWidget(self.radiobutton)
        hbox.setMargin(0)
        self.setLayout(hbox)
        self.setContentsMargins(0, 0, 0, 0)
        self.radiobutton.setChecked(self.value)
Example #46
0
def h_centered(layout, item):
    l_spacer = QSpacerItem(0, 0)
    r_spacer = QSpacerItem(0, 0)
    proxy = QHBoxLayout()
    proxy.setSpacing(0)
    proxy.setMargin(0)
    proxy.addItem(l_spacer)
    if isinstance(item, QLayout):
        proxy.addLayout(item)
    else:
        proxy.addWidget(item)
    proxy.addItem(r_spacer)
    layout.addLayout(proxy)
Example #47
0
    def __init__( self, editorsManager, parent = None ):

        QWidget.__init__( self, parent )
        self.editorsManager = editorsManager

        self.__gotoHistory = []

        # Common graphics items
        closeButton = QToolButton( self )
        closeButton.setToolTip( "Click to close the dialog (ESC)" )
        closeButton.setIcon( PixmapCache().getIcon( "close.png" ) )
        closeButton.clicked.connect( self.hide )

        lineLabel = QLabel( self )
        lineLabel.setText( "Goto line:" )

        self.linenumberEdit = QComboBox( self )
        self.linenumberEdit.setEditable( True )
        self.linenumberEdit.setInsertPolicy( QComboBox.InsertAtTop )
        self.linenumberEdit.setAutoCompletion( False )
        self.linenumberEdit.setDuplicatesEnabled( False )
        sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
        sizePolicy.setHorizontalStretch( 0 )
        sizePolicy.setVerticalStretch( 0 )
        sizePolicy.setHeightForWidth(
                self.linenumberEdit.sizePolicy().hasHeightForWidth() )
        self.linenumberEdit.setSizePolicy( sizePolicy )
        self.validator = QIntValidator( 1, 100000, self )
        self.linenumberEdit.setValidator( self.validator )
        self.linenumberEdit.editTextChanged.connect( self.__onEditTextChanged )
        self.linenumberEdit.lineEdit().returnPressed.connect( self.__onEnter )

        self.goButton = QToolButton( self )
        self.goButton.setToolTip( "Click to jump to the line (ENTER)" )
        self.goButton.setIcon( PixmapCache().getIcon( "gotoline.png" ) )
        self.goButton.setFocusPolicy( Qt.NoFocus )
        self.goButton.setEnabled( False )
        self.goButton.clicked.connect( self.__onGo )

        spacer = QWidget()
        spacer.setFixedWidth( 1 )

        horizontalLayout = QHBoxLayout( self )
        horizontalLayout.setMargin( 0 )

        horizontalLayout.addWidget( closeButton )
        horizontalLayout.addWidget( lineLabel )
        horizontalLayout.addWidget( self.linenumberEdit )
        horizontalLayout.addWidget( self.goButton )
        horizontalLayout.addWidget( spacer )
        return
Example #48
0
    def load_ui(self):
        container = QVBoxLayout(self)

        box = QHBoxLayout()
        box.setContentsMargins(0, 0, 0, 0)
        box.setSpacing(0)
        toolbar = QToolBar()
        toolbar.setToolButtonStyle(3)
        toolbar.setOrientation(Qt.Vertical)
        toolbar.setIconSize(QSize(30, 30))
        toolbar.setObjectName("preferencias")

        environment_section = toolbar.addAction(QIcon(":image/general-pref"),
                                                "Entorno")
        editor_section = toolbar.addAction(QIcon(":image/editor-pref"),
                                           "Editor")
        compiler_section = toolbar.addAction(QIcon(":image/compiler-pref"),
                                             "Compilador")
        self.connect(environment_section, SIGNAL("triggered()"),
                     lambda: self.change_widget(0))
        self.connect(editor_section, SIGNAL("triggered()"),
                     lambda: self.change_widget(1))
        self.connect(compiler_section, SIGNAL("triggered()"),
                     lambda: self.change_widget(2))

        # Set size
        for action in toolbar.actions():
            widget = toolbar.widgetForAction(action)
            widget.setFixedSize(80, 50)

        box.addWidget(toolbar)

        self.stack = QStackedWidget()
        box.addWidget(self.stack)

        # Load sections and subsections
        for section in self.__sections:
            for name, obj in list(section.get_tabs().items()):
                section.install_tab(obj, name)
            self.stack.addWidget(section)

        box_buttons = QHBoxLayout()
        box_buttons.setMargin(10)
        box_buttons.setSpacing(10)
        box_buttons.addStretch(1)
        self.btn_cancel = QPushButton(self.tr("Cancelar"))
        self.btn_guardar = QPushButton(self.tr("Guardar"))
        box_buttons.addWidget(self.btn_cancel)
        box_buttons.addWidget(self.btn_guardar)
        container.addLayout(box)
        container.addLayout(box_buttons)
Example #49
0
    def __init__(self, area_supported=False):
        QWidget.__init__(self)
        self._style = PlotStyle("StyleChooser Internal Style")
        self._styles = STYLES if area_supported else STYLES_LINE_ONLY

        self.setMinimumWidth(140)
        self.setMaximumHeight(25)

        layout = QHBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(2)

        self.line_chooser = QComboBox()
        self.line_chooser.setToolTip("Select line style.")
        for style in self._styles:
            self.line_chooser.addItem(*style)

        self.marker_chooser = QComboBox()
        self.marker_chooser.setToolTip("Select marker style.")
        for marker in MARKERS:
            self.marker_chooser.addItem(*marker)

        self.thickness_spinner = QDoubleSpinBox()
        self.thickness_spinner.setToolTip("Line thickness")
        self.thickness_spinner.setMinimum(0.1)
        self.thickness_spinner.setDecimals(1)
        self.thickness_spinner.setSingleStep(0.1)

        self.size_spinner = QDoubleSpinBox()
        self.size_spinner.setToolTip("Marker Size")
        self.size_spinner.setMinimum(0.1)
        self.size_spinner.setDecimals(1)
        self.size_spinner.setSingleStep(0.1)

        layout.addWidget(self.line_chooser)
        layout.addWidget(self.thickness_spinner)
        layout.addWidget(self.marker_chooser)
        layout.addWidget(self.size_spinner)

        self.setLayout(layout)

        self.line_chooser.currentIndexChanged.connect(self._updateStyle)
        self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
        self.thickness_spinner.valueChanged.connect(self._updateStyle)
        self.size_spinner.valueChanged.connect(self._updateStyle)

        self._updateLineStyleAndMarker(self._style.line_style,
                                       self._style.marker, self._style.width,
                                       self._style.size)
        self._layout = layout
Example #50
0
    def generateCenteredCheckbox(checked=False):
        """
		@rtype: QCheckBox
		"""
        field = QWidget()
        checkbox = QCheckBox()
        layout = QHBoxLayout(field)
        layout.addWidget(checkbox, 0, Qt.AlignHCenter)
        layout.setMargin(1)
        field.setLayout(layout)
        field.checkbox = checkbox
        checkbox.setChecked(checked)

        return field
Example #51
0
    def __init__(self, parent=None):
        """
        Constructor
        """
        super(DCaptureMouse, self).__init__(parent)
        self.setWindowOpacity(0.7)

        self.posLabel = QLabelMouse(self)

        layoutQHBoxLayout = QHBoxLayout()
        layoutQHBoxLayout.addWidget(self.posLabel)
        layoutQHBoxLayout.setMargin(0)
        layoutQHBoxLayout.setSpacing(0)
        self.setLayout(layoutQHBoxLayout)
        self.showFullScreen()
Example #52
0
    def __init__(self, parent=None):
        QWidget.__init__(self)
        MainWindowTabWidgetBase.__init__(self)

        layout = QHBoxLayout(self)
        layout.setMargin(0)

        self.__editor = TextViewer(self)
        self.__editor.escapePressed.connect(self.__onEsc)
        layout.addWidget(self.__editor)

        self.__fileName = ""
        self.__shortName = ""
        self.__encoding = "n/a"
        return
Example #53
0
    def __init__(self, parent):
        QToolBar.__init__(self, parent)
        assert parent
        self.dock = parent

        # a fake spacer widget
        w = QWidget(self)
        l = QHBoxLayout(w)
        l.setMargin(0)
        l.setSpacing(0)
        l.addStretch()

        frame = QFrame()
        layout = QBoxLayout(QBoxLayout.LeftToRight, frame)
        layout.setContentsMargins(4, 4, 0, 0)
        layout.setSpacing(2)
        self.aDockFrame = self.addWidget(frame)

        self.__icon = QLabel()

        layout.addWidget(self.__icon)
        layout.addWidget(QLabel(self.dock.windowTitle()))

        self.dock.windowIconChanged.connect(self.__setWindowIcon)

        # fake spacer item
        spacer = QWidgetAction(self)
        spacer.setDefaultWidget(w)

        self.setMovable(False)
        self.setFloatable(False)
        self.setIconSize(QSize(12, 12))

        self.aFloat = QAction(self)
        self.aClose = QAction(self)

        QToolBar.addAction(self, spacer)
        self.separator = QToolBar.addSeparator(self)
        QToolBar.addAction(self, self.aFloat)
        QToolBar.addAction(self, self.aClose)

        self.updateStandardIcons()

        self.dockWidgetFeaturesChanged(self.dock.features())

        self.dock.featuresChanged.connect(self.dockWidgetFeaturesChanged)
        self.aFloat.triggered.connect(self._floatTriggered)
        self.aClose.triggered.connect(self.dock.close)
Example #54
0
    def __init__(self):
        super(TxFilterView, self).__init__()

        self.widget = QWidget(self)
        bg_layout = QVBoxLayout(self)
        bg_layout.setMargin(0)
        bg_layout.addWidget(self.widget)

        layout = QHBoxLayout()
        layout.setMargin(0)
        texts = []
        for t in texts:
            label = QLabel()
            label.setText(t)
            layout.addWidget(label)
        self.widget.setLayout(layout)
Example #55
0
    def __init__(self, caption, checked=False, tooltip=''):
        QWidget.__init__(self)

        self.value = checked

        self.checkbox = QCheckBox(caption)
        self.checkbox.stateChanged.connect(self.__on_change)
        self.checkbox.setToolTip(tooltip)

        hbox = QHBoxLayout()
        hbox.addWidget(self.checkbox)
        hbox.setMargin(0)
        self.setLayout(hbox)
        #self.setContentsMargins(5, 0, 5, 0)
        self.setContentsMargins(0, 0, 0, 0)
        self.checkbox.setChecked(self.value)
Example #56
0
class RowGroup(HelpedWidget):
    def __init__(self, label="", help_link=""):
        HelpedWidget.__init__(self, label, help_link)

        widget = QWidget()
        self.layout = QHBoxLayout()
        self.layout.setMargin(0)

        widget.setLayout(self.layout)

        HelpedWidget.addWidget(self, widget)

    def addWidget(self, widget):
        self.layout.addWidget(widget)

    def addGroupStretch(self):
        self.layout.addStretch(1)
Example #57
0
    def __init__(self, parent=None):

        MainWindowTabWidgetBase.__init__(self)
        QFrame.__init__(self, parent)

        self.setFrameShape(QFrame.StyledPanel)
        layout = QHBoxLayout(self)
        layout.setMargin(0)

        self.__editor = HTMLViewer(self)
        self.__editor.escapePressed.connect(self.__onEsc)
        layout.addWidget(self.__editor)

        self.__fileName = ""
        self.__shortName = ""
        self.__encoding = "n/a"
        return
Example #58
0
    def __init__(self, label, line_style=STYLE_OFF, marker_style=MARKER_OFF, area_supported=False, labeled=False):
        QWidget.__init__(self)

        self.__styles = StyleChooser.STYLES if area_supported else StyleChooser.STYLES_LINE_ONLY

        self.setMinimumWidth(140)
        if labeled:
            self.setMaximumHeight(45)
        else:
            self.setMaximumHeight(25)

        layout = QHBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(2)

        self.line_chooser = QComboBox()
        self.line_chooser.setToolTip("Select line style.")
        for style in self.__styles:
            self.line_chooser.addItem(*style)

        self.marker_chooser = QComboBox()
        self.marker_chooser.setToolTip("Select marker style.")
        for marker in StyleChooser.MARKERS:
            self.marker_chooser.addItem(*marker)

        self.style_label = QLabel("%s:" % label)
        self.style_label.setAlignment(Qt.AlignLeft | Qt.AlignBottom)
        layout.addWidget(self.style_label)

        if labeled:
            labeled_line_chooser = self._createLabeledChooser("Line Style", self.line_chooser)
            labeled_marker_chooser = self._createLabeledChooser("Marker", self.marker_chooser)
            layout.addWidget(labeled_line_chooser)
            layout.addWidget(labeled_marker_chooser)
        else:
            layout.addWidget(self.line_chooser)
            layout.addWidget(self.marker_chooser)

        self.setLayout(layout)
        self.label = label

        self.line_chooser.currentIndexChanged.connect(self.updateStyle)
        self.marker_chooser.currentIndexChanged.connect(self.updateStyle)

        self.line_chooser.setCurrentIndex(self.__styles.index(line_style))
        self.marker_chooser.setCurrentIndex(StyleChooser.MARKERS.index(marker_style))