def update_t(self, a): if self.mySQL.do: da_3 = QDialog(self.app) d_list = [] if self.table_Name != None: da_3.setWindowTitle("Update Table %s.%s" % (self.Data_Name, self.table_Name)) da_3.resize(600, 100) tab = WTL.Table() line_1 = QLineEdit() line_2 = QLineEdit() but = QPushButton("Update") tab.setRowCount(1) cols = self.mySQL.getColumns(self.Data_Name, self.table_Name) tab.setColumnCount(len(cols)) for ind in range(len(cols)): item = QTableWidgetItem tab.setHorizontalHeaderItem(ind, item(cols[ind])) vbox = QVBoxLayout(da_3) hbox = QHBoxLayout() vbox.addWidget(tab) for i in (QLabel("Where: "), line_1, QLabel("="), line_2): hbox.addWidget(i) vbox.addLayout(hbox) vbox.addWidget(but) but.clicked.connect(lambda: self.mySQL.update_DT( self.Data_Name, self.table_Name, str(line_1.text() + "='%s'" % line_2.text()), tab)) self.app.ref = True da_3.exec_() else: MsgBox_2().showMsg("Plz Select Table From %s" % self.Data_Name) else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
def deleteTab(self): dialog = QDialog( self ) dialog.setWindowTitle( "Remove Tab" ) dialog.resize( 300, 50 ) mainLayout = QVBoxLayout(dialog) description = QLabel( "'%s' ���� �����Ͻð� ���ϱ�?".decode('utf-8') % self.tabText( self.currentIndex() ) ) layoutButtons = QHBoxLayout() buttonDelete = QPushButton( "�����".decode('utf-8') ) buttonCancel = QPushButton( "���".decode('utf-8') ) layoutButtons.addWidget( buttonDelete ) layoutButtons.addWidget( buttonCancel ) mainLayout.addWidget( description ) mainLayout.addLayout( layoutButtons ) dialog.show() def cmd_delete(): self.removeTab( self.indexOf( self.currentWidget() ) ) dialog.deleteLater() def cmd_cancel(): dialog.deleteLater() QtCore.QObject.connect( buttonDelete, QtCore.SIGNAL('clicked()'), cmd_delete ) QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL('clicked()'), cmd_cancel )
def insert_t(self, a): if self.mySQL.do: da_3 = QDialog(self.app) if self.table_Name != None: da_3.setWindowTitle("Insert InTo %s.%s" % (self.Data_Name, self.table_Name)) da_3.resize(600, 100) tab = WTL.Table() but = QPushButton("Inset") tab.setRowCount(1) cols = self.mySQL.getColumns(self.Data_Name, self.table_Name) tab.setColumnCount(len(cols)) for ind in range(len(cols)): item = QTableWidgetItem tab.setHorizontalHeaderItem(ind, item(cols[ind])) vbox = QVBoxLayout(da_3) vbox.addWidget(tab) vbox.addWidget(but) but.clicked.connect(lambda: self.mySQL.insert_DT( self.Data_Name, self.table_Name, tab)) self.app.ref = True da_3.exec_() else: MsgBox_2().showMsg("Plz Select Table %s" % self.Data_Name) else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
def deleteTab(self): dialog = QDialog( self ) dialog.setWindowTitle( "Remove Tab" ) dialog.resize( 300, 50 ) mainLayout = QVBoxLayout(dialog) description = QLabel( "'%s' ���� �����Ͻð� ���ϱ�?".decode('utf-8') % self.tabText( self.currentIndex() ) ) layoutButtons = QHBoxLayout() buttonDelete = QPushButton( "�����".decode('utf-8') ) buttonCancel = QPushButton( "���".decode('utf-8') ) layoutButtons.addWidget( buttonDelete ) layoutButtons.addWidget( buttonCancel ) mainLayout.addWidget( description ) mainLayout.addLayout( layoutButtons ) dialog.show() def cmd_delete(): self.removeTab( self.indexOf( self.currentWidget() ) ) dialog.close() def cmd_cancel(): dialog.close() QtCore.QObject.connect( buttonDelete, QtCore.SIGNAL('clicked()'), cmd_delete ) QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL('clicked()'), cmd_cancel )
def _showpostviewerdialog(self, post): d = QDialog(self) d.resize(1024, 768) l = QVBoxLayout() w = PostViewerWidget(post, self._backend, self._masterobserver, self) w.nextpostrequested.connect(self._putnextpost) w.previouspostrequested.connect(self._putpreviouspost) w.closing.connect(d.close) l.addWidget(w) d.setLayout(l) d.setModal(False) d.show()
def _create_control ( self, parent ): dlg = QDialog( parent ) if self.size != ( -1, -1 ): dlg.resize( *self.size ) # FIXME v3: Decide what to do with the resizable facet (ie. set the # size policy): dlg.setWindowTitle( self.title ) return dlg #-- EOF ------------------------------------------------------------------------
def addTab(self): dialog = QDialog( self ) dialog.setWindowTitle( 'Add Tab' ) dialog.resize( 300, 50 ) mainLayout = QVBoxLayout( dialog ) tabNameLayout = QHBoxLayout() labelTabName = QLabel( 'Tab Name : ' ) lineEditTabName = QLineEdit() tabNameLayout.addWidget( labelTabName ) tabNameLayout.addWidget( lineEditTabName ) buttonsLayout = QHBoxLayout() buttonCreate = QPushButton( "Create" ) buttonCancel = QPushButton( "Cancel") buttonsLayout.addWidget( buttonCreate ) buttonsLayout.addWidget( buttonCancel ) mainLayout.addLayout( tabNameLayout ) mainLayout.addLayout( buttonsLayout ) dialog.show() def cmd_create(): tabName = lineEditTabName.text() if not tabName: msgbox = QMessageBox( self ) msgbox.setText( "�̸��� �������ּ���".decode( 'utf-8' ) ) msgbox.exec_() return self.tabWidget.addTab( tabName ) dialog.deleteLater() def cmd_cancel(): dialog.deleteLater() QtCore.QObject.connect( lineEditTabName, QtCore.SIGNAL( 'returnPressed()' ), cmd_create ) QtCore.QObject.connect( buttonCreate, QtCore.SIGNAL( 'clicked()' ), cmd_create ) QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL( 'clicked()' ), cmd_cancel )
def addTab(self): dialog = QDialog( self ) dialog.setWindowTitle( 'Add Tab' ) dialog.resize( 300, 50 ) mainLayout = QVBoxLayout( dialog ) tabNameLayout = QHBoxLayout() labelTabName = QLabel( 'Tab Name : ' ) lineEditTabName = QLineEdit() tabNameLayout.addWidget( labelTabName ) tabNameLayout.addWidget( lineEditTabName ) buttonsLayout = QHBoxLayout() buttonCreate = QPushButton( "Create" ) buttonCancel = QPushButton( "Cancel") buttonsLayout.addWidget( buttonCreate ) buttonsLayout.addWidget( buttonCancel ) mainLayout.addLayout( tabNameLayout ) mainLayout.addLayout( buttonsLayout ) dialog.show() def cmd_create(): tabName = lineEditTabName.text() if not tabName: msgbox = QMessageBox( self ) msgbox.setText( "�̸��� �������ּ���".decode( 'utf-8' ) ) msgbox.exec_() return self.tabWidget.addTab( tabName ) dialog.close() def cmd_cancel(): dialog.close() QtCore.QObject.connect( lineEditTabName, QtCore.SIGNAL( 'returnPressed()' ), cmd_create ) QtCore.QObject.connect( buttonCreate, QtCore.SIGNAL( 'clicked()' ), cmd_create ) QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL( 'clicked()' ), cmd_cancel )
def _table(self, a): if self.mySQL.do: da_2 = QDialog(self.app) if self.Data_Name != None: da_2.setWindowTitle("%s in %s" % (a.text(), self.Data_Name)) da_2.resize(500, 280) line = QLineEdit() edi_t = edit.editText() but = QPushButton('Create') vbox = QVBoxLayout(da_2) form = QFormLayout() form.addRow(QLabel("Name Table"), line) vbox.addLayout(form) vbox.addWidget(edi_t) vbox.addWidget(but) but.clicked.connect(lambda: self.mySQL.create_table( self.Data_Name, line.text(), edi_t.toPlainText())) self.app.ref = True da_2.exec_() else: MsgBox_2().showMsg("Plz Select Database ")