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.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 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.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 settings(self): if self.settings_window is None: window = QDialog(self) self.settings_window = window else: window = self.settings_window window = self.settings_window window.setWindowTitle('Settings') window.notelabel = QLabel("Currently these settings are only guaranteed to work prior to loading the first MIDI!\nYou'll have to restart ADLMIDI pyGui to change them again if they stop working. \n\nSorry! This will be fixed soon!") window.notelabel.setWordWrap(True) window.notelabel.setStyleSheet("font-size: 8pt; border-style: dotted; border-width: 1px; padding: 12px;") window.banklabel = QLabel("<B>Choose Instrument Bank</B>") window.space = QLabel("") window.optlabel = QLabel("<B>Options</B>") window.combo = QComboBox() window.combo.addItems(self.banks) #window.combo.setMaximumWidth(350) window.combo.setMaxVisibleItems(12) window.combo.setStyleSheet("combobox-popup: 0;") window.combo.setCurrentIndex(int(self.progset.value("sound/bank", 1))) window.combo.currentIndexChanged.connect(self.saveSettings) window.perc = QCheckBox("Adlib Percussion Instrument Mode") #window.perc.stateChanged.connect(self.checkOpts) window.tremamp = QCheckBox("Tremolo Amplification Mode") #window.tremamp.stateChanged.connect(self.checkOpts) window.vibamp = QCheckBox("Vibrato Amplification Mode") #window.vibamp.stateChanged.connect(self.checkOpts) window.modscale = QCheckBox("Scaling of Modulator Volume") #window.modscale.stateChanged.connect(self.checkOpts) window.okButton = QPushButton('OK') window.okButton.clicked.connect(window.hide) vbox = QVBoxLayout() vbox.addWidget(window.space) vbox.addWidget(window.banklabel) vbox.addWidget(window.combo) vbox.addWidget(window.space) vbox.addWidget(window.optlabel) vbox.addWidget(window.perc) vbox.addWidget(window.tremamp) vbox.addWidget(window.vibamp) vbox.addWidget(window.modscale) vbox.addWidget(window.notelabel) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(window.okButton) vbox.addLayout(hbox) window.setLayout(vbox) window.setFixedSize(530, 369) window.show() window.activateWindow() window.raise_()
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 add_col(self, a): if self.mySQL.do: da_2 = QDialog(self.app) if self.table_Name != None: self.app.ref = True da_2.setWindowTitle("Delete Column From %s.%s" % (self.Data_Name, self.table_Name)) da_2.setFixedSize(600, 50) line_1 = edit.editText() but = QPushButton('ADD') hbox = QHBoxLayout(da_2) for i in (QLabel("New Column: "), line_1, but): hbox.addWidget(i) but.clicked.connect(lambda: self.mySQL.add_Tcol( self.Data_Name, self.table_Name, line_1.toPlainText())) da_2.exec_() else: MsgBox_2().showMsg("Select Table From %s" % self.Data_Name) else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
def drop_table(self, a): if self.mySQL.do: if self.Data_Name != None: da = QDialog(self.app) da.setWindowTitle("%s From %s" % (a.text(), self.Data_Name)) da.setFixedSize(300, 100) form = QFormLayout(da) lin = QLineEdit() lin.setFont(QFont("", 14)) but = QPushButton("Delete Table") but.clicked.connect( lambda: self.mySQL.drop_table(self.Data_Name, lin.text())) form.addRow(QLabel("<h3>Name Table</h3>"), lin) form.setSpacing(30) form.addRow(but) self.app.ref = True da.exec_() else: MsgBox_2().showMsg("Plz Select Database") else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
def data(self, a): if self.mySQL.do: di_ac = { "Create Database": self.mySQL.create_data, "Delete Database": self.mySQL.drop_data, } da = QDialog(self.app) da.setFixedSize(300, 100) form = QFormLayout(da) lin = QLineEdit() lin.setFont(QFont("", 14)) but = QPushButton("%s" % str(a.text()).split(' ')[0]) but.clicked.connect(lambda: di_ac[a.text()](lin.text())) form.addRow(QLabel("<h3>Name Database</h3>"), lin) form.setSpacing(30) form.addRow(but) da.setWindowTitle("%s" % a.text()) da.exec_() self.app.ref = True else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
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 ")
class MenuBar(QMenuBar): def __init__(self, *args, **kwargs): super(MenuBar, self).__init__(*args, **kwargs) try: menu = self.addMenu("&정보".decode('utf-8')) menu.addAction("툴 정보".decode('utf-8'), self.loadToolTip) except: pass def loadToolTip(self): try: self.dialog.deleteLater() except: pass self.dialog = QDialog(self) self.dialog.setWindowTitle("툴 정보".decode('utf-8')) dialogLayout = QVBoxLayout(self.dialog) lb_description = Label_descriptionImage() dialogLayout.addWidget(lb_description) self.dialog.show()
def rm_row(self, a): if self.mySQL.do: da_2 = QDialog(self.app) if self.table_Name != None: da_2.setWindowTitle("Delete Row From %s.%s" % (self.Data_Name, self.table_Name)) da_2.setFixedSize(400, 50) line_1 = QLineEdit() line_2 = QLineEdit() but = QPushButton('Delete') hbox = QHBoxLayout(da_2) for i in (QLabel("Delete Where: "), line_1, QLabel("="), line_2, but): hbox.addWidget(i) but.clicked.connect(lambda: self.mySQL.delete_Trow( self.Data_Name, self.table_Name, str(line_1.text() + "='%s'" % line_2.text()))) self.app.ref = True da_2.exec_() else: MsgBox_2().showMsg("Select Table From %s" % self.Data_Name) else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
def _create_control ( self, parent ): control = QDialog( parent ) control.setWindowTitle( self.title ) return control