def __init__(self, parent, remote_documents_service): super(NonconformitiesWidget, self).__init__(parent) self._track_changes = True self._current_qe = None self._change_tracker = ChangeTracker(Base) self.order_part_id = None self.quality_events = InstrumentedRelation() top_layout = QVBoxLayout() top_layout.addWidget(QLabel(u"<h3>{}</h3>".format( _("Non conformity")))) control_layout = QHBoxLayout() self.quality_issue_chooser = QComboBox(self) # self.quality_issue_chooser.addItems(["a","b"]) # self.quality_issue_chooser.activated.connect(self.set_quality_issue) self.quality_issue_chooser.currentIndexChanged.connect( self.set_quality_issue) self.add_quality_issue_button = QPushButton(_("Add")) self.remove_quality_issue_button = QPushButton(_("Remove")) self.add_quality_issue_button.clicked.connect(self.add_quality_issue) self.remove_quality_issue_button.clicked.connect( self.remove_quality_issue) control_layout.addWidget(self.quality_issue_chooser) control_layout.addWidget(self.add_quality_issue_button) control_layout.addWidget(self.remove_quality_issue_button) control_layout.setStretch(0, 1) top_layout.addLayout(control_layout) horizontalLine = QFrame(self) horizontalLine.setFrameStyle(QFrame.HLine) # horizontalLine.setMinimumHeight(1) # seems useless # horizontalLine.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Minimum) # seems useless top_layout.addWidget(horizontalLine) self.nc_edit = Nonconformity2Widget(self, remote_documents_service) self.nc_edit.issue_changed.connect(self._issue_edited_slot) top_layout.addWidget(self.nc_edit) self.setLayout(top_layout)
def __init__(self): QWidget.__init__(self) self.title = u"Web对象管理" # Page _page = PageContainer() # Window _window = ViewWindow() # Widget _widget = WidgetContainer() # 页面 tab _tab = QTabWidget() _tab.addTab(_page, _page.title) _tab.addTab(_window, _window.title) _tab.addTab(_widget, _widget.title) _tab.setTabPosition(QTabWidget.West) _tab.setStyleSheet(get_theme("TabViewWeb")) # 测试区 self.__test = WidgetTest() self.__test.setStyleSheet(get_theme("TestWidget")) # 主layout _layout = QHBoxLayout() _layout.addWidget(_tab) _layout.addWidget(self.__test) _layout.setStretch(0, 5) _layout.setStretch(1, 1) _layout.setContentsMargins(0, 0, 0, 0) _layout.setSpacing(0) self.setLayout(_layout) # 信号 _page.sig_selected.connect(self.set_page) _widget.sig_selected.connect(self.set_widget) self.__test.sig_exec.connect(self.send)
def __init__(self, parent, remote_documents_service): super(Nonconformity2Widget, self).__init__(parent) self._track_changes = True self._current_qe = None top_layout = QVBoxLayout() self._quality_event_prototype = QualityEventTypePrototype( "kind", _("Kind")) self._quality_event_type_widget = self._quality_event_prototype.edit_widget( self) self._quality_event_type_widget.activated.connect( self.event_type_changed) self._type_label = QLabel(_("Type :")) hlayout = QHBoxLayout() hlayout.addWidget(self._type_label) hlayout.addWidget(self._quality_event_prototype.edit_widget(self)) hlayout.setStretch(0, 0) hlayout.setStretch(1, 1) top_layout.addLayout(hlayout) # self.comments_widget = CommentsWidget(self, self._change_tracker) self.comments_widget = QTextEdit(self) self.comments_widget.textChanged.connect(self.comment_changed) self._description_label = QLabel(_("Description :")) top_layout.addWidget(self._description_label) top_layout.addWidget(self.comments_widget) self.documents = DocumentCollectionWidget( parent=self, doc_service=remote_documents_service, used_category_short_name='Qual.', no_header=True) self.documents.documents_list_changed.connect( self._documents_changed_slot) top_layout.addWidget(self.documents) top_layout.addStretch() self._enable_editing() self.setLayout(top_layout)
def __init__(self): QMainWindow.__init__(self) # filename = QFileDialog.getOpenFileName(self, "Open File")[0] # self.setWindowTitle(os.path.basename(filename)) # self.transcript = StepperTranscript(filename) self.transcript = None self.outer_widget = QWidget() self.setCentralWidget(self.outer_widget) outer_layout = QHBoxLayout() self.outer_widget.setLayout(outer_layout) self.setLayout(outer_layout) left_layout = QVBoxLayout() outer_layout.addLayout(left_layout) display_widget = QWidget() left_layout.addWidget(display_widget) self.display_layout = QHBoxLayout() # self.turn = self.transcript.current_turn() self.time_field = qHotField("time", str, "00:00:00", min_size=75, max_size=75, pos="top", handler=self.update_time) self.display_layout.addWidget(self.time_field) self.speaker_field = qHotField("speaker", str, " ", min_size=75, max_size=75, pos="top", handler=self.update_speaker) self.display_layout.addWidget(self.speaker_field) self.utt_field = qHotField("utterance", str, " ", min_size=350, pos="top", handler=self.update_utterance, multiline=True) self.utt_field.setStyleSheet("font: 14pt \"Courier\";") # self.utt_field.efield.setFont(QFont('SansSerif', 12)) self.display_layout.addWidget(self.utt_field) display_widget.setLayout(self.display_layout) self.display_layout.setStretchFactor(self.speaker_field, 0) self.display_layout.setStretchFactor(self.utt_field, 1) self.transcript_slider = QSlider(QtCore.Qt.Horizontal, self) self.display_layout.addWidget(self.transcript_slider) self.transcript_slider.setMaximum(100) self.connect(self.transcript_slider, QtCore.SIGNAL("sliderMoved(int)"), self.position_transcript) left_layout.addWidget(self.transcript_slider) button_widget = TranscriptButtons(self) left_layout.addWidget(button_widget) left_layout.addWidget(QWidget()) left_layout.setStretch(0, 0) left_layout.setStretch(1, 0) left_layout.setStretch(2, 0) left_layout.setStretch(3, 1) # video_buttons = VideoButtons(self) # outer_layout.addWidget(video_buttons) self.createKeypadButtons(self) left_layout.addWidget(self.keypadWidget) self.player = Player() outer_layout.addWidget(self.player) outer_layout.setStretch(0, 0) outer_layout.setStretch(1, 1) self.save_file_name = None command_list = [ [self.open_video, "Open Video", {}, "Ctrl+o"], [self.open_transcript, "Open Transcript", {}, "Ctrl+t"], [self.play_or_pause, "Play/Pause", {}, Qt.CTRL + Qt.Key_P], [self.save_file, "Save", {}, "Ctrl+s"], [self.player.jump_video_backward, "Jump Back", {}, Qt.CTRL + Qt.Key_4], [self.player.jump_video_forward, "Jump Forward", {}, Qt.CTRL + Qt.Key_6], [self.go_to_previous_turn, "Previous", {}, "Ctrl+["], [self.go_to_next_turn, "Next", {}, "Ctrl+]"], ] menubar = self.menuBar() create_menu(self, menubar, "Stepper", command_list) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_0), self, self.play_or_pause) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_5), self, self.play_or_pause) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_7), self, self.go_to_previous_turn) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_9), self, self.go_to_next_turn) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_4), self, self.player.jump_video_backward) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_6), self, self.player.jump_video_forward) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_2), self, self.player.reset_rate) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_1), self, self.player.decrease_rate) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_3), self, self.player.increase_rate) QShortcut(QKeySequence(Qt.CTRL + Qt.Key_G), self, self.sync_video_and_play)
def __init__(self, parent): super(EditSupplyOrderPanel, self).__init__(parent) self.current_supply_order_id = None self.proto = [] self.proto.append( TextAreaPrototype('description', _('Description'), editable=True, nullable=False)) self.proto.append( FloatNumberPrototype('quantity', _('Quantity'), editable=True, nullable=False)) self.proto.append( FloatNumberPrototype('unit_price', _('Unit price'), editable=True, nullable=True)) self.delivery_date_prototype = FutureDatePrototype('description', ('Description'), editable=True, nullable=False) self.model = SupplyOrderPartsModel(self, self.proto) self.controller_part = PrototypeController( self, self.proto, ProxyTableView(None, self.proto)) self.controller_part.setModel(self.model) # self.controller_part.view.verticalHeader().hide() self.controller_part.view.horizontalHeader().setResizeMode( 0, QHeaderView.Stretch) self.print_supply_order_action = QAction(_("Print supply order"), self) # , parent self.print_supply_order_action.triggered.connect( self.print_supply_order) self.print_supply_order_action.setShortcut( QKeySequence(Qt.CTRL + Qt.Key_P)) self.print_supply_order_action.setShortcutContext( Qt.WidgetWithChildrenShortcut) self.addAction(self.print_supply_order_action) self.save_supply_order_action = QAction(_("Save supply order"), self) # , parent self.save_supply_order_action.triggered.connect(self.save) self.save_supply_order_action.setShortcut( QKeySequence(Qt.CTRL + Qt.Key_S)) self.save_supply_order_action.setShortcutContext( Qt.WidgetWithChildrenShortcut) self.addAction(self.save_supply_order_action) self.delete_supply_order_action = QAction(_("Deactivate supply order"), self) # , parent self.delete_supply_order_action.triggered.connect(self.delete) self.addAction(self.delete_supply_order_action) self.next_order_for_supplier_action = QAction( _("Next supplier's order"), self) # , parent self.next_order_for_supplier_action.setShortcut( QKeySequence(Qt.CTRL + Qt.Key_PageDown)) self.next_order_for_supplier_action.setShortcutContext( Qt.WidgetWithChildrenShortcut) self.next_order_for_supplier_action.triggered.connect( self.next_order_for_supplier) self.addAction(self.next_order_for_supplier_action) self.previous_order_for_supplier_action = QAction( _("Previous supplier's order"), self) # , parent self.previous_order_for_supplier_action.setShortcut( QKeySequence(Qt.CTRL + Qt.Key_PageDown)) self.previous_order_for_supplier_action.setShortcutContext( Qt.WidgetWithChildrenShortcut) self.previous_order_for_supplier_action.triggered.connect( self.next_order_for_supplier) self.addAction(self.previous_order_for_supplier_action) self.change_supplier_action = QAction(_("Change supplier"), self) # , parent self.change_supplier_action.triggered.connect(self.change_supplier) self.addAction(self.change_supplier_action) # self.controller_operation.view.addAction(self.reprint_delivery_slip) self.controller_part.view.addAction(self.print_supply_order_action) self.controller_part.view.addAction(self.save_supply_order_action) self.controller_part.view.addAction(self.delete_supply_order_action) navigation = NavBar(self, [(self.next_order_for_supplier_action.text(), self.next_order_for_supplier), (self.previous_order_for_supplier_action.text(), self.previous_order_for_supplier), (_("Action"), self.show_actions)]) navigation.buttons[2].setObjectName("specialMenuButton") self.action_menu = QMenu(navigation.buttons[2]) list_actions = [(self.print_supply_order_action, None), (self.save_supply_order_action, None), (self.delete_supply_order_action, None), (self.change_supplier_action, None)] populate_menu(self.action_menu, self, list_actions, context=Qt.WidgetWithChildrenShortcut) self.title_widget = TitleWidget(_("Supply order"), self, navigation) self.supplier_plate_widget = SupplierPlateWidget(self) self.edit_comment_widget = DescribedTextEdit(_("Comments")) self.edit_comment_widget.setMinimumHeight(20) self.edit_comment_widget.setMinimumWidth(600) self.edit_comment_widget.setMaximumHeight(60) self.edit_comment_widget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.supplier_reference_widget = QLineEdit() self.delivery_date_widget = DateEntryWidget() self.delivery_date_widget.setMaximumWidth(100) self.creation_date_widget = QLabel() self.in_title_label = QLabel() top_layout1 = QHBoxLayout() top_layout1.addWidget(self.in_title_label) top_layout1.addStretch() top_layout1.addWidget(self.supplier_plate_widget) hlayout = QHBoxLayout() hlayout.addWidget(QLabel(_("Delivery date"))) hlayout.addWidget(self.delivery_date_widget) hlayout.addStretch() hlayout3 = QHBoxLayout() hlayout3.addWidget(QLabel(_("Creation date"))) hlayout3.addWidget(self.creation_date_widget) hlayout3.addStretch() hlayout2 = QHBoxLayout() hlayout2.addWidget(QLabel(_("Supplier's reference"))) hlayout2.addWidget(self.supplier_reference_widget) hlayout2.addStretch() vlayout = QVBoxLayout() vlayout.addLayout(hlayout) # delivery date vlayout.addLayout(hlayout3) # creation date vlayout.addLayout(hlayout2) # reference vlayout.addStretch() top_layout2 = QHBoxLayout() top_layout2.addLayout(vlayout) top_layout2.addWidget(self.edit_comment_widget) top_layout2.addStretch() top_layout2.setStretch(0, 0) top_layout2.setStretch(1, 0) # For some reason, the stretch added above is not enough # to push the whole layout to the left. I have to set # it's stretch factor too... top_layout2.setStretch(2, 100) vhead_layout = QVBoxLayout() vhead_layout.addWidget(self.title_widget) top_layout1.setContentsMargins(4, 0, 4, 0) # vhead_layout.addLayout(top_layout1) vhead_layout.addWidget(InlineSubFrame(top_layout1, None)) vhead_layout.addLayout(top_layout2) # top_layout2.setContentsMargins(4,4,4,4) #vhead_layout.addWidget(InlineSubFrame(top_layout2,None)) vhead_layout.addWidget(self.controller_part.view) vhead_layout.setStretch(0, 0) vhead_layout.setStretch(1, 0) vhead_layout.setStretch(2, 0) vhead_layout.setStretch(3, 10) self.setLayout(vhead_layout) self.controller_part.view.enable_edit_panel() # Handling changes in the model (helpful to know if saving # is necessary) self.model_data_changed = False self.model.rowsInserted.connect(self.data_changed_slot) self.model.rowsRemoved.connect(self.data_changed_slot) self.model.dataChanged.connect(self.data_changed_slot) self.supplier_reference_widget.textChanged.connect( self.data_changed2_slot) self.edit_comment_widget.textChanged.connect(self.data_changed2_slot) self.delivery_date_widget.textChanged.connect(self.data_changed2_slot)
class window(QMainWindow): 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) def openfile(self): fname, _ = QFileDialog.getOpenFileName(self, 'Open file', '/home') if fname: f = open(fname) with f: data = f.read().splitlines() self.plottomap(data) else: print 'a' def dataConst(self,dataline): coord_list = [] for data in dataline: catch_data = map(float, data.strip().split()) coord_list.append(tuple(catch_data)) if self.optUTM.isChecked() == True: coord_list = self.UTMtoLatLon(coord_list) return coord_list def plottomap(self,data): coords_data = self.dataConst(data) mymap = pygmaps.maps(coords_data[0][0], coords_data[0][1], 6) for i, point in enumerate(coords_data): mymap.addpoint(point[0], point[1], "#FF0000") mymap.addpath(coords_data, '#0000FF') mymap.draw('./mymap.draw.html') url = './mymap.draw.html' self.showMap(url) def UTMtoLatLon(self, utmData): utm_list = utmData latlon_list = [] for i in range(len(utm_list)-1): (lat, lon) = utm.to_latlon(utm_list[i][0], utm_list[i][1], 52, 'M') latlon_list.append((lat,lon)) return latlon_list def showMap(self, url): self.web.load(QtCore.QUrl(url)) self.web.show()
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(560, 560) sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) Form.setMinimumSize(QtCore.QSize(0, 0)) self.gridLayout_2 = QGridLayout(Form) self.gridLayout_2.setObjectName("gridLayout_2") self.editorGroupBox = QGroupBox(Form) sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.editorGroupBox.sizePolicy().hasHeightForWidth()) self.editorGroupBox.setSizePolicy(sizePolicy) self.editorGroupBox.setMinimumSize(QtCore.QSize(0, 0)) self.editorGroupBox.setObjectName("editorGroupBox") self.gridLayout_3 = QGridLayout(self.editorGroupBox) self.gridLayout_3.setObjectName("gridLayout_3") self.gridLayout = QGridLayout() self.gridLayout.setObjectName("gridLayout") self.variable_verticalLayout_1 = QVBoxLayout() self.variable_verticalLayout_1.setObjectName( "variable_verticalLayout_1") self.listBox = QListWidget(self.editorGroupBox) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.listBox.sizePolicy().hasHeightForWidth()) self.listBox.setSizePolicy(sizePolicy) self.listBox.setDragEnabled(True) self.listBox.setDragDropOverwriteMode(False) self.listBox.setDragDropMode(QAbstractItemView.InternalMove) self.listBox.setDefaultDropAction(QtCore.Qt.MoveAction) self.listBox.setAlternatingRowColors(True) self.listBox.setSelectionMode(QAbstractItemView.SingleSelection) self.listBox.setMovement(QListView.Snap) self.listBox.setResizeMode(QListView.Fixed) self.listBox.setSelectionRectVisible(False) self.listBox.setObjectName("listBox") self.variable_verticalLayout_1.addWidget(self.listBox) self.gridLayout.addLayout(self.variable_verticalLayout_1, 0, 0, 1, 1) self.variable_verticalLayout_2 = QVBoxLayout() self.variable_verticalLayout_2.setObjectName( "variable_verticalLayout_2") self.addButton = QPushButton(self.editorGroupBox) self.addButton.setObjectName("addButton") self.variable_verticalLayout_2.addWidget(self.addButton) self.editButton = QPushButton(self.editorGroupBox) self.editButton.setObjectName("editButton") self.variable_verticalLayout_2.addWidget(self.editButton) self.removeButton = QPushButton(self.editorGroupBox) self.removeButton.setObjectName("removeButton") self.variable_verticalLayout_2.addWidget(self.removeButton) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.variable_verticalLayout_2.addItem(spacerItem) self.upButton = QPushButton(self.editorGroupBox) self.upButton.setObjectName("upButton") self.variable_verticalLayout_2.addWidget(self.upButton) self.downButton = QPushButton(self.editorGroupBox) self.downButton.setObjectName("downButton") self.variable_verticalLayout_2.addWidget(self.downButton) spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.variable_verticalLayout_2.addItem(spacerItem1) self.variable_verticalLayout_2.setStretch(3, 1) self.variable_verticalLayout_2.setStretch(6, 1) self.gridLayout.addLayout(self.variable_verticalLayout_2, 0, 1, 1, 1) self.gridLayout.setColumnStretch(0, 1) self.gridLayout_3.addLayout(self.gridLayout, 0, 0, 1, 1) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setContentsMargins(15, 15, 15, 15) self.horizontalLayout.setObjectName("horizontalLayout") spacerItem2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem2) self.ok_pushButton = QPushButton(self.editorGroupBox) self.ok_pushButton.setObjectName("ok_pushButton") self.horizontalLayout.addWidget(self.ok_pushButton) self.cancel_pushButton = QPushButton(self.editorGroupBox) self.cancel_pushButton.setObjectName("cancel_pushButton") self.horizontalLayout.addWidget(self.cancel_pushButton) self.horizontalLayout.setStretch(0, 1) self.gridLayout_3.addLayout(self.horizontalLayout, 1, 0, 1, 1) self.gridLayout_2.addWidget(self.editorGroupBox, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): Form.setWindowTitle( QApplication.translate("Form", "Form", None, QApplication.UnicodeUTF8)) self.editorGroupBox.setTitle( QApplication.translate("Form", "Maya Module Path Editor", None, QApplication.UnicodeUTF8)) self.addButton.setText( QApplication.translate("Form", "<<", None, QApplication.UnicodeUTF8)) self.editButton.setText( QApplication.translate("Form", "Edit", None, QApplication.UnicodeUTF8)) self.removeButton.setText( QApplication.translate("Form", ">>", None, QApplication.UnicodeUTF8)) self.upButton.setText( QApplication.translate("Form", "Move Up", None, QApplication.UnicodeUTF8)) self.downButton.setText( QApplication.translate("Form", "Move Down", None, QApplication.UnicodeUTF8)) self.ok_pushButton.setText( QApplication.translate("Form", "Save", None, QApplication.UnicodeUTF8)) self.cancel_pushButton.setText( QApplication.translate("Form", "Close", None, QApplication.UnicodeUTF8))
def __init__(self, parent, find_order_action_slot): super(PresenceOverviewWidget, self).__init__(parent) self.set_panel_title(_("Presence overview")) self.base_date = date.today() headers = QStandardItemModel(1, 31 + 3) self._table_model = QStandardItemModel(1, 31 + 3, None) self.headers_view = QHeaderView(Qt.Orientation.Horizontal, self) self.header_model = headers self.headers_view.setResizeMode(QHeaderView.ResizeToContents) self.headers_view.setModel( self.header_model) # qt's doc : The view does *not* take ownership self.table_view = TableViewSignaledEvents(None) self.table_view.setModel(self._table_model) self.table_view.setHorizontalHeader(self.headers_view) self.table_view.verticalHeader().hide() self.table_view.setAlternatingRowColors(True) self.table_view.setEditTriggers(QAbstractItemView.NoEditTriggers) self.table_view.setContextMenuPolicy(Qt.CustomContextMenu) self.table_view.customContextMenuRequested.connect( self.popup_context_menu) self.copy_action = QAction(_("Copy order parts"), self.table_view) self.copy_action.triggered.connect(self.copy_slot) self.copy_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_C)) self.copy_action.setShortcutContext(Qt.WidgetWithChildrenShortcut) self.table_view.addAction(self.copy_action) self.select_all_action = QAction(_("Select all"), self.table_view) self.select_all_action.triggered.connect(self.select_all_slot) self.select_all_action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_A)) self.select_all_action.setShortcutContext( Qt.WidgetWithChildrenShortcut) self.table_view.addAction(self.select_all_action) # self.table_view.setSelectionBehavior(QAbstractItemView.SelectItems) # self.table_view.setSelectionMode(QAbstractItemView.SingleSelection) navbar = NavBar(self, [(_("Month before"), self.month_before), (_("Today"), self.month_today), (_("Action"), self.show_actions), (_("Month after"), self.month_after), (_("Find"), find_order_action_slot)]) self.action_menu = QMenu(navbar.buttons[2]) navbar.buttons[2].setObjectName("specialMenuButton") navbar.buttons[4].setObjectName("specialMenuButton") self._make_days_off_menu_and_action_group() list_actions = [ # (_("Edit"),self.edit_tars, None, None), (_("Edit"), self.edit_timetrack_no_ndx, None, None), (_("Month correction"), self.edit_month_correction, None, [RoleType.modify_monthly_time_track_correction]), (self.days_off_menu, None), (self.copy_action, None), (self.select_all_action, None) ] # (_("Insert holidays"),self.create_holidays, None, None), # (_("Delete holidays"),self.delete_holidays, None, None) ] populate_menu(self.action_menu, self, list_actions) # mainlog.debug("tile widget") self.title_box = TitleWidget(_("Presence Overview"), self, navbar) self.vlayout = QVBoxLayout(self) self.vlayout.setObjectName("Vlayout") self.vlayout.addWidget(self.title_box) self.hours_per_pers_subframe = SubFrame(_("Overview"), self.table_view, self) self.vlayout.addWidget(self.hours_per_pers_subframe) self.time_report_view = TimeReportView(self) self.days_off_panel = self._make_total_days_off_panel() vbox = QVBoxLayout() vbox.addWidget(self.days_off_panel) vbox.addStretch() vbox.setStretch(0, 0) vbox.setStretch(1, 1) hlayout = QHBoxLayout() hlayout.addWidget(self.time_report_view) hlayout.addLayout(vbox) hlayout.setStretch(0, 1) self.detail_subframe = SubFrame(_("Day"), hlayout, self) self.vlayout.addWidget(self.detail_subframe) self.setLayout(self.vlayout) # dbox = QVBoxLayout() # dbox.addWidget(QLabel("kjkljkj")) # self.total_active_hours = LabeledValue(_("Total activity")) # dbox.addWidget(self.total_active_hours) # hbox = QHBoxLayout() # hbox.addWidget(self.table_view) # hbox.addLayout(dbox) # self.selection_model = self.table_view.selectionModel() # mainlog.debug(m) #sm = QItemSelectionModel(self.table_view.model()) #sm.setModel(self.table_view.model()) # self.table_view.setSelectionModel(self.selection_model) self.table_view.selectionModel().currentChanged.connect( self.cell_entered) self.table_view.doubleClickedCell.connect(self.edit_timetrack)
def __init__ (self, lcvsa_dict, parent = None): QDialog.__init__(self) if isinstance(lcvsa_dict, dict): self._lcvsa_dict = lcvsa_dict else: self._lcvsa_dict = {lcvsa_dict.__class__.__name__+ "_1": lcvsa_dict} self._lcvsa = self._lcvsa_dict[self._lcvsa_dict.keys()[0]] # Get the various color maps from pylab self.color_maps=[m for m in pylab.cm.datad if not m.endswith("_r")] self.color_maps += ["AA_traditional_"] self.color_maps.sort() self.mplwin_list = [] # The list of matplotlib windows # Create the major frames. main_frame = QHBoxLayout() self._explorer_windows = [] leftWidget = QWidget() leftWidget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.setLayout(main_frame) main_frame.setContentsMargins(5, 5, 5, 5) left_frame = QVBoxLayout() left_frame.setContentsMargins(1, 1, 1, 1) left_frame.setSpacing(5) main_frame.addWidget(leftWidget) main_frame.setAlignment(leftWidget, QtCore.Qt.AlignTop) leftWidget.setLayout(left_frame) leftWidget.setMinimumSize(600, 750) leftWidget.setMaximumWidth(750) right_frame = qNotebook() # The right frame holds a qNotebook main_frame.addLayout(right_frame) self._lframe = left_frame self._main_frame = main_frame self._rframe = right_frame # Put a small frame at the top of the left frame to hold some checkboxes, and a pop list for selecting analyses self.top_left_frame = QVBoxLayout() left_frame.addLayout(self.top_left_frame) # Make the checkboxes self.inline = qHotField("Put images in the notebook", bool, False) self.top_left_frame.addWidget(self.inline) self.show_legends = qHotField("Show legends on charts", bool, True) self.top_left_frame.addWidget(self.show_legends) self.show_titles = qHotField("Show titles on charts", bool, True) self.top_left_frame.addWidget(self.show_titles) self.show_tables_in_explorer = qHotField("Show tables in explorer", bool, False) self.top_left_frame.addWidget(self.show_tables_in_explorer) # Create the popup list that allows the selection of an analysis, for the case in which there are multiple analyses. if not isinstance(self._lcvsa, MonteCarloDescriptorClass): self.analysis_popup_list = AnalysisSelector(self) self.top_left_frame.addWidget(self.analysis_popup_list) # create the instance of helpForWindow so we can display help self.help_instance = helpForWindow() # Make the commandTabWidget that will hold tabs with all of the commands self.tabWidget = CommandTabWidget(self.help_instance) self._lframe.addWidget(self.tabWidget) self.set_up_left_frame() # usually calls make_widgets which adds the commands to the tabs # Add the field for executing code. self.exec_frame = QHBoxLayout() left_frame.addLayout(self.exec_frame) qmy_button(self.exec_frame, self.execute_code, "Execute") self.code_field = QLineEdit("") self.code_field.setMaximumWidth(400) self.code_field.returnPressed.connect(self.execute_code) self.exec_frame.addWidget(self.code_field) # left_frame.addStretch() main_frame.setStretch(0,1) main_frame.setStretch(1, 2) if self._lcvsa.saved_notebook_html != None: right_frame.append_text(self._lcvsa.saved_notebook_html) # text_doc = self._rframe._teditor.document() for imageFileName in self._lcvsa.saved_image_data_dict.keys(): self._rframe.add_image_data_resource(self._lcvsa.saved_image_data_dict[imageFileName], imageFileName) right_frame.image_counter = self._lcvsa.saved_image_counter # text_doc.addResources(QTextDocument.ImageResource, QUrl(imageFileName), self._lcvsa.saved_notebook_image_dict[imageFileName]) else: self.gprint("\n<b>Base class is " + self._lcvsa.__class__.__name__ + "\n</b>") self.display_analysis_parameters()
def __init__(self, parent): super(SupplyOrderOverview, self).__init__(parent) initialize_supplier_cache() self.set_panel_title(_("Supply Orders")) # navigation = NavBar( self, # [ (_("Action"),self.show_actions) ] ) # self.action_menu = QMenu(navigation.buttons[0]) title = _("Supply orders") # self.setWindowTitle(title) filter_family = FilterQuery.SUPPLIER_ORDER_SLIPS_FAMILY self.filter_widget = PersistentFilter(filter_family) self.filter_widget.apply_filter.connect(self._apply_filter) self.filter_widget.hide() self.proto = [] self.proto.append( TextLinePrototype('human_identifier', _("Part Nr"), editable=False)) self.proto.append( TextLinePrototype('supplier_fullname', _('Supplier'), editable=False)) self.proto.append( DatePrototype('expected_delivery_date', _('Deadline'), editable=True, nullable=False)) self.proto.append( TextLinePrototype('description', _('Description'), editable=True, nullable=False)) self.proto.append( FloatNumberPrototype('quantity', _('Quantity'), editable=True, nullable=False)) self.proto.append( FloatNumberPrototype('unit_price', _('Unit price'), editable=True, nullable=False)) self.proto.append( DatePrototype('creation_date', _('Creation date'), editable=False, nullable=False)) # self.proto.append( DatePrototype('creation_date',_('Creation'), editable=False)) # self.proto.append( DatePrototype('expected_delivery_date',_('Expected\ndelivery'), editable=False)) # self.proto.append( TextLinePrototype('supplier_fullname',_('Supplier'), editable=False)) self.search_results_model = PrototypedModelView(self.proto, self) self.search_results_view = PrototypedQuickView(self.proto, self) self.search_results_view.setModel(self.search_results_model) self.search_results_view.horizontalHeader().setSortIndicatorShown(True) self.search_results_view.verticalHeader().hide() self.search_results_view.verticalHeader().setResizeMode( QHeaderView.ResizeToContents) self.search_results_view.doubleClicked.connect( self._supply_order_double_clicked) self.search_results_view.activated.connect( self._supply_order_double_clicked) self.search_results_view.horizontalHeader().sectionClicked.connect( self.section_clicked) top_layout = QVBoxLayout(self) navigation = NavBar(self, [(self.filter_widget.get_filters_combo(), None), (_("Edit filter"), self._toggle_edit_filters)]) self.title_widget = TitleWidget(title, self, navigation) # navigation) hlayout_results = QHBoxLayout() # w = SubFrame(_("Supply order parts"),self.search_results_view,None) hlayout_results.addWidget(self.search_results_view) w = SubFrame(_("Supply order detail"), self._make_supply_order_detail_view(), None) hlayout_results.addWidget(w) hlayout_results.setStretch(0, 2) hlayout_results.setStretch(0, 1) top_layout.addWidget(self.title_widget) top_layout.addWidget(self.filter_widget) top_layout.addLayout(hlayout_results) top_layout.setStretch(3, 100) self.setLayout(top_layout) self.search_results_view.setSelectionBehavior( QAbstractItemView.SelectRows) self.search_results_view.setSelectionMode( QAbstractItemView.SingleSelection) # self.search_results_view.activated.connect(self.row_activated) self.search_results_view.selectionModel().currentRowChanged.connect( self.row_selected) # self.detail_view.doubleClicked.connect(self._supply_order_double_clicked) # pub.subscribe(self.refresh_panel, 'supply_order.changed') # pub.subscribe(self.refresh_panel, 'supply_order.deleted') # self.filter_widget.select_default_filter() self.filter_widget.load_last_filter(configuration)