Example #1
0
    def __init__(self, workspace, addr, parent=None):
        super(NewPath, self).__init__(parent)

        # initialization

        self._addr = addr
        self._workspace = workspace

        self._name_box = None  # type: QLineEdit
        self._address_box = None
        self._status_label = None
        self._init_state_combo = None
        self._ok_button = None

        self.setWindowTitle('New Path')

        self.main_layout = QVBoxLayout()

        self._init_widgets()

        self.setLayout(self.main_layout)
    def _init_widgets(self):
        lbl_function = QLabel(self)
        lbl_function.setText("Function")
        self._function_list = QFunctionComboBox(
            show_all_functions=True,
            selection_callback=self._on_function_selected,
            parent=self)

        function_layout = QHBoxLayout()
        function_layout.addWidget(lbl_function)
        function_layout.addWidget(self._function_list)

        self._string_table = QStringTable(
            self, selection_callback=self._on_string_selected)

        layout = QVBoxLayout()
        layout.addLayout(function_layout)
        layout.addWidget(self._string_table)
        layout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(layout)
Example #3
0
    def layoutWidgets(self):
        vbox = QVBoxLayout()
        vbox.addLayout(self.topForm)
        hbox = QHBoxLayout()
        hbox.addLayout(self.startForm)
        hbox.addLayout(self.endForm)
        vbox.addLayout(hbox)

        self.setLayout(vbox)
        self.setTabOrder(self.documentStartEdit, self.documentEndEdit)
        self.setTabOrder(self.sectionStartEdit, self.sectionEndEdit)
        self.setTabOrder(self.mainStartEdit, self.mainEndEdit)
        self.setTabOrder(self.sub1StartEdit, self.sub1EndEdit)
        self.setTabOrder(self.sub2StartEdit, self.sub2EndEdit)
        self.setTabOrder(self.sub3StartEdit, self.sub3EndEdit)
        self.setTabOrder(self.sub4StartEdit, self.sub4EndEdit)
        self.setTabOrder(self.sub5StartEdit, self.sub5EndEdit)
        self.setTabOrder(self.sub6StartEdit, self.sub6EndEdit)
        self.setTabOrder(self.sub7StartEdit, self.sub7EndEdit)
        self.setTabOrder(self.sub8StartEdit, self.sub8EndEdit)
        self.setTabOrder(self.sub9StartEdit, self.sub9EndEdit)
Example #4
0
 def __init__(self, parent=None):
     super(MplCanvas, self).__init__(parent)
     #屏幕图片分辨率
     self.fig = Figure(figsize=(8, 6), dpi=100)
     self.canvas = FigureCanvas(self.fig)
     self.canvas.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     self.canvas.setParent(parent)
     #调整画布区
     self.fig.subplots_adjust(left=0.02, bottom=0.08, top=0.95, right=0.95)
     self.fig.clear()
     self.layout = QVBoxLayout()
     self.layout.setContentsMargins(0, 0, 0, 0)
     self.layout.addWidget(self.canvas)
     self.mpl_toolbar = NavigationToolbar(self.canvas,
                                          parent,
                                          coordinates=False)
     #self._init_MplToolBar()
     self.mpl_toolbar.hide()
     #self.layout.addWidget(self.mpl_toolbar)
     self.setLayout(self.layout)
     self._init_Axes()
Example #5
0
    def __init__(self):
        QWidget.__init__(self)
        self.setWindowTitle('Directory Detective Tool')
        main_layout = QVBoxLayout()

        path_layout = self._init_path_layout()
        guide_layout = self._init_guide_layout()
        detail_layout = self._init_detail_layout()

        main_layout.addLayout(path_layout)
        main_layout.addLayout(guide_layout)
        main_layout.addLayout(detail_layout)
        self.setLayout(main_layout)
        self.setGeometry(300, 300, 400, 350)
        self._connect()

        self._walk_folder = None
        self._last_path = None
        self.directory_info = None
        self._button_list = list()
        self._last_info = None
Example #6
0
    def __init__(self, parent=None):
        super(ReadOptions, self).__init__()

        self.setTitle('Reading Options')

        self.layout = QVBoxLayout(self)

        self.label_poolling_rate = QLabel('Pooling Rate (ms)', self)
        self.layout.addWidget(self.label_poolling_rate)

        self.le_poolling_rate = QLineEdit(self)
        self.le_poolling_rate.setText('200')
        regex = QRegExp('[0-9]+')
        validator = QRegExpValidator(regex)
        self.le_poolling_rate.setValidator(validator)
        self.layout.addWidget(self.le_poolling_rate)

        self.chbox_sync = QCheckBox("Synchronous read")
        self.layout.addWidget(self.chbox_sync)

        self.setLayout(self.layout)
Example #7
0
    def OnCreate(self, form):
        if HAS_PYSIDE:
            self.parent = self.FormToPySideWidget(form)
        else:
            self.parent = self.FormToPyQtWidget(form)

        self._idp_hooks = AutoReIDPHooks(self)
        if not self._idp_hooks.hook():
            print 'IDP_Hooks.hook() failed'

        self.tv = QTreeView()
        self.tv.setExpandsOnDoubleClick(False)

        root_layout = QVBoxLayout(self.parent)
        # self.le_filter = QLineEdit(self.parent)

        # root_layout.addWidget(self.le_filter)
        root_layout.addWidget(self.tv)

        self.parent.setLayout(root_layout)

        self._model = QtGui.QStandardItemModel()
        self._init_model()
        self.tv.setModel(self._model)

        self.tv.setColumnWidth(0, 200)
        self.tv.setColumnWidth(1, 300)
        self.tv.header().setStretchLastSection(True)

        self.tv.expandAll()

        self.tv.doubleClicked.connect(self.on_navigate_to_method_requested)
        # self.le_filter.textChanged.connect(self.on_filter_text_changed)
        self.tv.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.tv.customContextMenuRequested.connect(self._tree_customContextMenuRequesssted)

        rename_action = QAction('Rename...', self.tv)
        rename_action.setShortcut('n')
        rename_action.triggered.connect(self._tv_rename_action_triggered)
        self.tv.addAction(rename_action)
    def _load_memory_widgets(self):

        state = self._state

        COLUMNS = 16
        ROWS = 10

        layout = QVBoxLayout()

        addr_base = self.addr

        for row in xrange(ROWS):

            row_layout = QHBoxLayout()

            col = 0

            addr = addr_base + row * COLUMNS
            addr_label = QLabel("%x" % addr)
            addr_label.setProperty("class", "memory_viewer_address")
            row_layout.addWidget(addr_label)

            while col < COLUMNS:
                addr = addr_base + row * COLUMNS + col
                data = state.memory.load(addr, 1)

                ast_viewer = QASTViewer(data,
                                        display_size=False,
                                        byte_format="%02x")

                row_layout.addWidget(ast_viewer)

                col += 1
            row_layout.addStretch(0)

            layout.addLayout(row_layout)

        container = QFrame()
        container.setLayout(layout)
        self._scrollarea.setWidget(container)
Example #9
0
    def __init__(self,parent):
        super(HelpDialog,self).__init__(parent)

        title = _("A bit of help")
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title,self)
        top_layout.addWidget(self.title_widget)

        browser = QTextBrowser()

        import os.path
        from koi.Configurator import resource_dir

        with open( os.path.join(resource_dir,"manual.html"), encoding='utf-8') as input:
            html = input.read()
        browser.setHtml(html)

        # browser.setLineWrapMode(QTextEdit.NoWrap)
        #         browser.setHtml("""<h1>Tables</h1>
        #
        # In tables you can edit, don't forget these few useful shortcuts :
        # <ul>
        # <li><b>F5</b> : will insert a line under your cursor</li>
        # <li><b>Shift + F5</b> : will append a line at the end of the table</li>
        # <li><b>F8</b> : will delete the line under your cursor (if you're allowed to)</li>
        # <li><b>F1</b> and <b>Shift + F1</b> : will allow you to move up/move down a row </li>
        # </ul>
        # """)
        # browser.setMinimumWidth(browser.document().documentLayout().documentSize().toSize().width())
        browser.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        top_layout.addWidget(browser)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton( QDialogButtonBox.Ok)

        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
Example #10
0
    def __init__(self, parent):
        global dao
        super(ChooseSupplierDialog, self).__init__(parent)

        title = _("Choose supplier")
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title, self)
        top_layout.addWidget(self.title_widget)

        self.supplier_plate_widget = SupplierContactDataWidget(self)
        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton(QDialogButtonBox.Ok)

        hlayout = QHBoxLayout()

        # suppliers = dao.supplier_dao.all_frozen()
        suppliers = generic_load_all_frozen(Supplier, Supplier.fullname)

        table_prototype = [
            TextLinePrototype('fullname', _('Name'), editable=False)
        ]
        self.filter_view = QuickPrototypedFilter(table_prototype, self)
        self.filter_view.selected_object_changed.connect(
            self.supplier_plate_widget.set_contact_data)
        self.filter_view.set_data(suppliers, lambda c: c.indexed_fullname)

        hlayout.addWidget(self.filter_view)
        hlayout.addWidget(self.supplier_plate_widget, 1000)
        # hlayout.addStretch()
        top_layout.addLayout(hlayout)

        #top_layout.addStretch()
        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        self.filter_view.list_view.doubleClicked.connect(self._item_selected)
Example #11
0
    def __init__(self, *args, **kwargs):

        super(Widget_textEdit_splitter, self).__init__(*args, **kwargs)
        self.installEventFilter(self)
        mainLayout = QVBoxLayout(self)

        w_convertButton = QWidget()
        lay_convertButton = QHBoxLayout(w_convertButton)
        label_orig = QLabel("Original")
        label_orig.setAlignment(QtCore.Qt.AlignCenter)
        label_convert = QLabel("Converted")
        label_convert.setAlignment(QtCore.Qt.AlignCenter)
        button = QPushButton(" >> ")
        lay_convertButton.addWidget(label_orig)
        lay_convertButton.addWidget(button)
        lay_convertButton.addWidget(label_convert)
        w_convertButton.setStyleSheet("font-size:13px")
        sizePolicy = QSizePolicy()
        sizePolicy.setVerticalPolicy(QSizePolicy.Fixed)
        sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding)
        w_convertButton.setSizePolicy(sizePolicy)

        splitter = QSplitter()
        splitter.setStretchFactor(1, 1)

        textEdit_left = QTextEdit()
        textEdit_right = QTextEdit()
        splitter.addWidget(textEdit_left)
        splitter.addWidget(textEdit_right)

        textEdit_left.setLineWrapMode(QTextEdit.NoWrap)
        textEdit_right.setLineWrapMode(QTextEdit.NoWrap)

        mainLayout.addWidget(w_convertButton)
        mainLayout.addWidget(splitter)

        self.textEdit_left = textEdit_left
        self.textEdit_right = textEdit_right

        button.clicked.connect(self.load_convertedText)
Example #12
0
    def __init__(self):

        QWidget.__init__(self)

        self.title = u"执行列表"
        self.__service = RunDefService()
        self.__threads = []

        # Model
        self.__model = RunDefModel()
        self.__model.usr_set_definition(def_view_run_def)

        # Control
        _control = RunDefControl(def_view_run_def)

        # Data result display widget
        _wid_display = ViewTree()
        _wid_display.set_model(self.__model)
        _wid_display.set_control(_control)

        # Buttons window
        _wid_buttons = ViewButtons([
            dict(id="add", name=u'增加'),
            dict(id="delete", name=u"删除"),
            dict(id="search", name=u'查询'),
            dict(id="run", name=u"执行")
        ])

        # Layout
        _layout = QVBoxLayout()
        _layout.addWidget(_wid_display)
        _layout.addWidget(_wid_buttons)

        self.setLayout(_layout)

        _layout.setContentsMargins(0, 0, 0, 0)

        _wid_display.clicked.connect(self.__model.usr_set_current_data)
        _wid_buttons.sig_clicked.connect(self.__operate)
        _wid_display.clicked.connect(self.select)
    def initUI(self):
        """
		Initializes UI. Creates a horizontal layout
		to which buttons can be added.
		"""
        if self._osx:
            # Mimic the style of buttons underneath a list view
            gradient = QLinearGradient()
            gradient.setStart(0, 0)
            gradient.setFinalStop(0, self.Height)

            colorTop = QColor(250, 250, 250, 255)
            colorMid = QColor(244, 244, 244, 255)
            colorInBetween = QColor(238, 238, 238, 255)
            colorMidLow = QColor(234, 234, 234, 255)
            colorLow = QColor(239, 239, 239, 255)
            gradient.setColorAt(0, colorTop)
            gradient.setColorAt(0.45, colorMid)
            gradient.setColorAt(0.5, colorInBetween)
            gradient.setColorAt(0.55, colorMidLow)
            gradient.setColorAt(1, colorLow)

            brush = QBrush(gradient)
            palette = QPalette()
            palette.setBrush(QPalette.Background, brush)

            self.setAutoFillBackground(True)
            self.setPalette(palette)

        # Use a horizontal layout in which to keep
        # buttons. Initialize with an empty QWidget to
        # make the buttons align to the left
        if self.orientation == Qt.Horizontal:
            self.layout = QHBoxLayout()
        else:
            self.layout = QVBoxLayout()
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.addWidget(QWidget())
        self.setLayout(self.layout)
Example #14
0
 def __init__(self,
              loadIcon="loading_bar",
              primaryMessage="Please, Wait",
              message='',
              parent=None):
     super(LoadingWidget, self).__init__(parent)
     self.finished.connect(self._updateUI)
     self.setStyleSheet("""
   QWidget {
     background-color: #ffffff
   }
 """)
     self._icon_load = loadIcon
     self._primary_message = primaryMessage
     self._label_message = QLabel(message)
     self._label_message.setWordWrap(True)
     self._label_message.setAlignment(Qt.AlignCenter)
     self._label_primary_message = QLabel(self._primary_message)
     self._label_primary_message.setStyleSheet("""
   QLabel {
     font-size: 20px;
     font-weight:bold;
     color: rgb(65,65,65);
   }
 """)
     self._label_primary_message.setAlignment(Qt.AlignCenter)
     self._label_movie = QLabel()
     self._label_movie.setAlignment(Qt.AlignCenter)
     self._movie = QMovie(self._icon_load)
     self._label_movie.setMovie(self._movie)
     self._movie.start()
     layout = QVBoxLayout()
     layout.addWidget(self._label_primary_message)
     layout.addSpacing(5)
     layout.addWidget(self._label_message)
     layout.addSpacing(5)
     layout.addWidget(self._label_movie)
     layout.addStretch()
     #self._setupAnimation() # this should be done after showing everything to get correct geometries
     self.setLayout(layout)
Example #15
0
    def __init__(self):

        QWidget.__init__(self)

        self.title = u"用例管理"

        # Model
        self.__model = PageSelectModel()
        self.__model.usr_set_definition(def_view_page_def)

        # Control
        _control = PageSelectControl(def_view_page_def)

        # Search condition widget
        self.__wid_search_cond = ViewSearch(def_view_page_def)
        self.__wid_search_cond.set_col_num(2)
        self.__wid_search_cond.create()

        # Data result display widget
        _wid_display = ViewTable()
        _wid_display.set_model(self.__model)
        _wid_display.set_control(_control)

        # Buttons widget
        _wid_buttons = ViewButtons([dict(id="search", name=u"查询")])

        # win_add
        self.__win_add = ViewAdd(def_view_page_def)

        # Layout
        _layout = QVBoxLayout()
        _layout.addWidget(self.__wid_search_cond)
        _layout.addWidget(_wid_display)
        _layout.addWidget(_wid_buttons)

        self.setLayout(_layout)

        # Connection
        _wid_buttons.sig_clicked.connect(self.__operate)
        _wid_display.doubleClicked.connect(self.select)
Example #16
0
    def __init__(self, parent):
        super(PickerTypeDialog, self).__init__(parent)

        self.pickerType = None

        self.pickerTypes = [(SurfaceType, "Surface picker"),
                            (TwoStepType, "Two step picker")]

        self.radioButtons = []
        for picker in self.pickerTypes:
            self.radioButtons.append(QRadioButton(picker[1]))
        # self.radioButtons[0].setChecked(True)
        self.buttonGroup = QButtonGroup()
        ind = 0
        for button in self.radioButtons:
            self.buttonGroup.addButton(button)
            self.buttonGroup.setId(button, ind)
            ind += 1

        self.nextButton = QPushButton("Choose")
        self.nextButton.clicked.connect(self.choose)
        self.cancelButton = QPushButton("Cancel")
        self.cancelButton.clicked.connect(self.cancel)

        groupLayout = QVBoxLayout()
        for radioButton in self.radioButtons:
            groupLayout.addWidget(radioButton)

        self.groupBox = QGroupBox("Choose picker type:")
        self.groupBox.setLayout(groupLayout)

        self.setModal(True)

        layout = QGridLayout()
        layout.setAlignment(Qt.AlignTop)
        layout.addWidget(self.groupBox, 0, 0, 1, 2)
        layout.addWidget(self.cancelButton, 1, 0)
        layout.addWidget(self.nextButton, 1, 1)
        self.setLayout(layout)
Example #17
0
    def __init__(self, res):
        QWidget.__init__(self)
        self.res = res
        layout = QVBoxLayout()
        self.setLayout(layout)
        preview = QLabel()
        if 'image' in res.mime:
            pixmap = QPixmap(res.file_path).scaledToWidth(32)

        else:
            info = QFileInfo(res.file_path)
            pixmap = QFileIconProvider().icon(info).pixmap(32, 32)
        preview.setPixmap(pixmap)
        preview.setMask(pixmap.mask())
        preview.setMaximumHeight(32)
        label = QLabel()
        label.setText(res.file_name)
        layout.addWidget(preview)
        layout.addWidget(label)
        layout.setAlignment(Qt.AlignHCenter)
        self.setFixedWidth(64)
        self.setFixedHeight(64)
Example #18
0
    def __init__(self, parent=None):
        super().__init__(parent)
        self._text_edit = QTextEdit()
        self._open_button = QPushButton(self.tr("&Open"))
        self._save_button = QPushButton(self.tr("&Save"))
        self._exit_button = QPushButton(self.tr("&Exit"))

        button_layout = QVBoxLayout()
        button_layout.addWidget(self._open_button)
        button_layout.addWidget(self._save_button)
        button_layout.addWidget(self._exit_button)
        button_layout.addStretch()

        main_layout = QHBoxLayout()
        main_layout.addWidget(self._text_edit)
        main_layout.addLayout(button_layout)
        self.setLayout(main_layout)

        self.setWindowTitle(self.tr('Notepad'))
        self._save_button.clicked.connect(self.save)
        self._open_button.clicked.connect(self.open)
        self._exit_button.clicked.connect(self.exit)
Example #19
0
    def __init__(self, parent=None, opc=None):
        super(Configuration, self).__init__()
        self.layout = QVBoxLayout(self)

        # TagSelection() is inited before Server() but added later (inited)
        self.tag_selection = TagSelecion(self, opc)

        self.server = Server(self, opc, self.tag_selection)
        self.layout.addWidget(self.server)

        # TagSelection() is instanced before Server() but added later (added)
        self.layout.addWidget(self.tag_selection)

        self.read_options = ReadOptions(self)
        self.read_options.setEnabled(False)
        self.layout.addWidget(self.read_options)

        self.logging_options = LoggingOptions()
        self.logging_options.setEnabled(False)
        self.layout.addWidget(self.logging_options)

        self.setLayout(self.layout)
Example #20
0
    def __init__(self, parent=None, opc=None):
        super(TagSelecion, self).__init__()

        self.opc = opc

        self.setTitle('Tag Selection')

        self.layout = QVBoxLayout(self)

        self.button_refresh = QPushButton('Refresh', self)
        self.button_refresh.clicked.connect(self._refresh)
        self.layout.addWidget(self.button_refresh)

        self.button_all = QPushButton('Select All', self)
        self.button_all.clicked.connect(self._select_all)
        self.layout.addWidget(self.button_all)

        self.button_none = QPushButton('Select None', self)
        self.button_none.clicked.connect(self._select_none)
        self.layout.addWidget(self.button_none)

        self.hbox_pattern = QHBoxLayout(self)
        self.button_pattern = QPushButton('Toggle Pattern', self)
        self.button_pattern.clicked.connect(self._toggle_pattern)
        self._next_toggle = 'select'
        self.hbox_pattern.addWidget(self.button_pattern)
        self.le_pattern = QLineEdit(self)
        self.le_pattern.setPlaceholderText('Pattern')
        self.hbox_pattern.addWidget(self.le_pattern)
        self.layout.addLayout(self.hbox_pattern)

        self.label = QLabel('Select Tags', self)
        self.layout.addWidget(self.label)

        self.listw_tags = QListWidget(self)
        self.listw_tags.setSelectionMode(QAbstractItemView.MultiSelection)
        self.layout.addWidget(self.listw_tags)

        self.setLayout(self.layout)
Example #21
0
 def layoutWidgets(self):
     grid = QGridLayout()
     grid.addWidget(self.romanStartLabel, 0, 0)
     grid.addWidget(self.romanStartSpinBox, 0, 1)
     grid.addWidget(self.romanEndLabel, 0, 2)
     grid.addWidget(self.romanEndSpinBox, 0, 3)
     grid.addWidget(self.romanChangeLabel, 0, 4)
     grid.addWidget(self.romanChangeSpinBox, 0, 5)
     grid.addWidget(self.decimalStartLabel, 1, 0)
     grid.addWidget(self.decimalStartSpinBox, 1, 1)
     grid.addWidget(self.decimalEndLabel, 1, 2)
     grid.addWidget(self.decimalEndSpinBox, 1, 3)
     grid.addWidget(self.decimalChangeLabel, 1, 4)
     grid.addWidget(self.decimalChangeSpinBox, 1, 5)
     hbox = QHBoxLayout()
     hbox.addLayout(grid)
     hbox.addStretch()
     layout = QVBoxLayout()
     layout.addLayout(hbox)
     layout.addStretch()
     layout.addWidget(self.buttonBox)
     self.setLayout(layout)
Example #22
0
    def createWidgets(self):
        self.listWidget = QListWidget()
        self.buttonLayout = QVBoxLayout()
        for icon, text, slot, tip in ((":/add.svg", "&Add", self.add, """\
<p><b>Add</b></p><p>Add an item to the {}
list.</p>""".format(self.info.name)), (":/edit.svg", "&Edit", self.edit, """\
<p><b>Edit</b></p><p>Edit the {} list's current
item.</p>""".format(self.info.name)), (":/delete.svg", "&Remove...",
                                       self.remove, """\
<p><b>Remove</b></p><p>Remove the {} list's current
item.</p>""".format(self.info.name)), (":/help.svg", "Help", self.help, """\
Help on the {} dialog""".format(self.info.name)), (":/dialog-close.svg",
                                                   "&Close", self.accept, """\
<p><b>Close</b></p><p>Close the dialog.</p>""")):
            button = QPushButton(QIcon(icon), text)
            button.setFocusPolicy(Qt.NoFocus)
            if text in {"&Close", "Help"}:
                self.buttonLayout.addStretch()
            self.buttonLayout.addWidget(button)
            button.clicked.connect(slot)
            self.tooltips.append((button, tip))
        self.tooltips.append((self.listWidget, self.info.desc))
Example #23
0
 def __init__(self, kind, module, parent=None):
     super(DefaultsDialog, self).__init__()
     self.clipboard = parent.clipboard
     self.setWindowTitle("%s : %s" % (kind, module))
     self.setGeometry(0, 0, 500, 500)
     self.move(
         QApplication.desktop().screenGeometry().center() - self.rect().center())
     self.show()
     # Main layout
     self.layout = QVBoxLayout()
     self.setLayout(self.layout)
     self.display_tabs = QTabWidget()
     self.display = {}
     for k in ["yaml", "python", "bibliography"]:
         self.display[k] = QTextEdit()
         self.display[k].setLineWrapMode(QTextEdit.NoWrap)
         self.display[k].setFontFamily("mono")
         self.display[k].setCursorWidth(0)
         self.display[k].setReadOnly(True)
         self.display_tabs.addTab(self.display[k], k)
     self.layout.addWidget(self.display_tabs)
     # Fill text
     defaults_txt = get_default_info(
         module, kind, return_yaml=True, fail_if_not_found=True)
     from cobaya.yaml import yaml_load
     self.display["python"].setText(
         "from collections import OrderedDict\n\ninfo = " +
         pformat(yaml_load(defaults_txt)))
     self.display["yaml"].setText(defaults_txt)
     self.display["bibliography"].setText(get_bib_module(module, kind))
     # Buttons
     self.buttons = QHBoxLayout()
     self.close_button = QPushButton('Close', self)
     self.copy_button = QPushButton('Copy to clipboard', self)
     self.buttons.addWidget(self.close_button)
     self.buttons.addWidget(self.copy_button)
     self.close_button.released.connect(self.close)
     self.copy_button.released.connect(self.copy_clipb)
     self.layout.addLayout(self.buttons)
Example #24
0
    def __init__(self, workspace, parent=None):
        super(NewState, self).__init__(parent)

        # initialization

        self.state_record = None  # output

        self._workspace = workspace

        self._name_edit = None  # type: QLineEdit
        self._base_state_combo = None  # type: QStateComboBox
        self._mode_combo = None  # type: QComboBox
        self._editor = None  # type: QTextEdit
        self._ok_button = None

        self.setWindowTitle('New State')

        self.main_layout = QVBoxLayout()

        self._init_widgets()

        self.setLayout(self.main_layout)
Example #25
0
    def __init__(self, file_path, parent=None):
        super(LoadBinary, self).__init__(parent)

        # initialization
        self.file_path = file_path
        self.option_widgets = {}

        # return values
        self.cfg_args = None
        self.load_options = None

        self.setWindowTitle('Load a new binary')

        self.main_layout = QVBoxLayout()

        self._init_widgets()

        self._try_loading()

        self.setLayout(self.main_layout)

        self.show()
Example #26
0
    def __init__(self):

        QWidget.__init__(self)

        self.__path = None
        self.__step_length = 0

        self.title = u"执行"

        # Model
        self.__model = RunDetModel()
        self.__model.usr_set_definition(def_view_run_det)

        # Control
        _control = RunDetControl(def_view_run_det)

        # Data result display widget
        _wid_display = ViewTree()
        _wid_display.set_model(self.__model)
        _wid_display.set_control(_control)

        # 进度条
        self.__progress = OrcProcess()

        # 底部按钮及进度条
        _layout_bottom = QHBoxLayout()
        _layout_bottom.addWidget(self.__progress)

        # Layout
        _layout = QVBoxLayout()
        _layout.addWidget(_wid_display)
        _layout.addLayout(_layout_bottom)

        self.setLayout(_layout)

        self.__thread_status = StatusReceiver()
        self.__thread_status.start()

        self.__thread_status.sig_status.connect(self.update_data)
Example #27
0
    def __init__(self, parent, widget):
        """Construct an OverlayDialog with the given Qt GUI parent and
           displaying the given widget.
        """
        super(OverlayDialog, self).__init__(parent, Qt.SplashScreen)

        self.setAcceptDrops(True)

        self.setAttribute(Qt.WA_TranslucentBackground)
        bgcolor = self.palette().color(QPalette.Background)
        self.setPalette(
            QColor(bgcolor.red(), bgcolor.green(), bgcolor.blue(), 0))  # alpha

        self.setModal(True)

        layout = QVBoxLayout(self)
        layout.setAlignment(Qt.AlignCenter)
        layout.addWidget(widget)
        self.setLayout(layout)

        self.resize(0.8 * parent.size().width(), 0.8 * parent.size().height())
        widget.resize(self.width(), self.height())
Example #28
0
    def __init__(self, parent):
        super(AskIPAddress, self).__init__()

        layout = QVBoxLayout(self)
        layout.addWidget(QLabel("Please enter a valid address"))

        glayout = QGridLayout()

        self.address = QLineEdit()
        glayout.addWidget(QLabel("IP Address"), 0, 0)
        glayout.addWidget(self.address, 0, 1)

        self.address.setText(guess_server_public_ip())
        layout.addLayout(glayout)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        layout.addWidget(self.buttons)

        self.setLayout(layout)

        self.buttons.accepted.connect(self.accept)
Example #29
0
    def __init__(self, *args, **kwrgs):

        existing_widgets = Window.mayaWin.findChildren(QDialog,
                                                       Window.objectName)
        if existing_widgets: map(lambda x: x.deleteLater(), existing_widgets)

        super(Window, self).__init__(*args, **kwrgs)

        self.installEventFilter(self)
        self.setObjectName(Window.objectName)
        self.setWindowTitle(Window.title)
        mainLayout = QVBoxLayout(self)

        w_splitter = Widget_splitter(QtCore.Qt.Vertical)
        w_typeAttrList = Widget_TypeAttributeList()
        w_fileTree = Widget_FileTree()
        button_refresh = QPushButton("REFRESH".decode('utf-8'))
        button_refresh.setStyleSheet("font-size:13px")

        w_splitter.addWidget(w_typeAttrList)
        w_splitter.addWidget(w_fileTree)

        mainLayout.addWidget(w_splitter)
        mainLayout.addWidget(button_refresh)
        button_refresh.setFocus()

        self.w_typeAttrList = w_typeAttrList
        self.w_fileTree = w_fileTree

        self.resize(Window.defaultWidth, Window.defaultHeight)
        self.load_shapeInfo(Window.path_uiInfo)

        QtCore.QObject.connect(button_refresh, QtCore.SIGNAL("clicked()"),
                               self.w_fileTree.loadList)
        self.w_fileTree.w_typeAttrList = self.w_typeAttrList
        self.w_fileTree.loadList()

        self.w_typeAttrList.appendCheckEventCommands(self.w_fileTree.loadList)
        w_splitter.loadSplitterPosition()
Example #30
0
    def __init__(self):
        super(window, self).__init__()

        self.resize(1024,720)
        self.centralWidget = QWidget(self)
        self.setWindowTitle('Plotting Points (Google Maps)')
        
        self.layout = QHBoxLayout(self.centralWidget)
        
        self.frame = QFrame(self.centralWidget)
        self.frameLayout = QVBoxLayout(self.frame)
        
        self.web = QtWebKit.QWebView()
        
        group_left = QGroupBox('Data Preparation')
        groupLeft_layout = QGridLayout()
        
        self.openButton = QPushButton("Open file")
        self.openButton.clicked.connect(self.openfile)
        
        self.optUTM = QCheckBox('UTM Data')
        
        
        groupLeft_layout.addWidget(self.optUTM,0,0)
        groupLeft_layout.addWidget(self.openButton,1,0)
        
        groupLeft_layout.setRowStretch(2,1)
        group_left.setLayout(groupLeft_layout)
        
        self.frameLayout.addWidget(self.web)
        self.layout.addWidget(group_left)
        self.layout.addWidget(self.frame)
        self.layout.setStretch(1,1)
        self.setCentralWidget(self.centralWidget)
        
        url = 'http://maps.google.com'
        
        self.showMap(url)