class ProjectMngForm(QDialog): def __init__(self, parent=None): QDialog.__init__(self) self.setObjectName(("ui_ProjectMngForm")) self.resize(200, 200) font = QFont() font.setFamily(("Arial")) font.setBold(False) font.setWeight(50) self.setFont(font) self.setWindowTitle("Project Manage Dialog") self.vlForm = QVBoxLayout(self) self.vlForm.setObjectName(("vl_ProjectMngForm")) self.vlForm.setSpacing(9) self.vlForm.setMargin(9) self.basicFrame = Frame(self) self.vlForm.addWidget(self.basicFrame) self.groubox = GroupBox(self.basicFrame) self.groubox.Caption = "Projects" self.basicFrame.Add = self.groubox self.listBoxProject = ListBox(self.groubox) self.groubox.Add = self.listBoxProject self.textNameProject = TextBoxPanel(self.basicFrame) self.textNameProject.Caption = "Name" self.textNameProject.LabelWidth = 50 self.textNameProject.Width = 120 self.basicFrame.Add = self.textNameProject self.textPathProject = TextBoxPanel(self.basicFrame) self.textPathProject.Caption = "Path" self.textPathProject.imageButton.setIcon(QIcon()) self.textPathProject.Button = "opens.png" self.textPathProject.LabelWidth = 50 self.textPathProject.textBox.setMaximumWidth(10000) self.textPathProject.textBox.setMinimumWidth(100) self.basicFrame.Add = self.textPathProject self.btnFrame = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.btnFrame self.buttonAddProject = QPushButton(self.btnFrame) self.buttonAddProject.setObjectName("buttonAddProject") self.buttonAddProject.setText("Add") self.btnFrame.Add = self.buttonAddProject self.buttonModifyProject = QPushButton(self.btnFrame) self.buttonModifyProject.setObjectName("buttonModifyProject") self.buttonModifyProject.setText("Modify") self.btnFrame.Add = self.buttonModifyProject self.buttonDeleteProject = QPushButton(self.btnFrame) self.buttonDeleteProject.setObjectName("buttonDeleteProject") self.buttonDeleteProject.setText("Delete") self.btnFrame.Add = self.buttonDeleteProject self.buttonSaveProject = QPushButton(self.btnFrame) self.buttonSaveProject.setObjectName("buttonSaveProject") self.buttonSaveProject.setText("Save") self.buttonSaveProject.setVisible(False) self.btnFrame.Add = self.buttonSaveProject self.buttonCloseProject = QPushButton(self.btnFrame) self.buttonCloseProject.setObjectName("buttonCloseProject") self.buttonCloseProject.setText("Close") self.btnFrame.Add = self.buttonCloseProject self.connect(self.listBoxProject, SIGNAL("Event_0"), self.listBoxProject_SelectedIndexChanged) self.connect(self.textPathProject, SIGNAL("Event_1"), self.buttonBrowseProject_Click) self.buttonAddProject.clicked.connect(self.buttonAddProject_Click) self.buttonModifyProject.clicked.connect( self.buttonModifyProject_Click) self.buttonDeleteProject.clicked.connect( self.buttonDeleteProject_Click) self.buttonSaveProject.clicked.connect(self.buttonSaveProject_Click) self.buttonCloseProject.clicked.connect(self.buttonCloseProject_Click) for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptProject): self.listBoxProject.Add(pi.Name) def buttonBrowseProject_Click(self): folderPath = QFileDialog.getExistingDirectory(self, "Open Project Path", define.projectManageDir) if (folderPath != None and folderPath != ""): self.textPathProject.Value = folderPath define.projectManageDir = folderPath def buttonAddProject_Click(self): try: if (not self.CheckInputValues()): return if (AirCraftOperation.g_projectList.Find( self.textNameProject.Value) != None): QMessageBox.warning(self, "Warning", "The same project exist!") return pi = ProjectInfo() pi.Pt = enumProjectType.ptProject pi.Name = self.textNameProject.Value pi.ProjName = self.textNameProject.Value pi.Path = self.textPathProject.Value pi.UserName = AirCraftOperation.g_loginedUser.Name pi.FullName = self.textNameProject.Value AirCraftOperation.g_projectList.Add(pi) nIndex = self.listBoxProject.Add(pi.Name) self.listBoxProject.SelectedIndex = nIndex self.buttonSaveProject.setEnabled(True) except: #(System.Exception ex) # MessageBox.Show(ex.Message) pass def buttonSaveProject_Click(self): res = QMessageBox.question(self, "Alert", "Save changes to project information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_projectList.WriteProjectInfoXml() self.buttonSaveProject.setEnabled(False) elif (res == QMessageBox.No): pass # def ProjectMngF # }orm_FormClosing(object sender, FormClosingEventArgs e) # { # if (self.buttonSaveProject.Enabled == true) # { # DialogResult res = MessageBox.Show("Save changes to project information?", "Alert", MessageBoxButtons.YesNoCancel) # if (res == DialogResult.Yes) # { # self.buttonSaveProject_Click(sender, e) # } # else if (res == DialogResult.No) # { # } # else if (res == DialogResult.Cancel) # { # self.DialogResult = DialogResult.None # return # } # } def CheckInputValues(self): if (self.textNameProject.Value == None or self.textNameProject.Value == ""): raise ("Please input project name!") if (self.textPathProject.Value == None or self.textPathProject.Value == ""): raise ("Please input project path!") d = QDir(self.textPathProject.Value) if (not d.exists()): if (QMessageBox.question( self, "Question", "Procedure path dose not exist! Do you create the directory?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes): d = QDir(self.textPathProject.Value) d.mkpath(self.textPathProject.Value) else: return False return True # except:#(System.Exception ex) # # MessageBox.Show(ex.Message) # return False def buttonModifyProject_Click(self): try: if (self.listBoxProject.SelectedIndex < 0): raise ("Please select project in the projects list!") if (not self.CheckInputValues()): return pi = ProjectInfo() pi.Pt = enumProjectType.ptProject pi.Name = self.textNameProject.Value pi.ProjName = self.textNameProject.Value pi.Path = self.textPathProject.Value pi.UserName = AirCraftOperation.g_loginedUser.Name pi.FullName = self.textNameProject.Value AirCraftOperation.g_projectList.Remove( self.listBoxProject.SelectedIndex) AirCraftOperation.g_projectList.Insert( self.listBoxProject.SelectedIndex, pi) self.listBoxProject.Clear() for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptProject): self.listBoxProject.Add(pi.Name) self.buttonSaveProject.setEnabled(True) except: # MessageBox.Show(ex.Message) pass def buttonDeleteProject_Click(self): try: if (self.listBoxProject.SelectedIndex < 0): QMessageBox.warning( self, "Warning", "Please select project in the projects list!") return res = QMessageBox.question(self, "Alert", "Delete selected project?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.No): return AirCraftOperation.g_projectList.Remove( self.listBoxProject.Items[self.listBoxProject.SelectedIndex]) self.listBoxProject.Clear() self.textNameProject.Value = "" self.textPathProject.Value = "" for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptProject): self.listBoxProject.Add(pi.Name) self.buttonSaveProject.setEnabled(True) AirCraftOperation.g_projectList.WriteProjectInfoXml() except: pass # MessageBox.Show(ex.Message) def listBoxProject_SelectedIndexChanged(self): try: if (self.listBoxProject.SelectedIndex < 0): return i = AirCraftOperation.g_projectList.Find( self.listBoxProject.Items[self.listBoxProject.SelectedIndex]) self.textNameProject.Value = AirCraftOperation.g_projectList.ProjectsList[ i].Name self.textPathProject.Value = AirCraftOperation.g_projectList.ProjectsList[ i].Path except: pass def buttonCloseProject_Click(self): res = QMessageBox.question(self, "Alert", "Save changes to project information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_projectList.WriteProjectInfoXml() self.buttonSaveProject.setEnabled(False) elif (res == QMessageBox.No): pass self.accept()
class AIPChartMngForm(QDialog): def __init__(self, parent = None): QDialog.__init__(self) self.setObjectName(("ui_ProjectMngForm")) self.resize(200, 200) font = QFont() font.setFamily(("Arial")) font.setBold(False) font.setWeight(50) self.setFont(font) self.setWindowTitle("Register AIP Chat") self.vlForm = QVBoxLayout(self) self.vlForm.setObjectName(("vl_ProjectMngForm")) self.vlForm.setSpacing(9) self.vlForm.setMargin(9) self.basicFrame = Frame(self) self.vlForm.addWidget(self.basicFrame) self.groubox = GroupBox(self.basicFrame) self.groubox.Caption = "Select a project" self.basicFrame.Add = self.groubox self.listBoxAIPChart = ListBox(self.groubox) self.groubox.Add = self.listBoxAIPChart self.textNameAIPChart = TextBoxPanel(self.basicFrame) self.textNameAIPChart.Caption = "Name" self.textNameAIPChart.LabelWidth = 50 self.textNameAIPChart.Width = 120 self.basicFrame.Add = self.textNameAIPChart self.textPathAIPChart = TextBoxPanel(self.basicFrame) self.textPathAIPChart.Caption = "Path" self.textPathAIPChart.imageButton.setIcon(QIcon()) self.textPathAIPChart.Button = "opens.png" self.textPathAIPChart.LabelWidth = 50 self.textPathAIPChart.textBox.setMaximumWidth(10000) self.textPathAIPChart.textBox.setMinimumWidth(100) self.basicFrame.Add = self.textPathAIPChart self.btnFrame = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.btnFrame self.buttonAddAIPChart = QPushButton(self.btnFrame) self.buttonAddAIPChart.setObjectName("buttonAddAIPChart") self.buttonAddAIPChart.setText("Add") self.btnFrame.Add = self.buttonAddAIPChart self.buttonModifyAIPChart = QPushButton(self.btnFrame) self.buttonModifyAIPChart.setObjectName("buttonModifyAIPChart") self.buttonModifyAIPChart.setText("Modify") self.btnFrame.Add = self.buttonModifyAIPChart self.buttonDeleteAIPChart = QPushButton(self.btnFrame) self.buttonDeleteAIPChart.setObjectName("buttonDeleteAIPChart") self.buttonDeleteAIPChart.setText("Delete") self.btnFrame.Add = self.buttonDeleteAIPChart self.buttonSaveAIPChart = QPushButton(self.btnFrame) self.buttonSaveAIPChart.setObjectName("buttonSaveAIPChart") self.buttonSaveAIPChart.setText("Save") self.buttonSaveAIPChart.setVisible(False) self.btnFrame.Add = self.buttonSaveAIPChart self.buttonCloseAIPChart = QPushButton(self.btnFrame) self.buttonCloseAIPChart.setObjectName("buttonCloseAIPChart") self.buttonCloseAIPChart.setText("Close") self.btnFrame.Add = self.buttonCloseAIPChart self.connect(self.listBoxAIPChart, SIGNAL("Event_0"), self.listBoxProject_SelectedIndexChanged) self.connect(self.textPathAIPChart, SIGNAL("Event_1"), self.buttonBrowseProject_Click) self.buttonAddAIPChart.clicked.connect(self.buttonAddProject_Click) self.buttonModifyAIPChart.clicked.connect(self.buttonModifyProject_Click) self.buttonDeleteAIPChart.clicked.connect(self.buttonDeleteProject_Click) self.buttonSaveAIPChart.clicked.connect(self.buttonSaveProject_Click) self.buttonCloseAIPChart.clicked.connect(self.buttonCloseProject_Click) for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptAipChart): self.listBoxAIPChart.Add(pi.Name) def buttonBrowseProject_Click(self): if QMessageBox.warning(self, "Alert", "If you want to create new project, Please click 'Yes' button.\nIf you want to open existing project, Please click 'No' button.", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes: filePathDir = QFileDialog.getSaveFileName(self, "Save QGIS project file", define.projectManageDir,"QGIS Project files(*.qgs)") else: filePathDir = QFileDialog.getOpenFileName(self, "Open QGIS Project File", define.projectManageDir,"QGIS Project Files (*.qgs)") if filePathDir == "": return QgsProject.instance().write(QFileInfo(filePathDir)) fileName = filePathDir.split("/")[-1] fileDir = filePathDir.left(filePathDir.length() - fileName.length() - 1) define.projectManageDir = filePathDir self.textPathAIPChart.Value = filePathDir def buttonAddProject_Click(self): if (not self.CheckInputValues()): return if (AirCraftOperation.g_projectList.FindByName(self.textNameAIPChart.Text, enumProjectType.ptAipChart) != None): QMessageBox.warning(self, "Warning", "The same project exist!") pi = ProjectInfo() pi.Pt = enumProjectType.ptAipChart pi.Name = self.textNameAIPChart.Text pi.Path = self.textPathAIPChart.Text pi.UserName = AirCraftOperation.g_loginedUser.Name AirCraftOperation.g_projectList.Add(pi) nIndex = self.listBoxAIPChart.Add(pi.Name) self.listBoxAIPChart.SelectedIndex = nIndex self.buttonSaveAIPChart.setEnabled(True) def buttonSaveProject_Click(self): res = QMessageBox.question(self, "Alert", "Save changes to project information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_projectList.WriteProjectInfoXml() self.buttonSaveAIPChart.setEnabled(False) def buttonCloseProject_Click(self): res = QMessageBox.question(self, "Alert", "Save changes to project information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_projectList.WriteProjectInfoXml() self.buttonSaveAIPChart.setEnabled(False) self.accept() def CheckInputValues(self): if (self.textNameAIPChart.Text == None or self.textNameAIPChart.Text == ""): QMessageBox.warning(self, "Warning", "Please input project name!") return False if (self.textPathAIPChart.Text == None or self.textPathAIPChart.Text == ""): QMessageBox.warning(self, "Warning", "Please input project path!") return False # if (not QFile.exists(self.textPathAIPChart.Text)): # QMessageBox.warning(self, "Warning", "Invalid AIP Chart!") # return False return True def buttonModifyProject_Click(self): if (self.listBoxAIPChart.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select project in the projects list!") if (not self.CheckInputValues()): return index = AirCraftOperation.g_projectList.FindByName(self.listBoxAIPChart.Items[self.listBoxAIPChart.SelectedIndex], enumProjectType.ptAipChart) AirCraftOperation.g_projectList.ProjectsList[index].Pt = enumProjectType.ptAipChart AirCraftOperation.g_projectList.ProjectsList[index].Name = self.textNameAIPChart.Text AirCraftOperation.g_projectList.ProjectsList[index].Path = self.textPathAIPChart.Text AirCraftOperation.g_projectList.ProjectsList[index].UserName = AirCraftOperation.g_loginedUser.Name self.buttonSaveAIPChart.setEnabled(True) self.listBoxAIPChart.Clear() for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptAipChart): self.listBoxAIPChart.Add(pi.Name) def buttonDeleteProject_Click(self): if (self.listBoxAIPChart.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select project in the projects list!") return if (QMessageBox.question(self, "Question", "Are you sure to delete " + self.listBoxAIPChart.Items[self.listBoxAIPChart.SelectedIndex] + "?",QMessageBox.Yes | QMessageBox.No) == QMessageBox.No): return index = AirCraftOperation.g_projectList.FindByName(self.listBoxAIPChart.Items[self.listBoxAIPChart.SelectedIndex], enumProjectType.ptAipChart) if index == None: return AirCraftOperation.g_projectList.ProjectsList.pop(index) self.buttonSaveAIPChart.setEnabled(True) self.listBoxAIPChart.Clear() for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptAipChart): self.listBoxAIPChart.Add(pi.Name) AirCraftOperation.g_projectList.WriteProjectInfoXml() def listBoxProject_SelectedIndexChanged(self): if (self.listBoxAIPChart.SelectedIndex < 0): return index = AirCraftOperation.g_projectList.FindByName(self.listBoxAIPChart.Items[self.listBoxAIPChart.SelectedIndex], enumProjectType.ptAipChart) self.textNameAIPChart.Text = AirCraftOperation.g_projectList.ProjectsList[index].Name self.textPathAIPChart.Text = AirCraftOperation.g_projectList.ProjectsList[index].Path
class UserMngForm(QDialog): def __init__(self, parent=None): QDialog.__init__(self) self.setObjectName(("ui_UserMngForm")) self.resize(200, 200) font = QFont() font.setFamily(("Arial")) font.setBold(False) font.setWeight(50) self.setFont(font) self.vlForm = QVBoxLayout(self) self.vlForm.setObjectName(("vl_UserMngForm")) self.vlForm.setSpacing(9) self.vlForm.setMargin(9) self.setWindowTitle("User Manage Dialog") self.basicFrame = Frame(self) self.vlForm.addWidget(self.basicFrame) self.userContentFrm = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.userContentFrm self.groupbox = GroupBox(self.userContentFrm) self.groupbox.Caption = "Users" self.userContentFrm.Add = self.groupbox self.listBoxUser = ListBox(self.groupbox) self.groupbox.Add = self.listBoxUser self.userDataFrm = Frame(self.userContentFrm) self.userContentFrm.Add = self.userDataFrm self.groupBoxUserinfo = GroupBox(self.userDataFrm) self.groupBoxUserinfo.Caption = "User Information" self.userDataFrm.Add = self.groupBoxUserinfo self.userFullFrm = Frame(self.groupBoxUserinfo, "HL") self.groupBoxUserinfo.Add = self.userFullFrm self.textFirstName = TextBoxPanel(self.userFullFrm) self.textFirstName.Caption = "First Name" self.textFirstName.LabelWidth = 70 self.textFirstName.Width = 120 self.userFullFrm.Add = self.textFirstName self.textLastName = TextBoxPanel(self.userFullFrm) self.textLastName.Caption = "Last Name" self.textLastName.LabelWidth = 70 self.textLastName.Width = 120 self.userFullFrm.Add = self.textLastName self.userEmailPhoneFrm = Frame(self.groupBoxUserinfo, "HL") self.groupBoxUserinfo.Add = self.userEmailPhoneFrm self.textEMail = TextBoxPanel(self.userEmailPhoneFrm) self.textEMail.Caption = "E-Mail" self.textEMail.LabelWidth = 70 self.textEMail.Width = 120 self.userEmailPhoneFrm.Add = self.textEMail self.textPhone = TextBoxPanel(self.userEmailPhoneFrm) self.textPhone.Caption = "Phone" self.textPhone.LabelWidth = 70 self.textPhone.Width = 120 self.userEmailPhoneFrm.Add = self.textPhone self.userAddressCityFrm = Frame(self.groupBoxUserinfo, "HL") self.groupBoxUserinfo.Add = self.userAddressCityFrm self.textAddress = TextBoxPanel(self.userAddressCityFrm) self.textAddress.Caption = "Address" self.textAddress.LabelWidth = 70 self.textAddress.Width = 120 self.userAddressCityFrm.Add = self.textAddress self.textCity = TextBoxPanel(self.userAddressCityFrm) self.textCity.Caption = "City" self.textCity.LabelWidth = 70 self.textCity.Width = 120 self.userAddressCityFrm.Add = self.textCity self.userPostCodeStateFrm = Frame(self.groupBoxUserinfo, "HL") self.groupBoxUserinfo.Add = self.userPostCodeStateFrm self.textPostcode = TextBoxPanel(self.userPostCodeStateFrm) self.textPostcode.Caption = "Post Code" self.textPostcode.LabelWidth = 70 self.textPostcode.Width = 120 self.userPostCodeStateFrm.Add = self.textPostcode self.textState = TextBoxPanel(self.userPostCodeStateFrm) self.textState.Caption = "State" self.textState.LabelWidth = 70 self.textState.Width = 120 self.userPostCodeStateFrm.Add = self.textState self.groupBoxUserRoles = GroupBox(self.userDataFrm, "HL") self.groupBoxUserRoles.Caption = "User Roles" self.userDataFrm.Add = self.groupBoxUserRoles self.radioAdmin = QRadioButton(self.groupBoxUserRoles) self.radioAdmin.setObjectName("radioAdmin") self.radioAdmin.setText("Administrator") self.radioAdmin.setChecked(True) self.groupBoxUserRoles.Add = self.radioAdmin self.radioSuperuser = QRadioButton(self.groupBoxUserRoles) self.radioSuperuser.setObjectName("radioSuperuser") self.radioSuperuser.setText("Super User") self.groupBoxUserRoles.Add = self.radioSuperuser self.radioReadwrite = QRadioButton(self.groupBoxUserRoles) self.radioReadwrite.setObjectName("radioReadwrite") self.radioReadwrite.setText("Read / Write") self.groupBoxUserRoles.Add = self.radioReadwrite self.radioReadonly = QRadioButton(self.groupBoxUserRoles) self.radioReadonly.setObjectName("radioReadonly") self.radioReadonly.setText("Read Only") self.groupBoxUserRoles.Add = self.radioReadonly self.groupBoxUserDisplayInfo = GroupBox(self.userDataFrm, "HL") self.groupBoxUserDisplayInfo.Caption = "User Display Information" self.userDataFrm.Add = self.groupBoxUserDisplayInfo self.textName = TextBoxPanel(self.groupBoxUserDisplayInfo) self.textName.Caption = "Name" self.textName.LabelWidth = 70 self.textName.Width = 120 self.groupBoxUserDisplayInfo.Add = self.textName self.textPassword = TextBoxPanel(self.groupBoxUserDisplayInfo) self.textPassword.Caption = "Password" self.textPassword.LabelWidth = 70 self.textPassword.Width = 120 self.textPassword.EchoMode = "Password" self.groupBoxUserDisplayInfo.Add = self.textPassword self.btnFrame = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.btnFrame self.buttonAddUser = QPushButton(self.btnFrame) self.buttonAddUser.setObjectName("buttonAddUser") self.buttonAddUser.setText("Add") self.btnFrame.Add = self.buttonAddUser self.buttonModifyUser = QPushButton(self.btnFrame) self.buttonModifyUser.setObjectName("buttonModifyUser") self.buttonModifyUser.setText("Modify") self.btnFrame.Add = self.buttonModifyUser self.buttonDeleteUser = QPushButton(self.btnFrame) self.buttonDeleteUser.setObjectName("buttonDeleteUser") self.buttonDeleteUser.setText("Delete") self.btnFrame.Add = self.buttonDeleteUser self.buttonSaveUser = QPushButton(self.btnFrame) self.buttonSaveUser.setObjectName("buttonSaveUser") self.buttonSaveUser.setText("Save") self.buttonSaveUser.setVisible(False) self.btnFrame.Add = self.buttonSaveUser self.buttonCloseUser = QPushButton(self.btnFrame) self.buttonCloseUser.setObjectName("buttonCloseProject") self.buttonCloseUser.setText("Close") self.btnFrame.Add = self.buttonCloseUser self.connect(self.listBoxUser, SIGNAL("Event_0"), self.listBoxUser_SelectedIndexChanged) self.buttonAddUser.clicked.connect(self.buttonAddUser_Click) self.buttonModifyUser.clicked.connect(self.buttonModifyUser_Click) self.buttonDeleteUser.clicked.connect(self.buttonDeleteUser_Click) self.buttonSaveUser.clicked.connect(self.buttonSaveUser_Click) self.buttonCloseUser.clicked.connect(self.buttonCloseUser_Click) for ui in AirCraftOperation.g_userList.ListUserInfo: self.listBoxUser.Add(ui.Name) def listBoxUser_SelectedIndexChanged(self): try: if (self.listBoxUser.SelectedIndex < 0): return selectedName = self.listBoxUser.Items[ self.listBoxUser.SelectedIndex] ui = AirCraftOperation.g_userList.FindUser(selectedName) if (ui.FName != None): self.textFirstName.Text = ui.FName else: self.textFirstName.Text = "" if (ui.LName != None): self.textLastName.Text = ui.LName else: self.textLastName.Text = "" if (ui.EMail != None): self.textEMail.Text = ui.EMail else: self.textEMail.Text = "" if (ui.Phone != None): self.textPhone.Text = ui.Phone else: self.textPhone.Text = "" if (ui.Address != None): self.textAddress.Text = ui.Address else: self.textAddress.Text = "" if (ui.PCode != None): self.textPostcode.Text = ui.PCode else: self.textPostcode.Text = "" if (ui.City != None): self.textCity.Text = ui.City else: self.textCity.Text = "" if (ui.State != None): self.textState.Text = ui.State else: self.textState.Text = "" if (ui.Name != None): self.textName.Text = ui.Name else: self.textName.Text = "" if (ui.Password != None): self.textPassword.Text = ui.Password else: self.textPassword.Text = "" if ui.Right == enumUserRight.ur_Admin: self.radioAdmin.setChecked(True) elif ui.Right == enumUserRight.ur_SuperUser: self.radioSuperuser.setChecked(True) elif ui.Right == enumUserRight.ur_ReadWrite: self.radioReadwrite.setChecked(True) elif ui.Right == enumUserRight.ur_ReadOnly: self.radioReadonly.setChecked(True) except: pass def buttonAddUser_Click(self): if (not self.CheckInputValues()): return newUser = self.SetUserInfo() if (AirCraftOperation.g_userList.AddUser(newUser)): self.listBoxUser.Add(newUser.Name) self.buttonSaveUser.Enabled = True def buttonModifyUser_Click(self): try: if (self.listBoxUser.SelectedIndex < 0): QMessageBox.warning( self, "Warning", "Please select an user in users list box!") if (not self.CheckInputValues()): return newUser = self.SetUserInfo() oldUser = AirCraftOperation.g_userList.FindUser( self.listBoxUser.Items[self.listBoxUser.SelectedIndex]) if (oldUser != None): AirCraftOperation.g_userList.DeleteUser(oldUser) AirCraftOperation.g_userList.AddUser(newUser) self.listBoxUser.Clear() for ui in AirCraftOperation.g_userList.ListUserInfo: self.listBoxUser.Add(ui.Name) self.buttonSaveUser.setEnabled(True) except: pass def buttonDeleteUser_Click(self): if (self.listBoxUser.SelectedIndex > -1): res = QMessageBox.question( self, "Question", "Do you want to delete this user information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.No): return userName = self.listBoxUser.Items[self.listBoxUser.SelectedIndex] AirCraftOperation.g_userList.DeleteUser(userName) self.listBoxUser.Clear() for ui in AirCraftOperation.g_userList.ListUserInfo: self.listBoxUser.Add(ui.Name) AirCraftOperation.g_userList.WriteUserInfoFile() # self.buttonSaveUser.setEnabled(True) self.listBoxUser.SelectedIndex = self.listBoxUser.SelectedIndex - 1 if ( self.listBoxUser.SelectedIndex > 0) else 0 self.listBoxUser_SelectedIndexChanged() def buttonSaveUser_Click(self): if (self.buttonSaveUser.isEnabled() == True): res = QMessageBox.question(self, "Question", "Save changes to user information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_userList.WriteUserInfoFile() self.buttonSaveUser.setEnabled(False) def buttonCloseUser_Click(self): if (self.buttonSaveUser.isEnabled() == True): res = QMessageBox.question(self, "Question", "Save changes to user information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_userList.WriteUserInfoFile() self.buttonSaveUser.setEnabled(False) self.accept() def CheckInputValues(self): try: if (self.textFirstName.Text == ""): QMessageBox.warning( self, "Warning", "First name is required! Please input first name.") return False if (self.textLastName.Text == ""): QMessageBox.warning( self, "Warning", "Last name is required! Please input last name.") return False if (self.textName.Text == ""): QMessageBox.warning( self, "Warning", "Name is required! Please input display name.") return False return True except: return False def SetUserInfo(self): ui = MYUSERINFO() try: if (self.radioAdmin.isChecked()): ui.Right = enumUserRight.ur_Admin elif (self.radioSuperuser.isChecked()): ui.Right = enumUserRight.ur_SuperUser elif (self.radioReadwrite.isChecked()): ui.Right = enumUserRight.ur_ReadWrite elif (self.radioReadonly.isChecked()): ui.Right = enumUserRight.ur_ReadOnly if (self.textFirstName.Text != None): ui.FName = self.textFirstName.Text if (self.textFirstName.Text != None): ui.LName = self.textLastName.Text if (self.textFirstName.Text != None): ui.EMail = self.textEMail.Text if (self.textFirstName.Text != None): ui.Phone = self.textPhone.Text if (self.textFirstName.Text != None): ui.Address = self.textAddress.Text if (self.textFirstName.Text != None): ui.PCode = self.textPostcode.Text if (self.textFirstName.Text != None): ui.City = self.textCity.Text if (self.textFirstName.Text != None): ui.State = self.textState.Text if (self.textFirstName.Text != None): ui.Name = self.textName.Text if (self.textFirstName.Text != None): ui.Password = self.textPassword.Text return ui except: return None
class AIPChartMngForm(QDialog): def __init__(self, parent=None): QDialog.__init__(self) self.setObjectName(("ui_ProjectMngForm")) self.resize(200, 200) font = QFont() font.setFamily(("Arial")) font.setBold(False) font.setWeight(50) self.setFont(font) self.vlForm = QVBoxLayout(self) self.vlForm.setObjectName(("vl_ProjectMngForm")) self.vlForm.setSpacing(9) self.vlForm.setMargin(9) self.basicFrame = Frame(self) self.vlForm.addWidget(self.basicFrame) self.groubox = GroupBox(self.basicFrame) self.groubox.Caption = "Select a project" self.basicFrame.Add = self.groubox self.listBoxAIPChart = ListBox(self.groubox) self.groubox.Add = self.listBoxAIPChart self.textNameAIPChart = TextBoxPanel(self.basicFrame) self.textNameAIPChart.Caption = "Name" self.textNameAIPChart.LabelWidth = 50 self.textNameAIPChart.Width = 120 self.basicFrame.Add = self.textNameAIPChart self.textPathAIPChart = TextBoxPanel(self.basicFrame) self.textPathAIPChart.Caption = "Path" self.textPathAIPChart.imageButton.setIcon(QIcon()) self.textPathAIPChart.Button = "opens.png" self.textPathAIPChart.LabelWidth = 50 self.textPathAIPChart.textBox.setMaximumWidth(10000) self.textPathAIPChart.textBox.setMinimumWidth(100) self.basicFrame.Add = self.textPathAIPChart self.btnFrame = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.btnFrame self.buttonAddAIPChart = QPushButton(self.btnFrame) self.buttonAddAIPChart.setObjectName("buttonAddAIPChart") self.buttonAddAIPChart.setText("Add") self.btnFrame.Add = self.buttonAddAIPChart self.buttonModifyAIPChart = QPushButton(self.btnFrame) self.buttonModifyAIPChart.setObjectName("buttonModifyAIPChart") self.buttonModifyAIPChart.setText("Modify") self.btnFrame.Add = self.buttonModifyAIPChart self.buttonDeleteAIPChart = QPushButton(self.btnFrame) self.buttonDeleteAIPChart.setObjectName("buttonDeleteAIPChart") self.buttonDeleteAIPChart.setText("Delete") self.btnFrame.Add = self.buttonDeleteAIPChart self.buttonSaveAIPChart = QPushButton(self.btnFrame) self.buttonSaveAIPChart.setObjectName("buttonSaveAIPChart") self.buttonSaveAIPChart.setText("Save") self.btnFrame.Add = self.buttonSaveAIPChart self.buttonCloseAIPChart = QPushButton(self.btnFrame) self.buttonCloseAIPChart.setObjectName("buttonCloseAIPChart") self.buttonCloseAIPChart.setText("Close") self.btnFrame.Add = self.buttonCloseAIPChart self.connect(self.listBoxAIPChart, SIGNAL("Event_0"), self.listBoxProject_SelectedIndexChanged) self.connect(self.textPathAIPChart, SIGNAL("Event_1"), self.buttonBrowseProject_Click) self.buttonAddAIPChart.clicked.connect(self.buttonAddProject_Click) self.buttonModifyAIPChart.clicked.connect( self.buttonModifyProject_Click) self.buttonDeleteAIPChart.clicked.connect( self.buttonDeleteProject_Click) self.buttonSaveAIPChart.clicked.connect(self.buttonSaveProject_Click) self.buttonCloseAIPChart.clicked.connect(self.buttonCloseProject_Click) for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptAipChart): self.listBoxAIPChart.Add(pi.Name) def buttonBrowseProject_Click(self): filePathDir = QFileDialog.getOpenFileName( self, "Open Project File", QCoreApplication.applicationDirPath(), "QGIS Project Files (*.qgs)") if filePathDir == "": return self.textPathAIPChart.Value = filePathDir def buttonAddProject_Click(self): if (not self.CheckInputValues()): return if (AirCraftOperation.g_projectList.Find(self.textNameAIPChart.Text) != None): QMessageBox.warning(self, "Warning", "The same project exist!") pi = ProjectInfo() pi.Pt = enumProjectType.ptAipChart pi.Name = self.textNameAIPChart.Text pi.Path = self.textPathAIPChart.Text pi.UserName = AirCraftOperation.g_loginedUser.Name AirCraftOperation.g_projectList.Add(pi) nIndex = self.listBoxAIPChart.Add(pi.Name) self.listBoxAIPChart.SelectedIndex = nIndex self.buttonSaveAIPChart.setEnabled(True) def buttonSaveProject_Click(self): res = QMessageBox.question(self, "Alert", "Save changes to project information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_projectList.WriteProjectInfoXml() self.buttonSaveAIPChart.setEnabled(False) def buttonCloseProject_Click(self): self.accept() # if (self.buttonSaveAIPChart.Enabled == True) # { # DialogResult res = MessageBox.Show("Save changes to project information?", "Alert", MessageBoxButtons.YesNoCancel) # if (res == DialogResult.Yes) # { # self.buttonSaveProject_Click(sender, e) # } # else if (res == DialogResult.No) # { # } # else if (res == DialogResult.Cancel) # { # self.DialogResult = DialogResult.None # return # } # } # } def CheckInputValues(self): if (self.textNameAIPChart.Text == None or self.textNameAIPChart.Text == ""): QMessageBox.warning(self, "Warning", "Please input project name!") return False if (self.textPathAIPChart.Text == None or self.textPathAIPChart.Text == ""): QMessageBox.warning(self, "Warning", "Please input project path!") return False if (not QFile.exists(self.textPathAIPChart.Text)): QMessageBox.warning(self, "Warning", "Invalid AIP Chart!") return False return True def buttonModifyProject_Click(self): if (self.listBoxAIPChart.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select project in the projects list!") if (not self.CheckInputValues()): return index = AirCraftOperation.g_projectList.Find( self.listBoxAIPChart.Items[self.listBoxAIPChart.SelectedIndex]) AirCraftOperation.g_projectList.ProjectsList[ index].Pt = enumProjectType.ptAipChart AirCraftOperation.g_projectList.ProjectsList[ index].Name = self.textNameAIPChart.Text AirCraftOperation.g_projectList.ProjectsList[ index].Path = self.textPathAIPChart.Text AirCraftOperation.g_projectList.ProjectsList[ index].UserName = AirCraftOperation.g_loginedUser.Name self.buttonSaveAIPChart.setEnabled(True) self.listBoxAIPChart.Clear() for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptAipChart): self.listBoxAIPChart.Add(pi.Name) def buttonDeleteProject_Click(self): if (self.listBoxAIPChart.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select project in the projects list!") return AirCraftOperation.g_projectList.Remove( self.listBoxAIPChart.Items[self.listBoxAIPChart.SelectedIndex]) self.buttonSaveAIPChart.setEnabled(True) self.listBoxAIPChart.Clear() for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptAipChart): self.listBoxAIPChart.Add(pi.Name) def listBoxProject_SelectedIndexChanged(self): if (self.listBoxAIPChart.SelectedIndex < 0): return index = AirCraftOperation.g_projectList.Find( self.listBoxAIPChart.Items[self.listBoxAIPChart.SelectedIndex]) self.textNameAIPChart.Text = AirCraftOperation.g_projectList.ProjectsList[ index].Name self.textPathAIPChart.Text = AirCraftOperation.g_projectList.ProjectsList[ index].Path
class ProcedureMngForm(QDialog): def __init__(self, parent=None): QDialog.__init__(self) self.setObjectName(("ui_ProcedureMngForm")) self.resize(200, 200) font = QFont() font.setFamily(("Arial")) font.setBold(False) font.setWeight(50) self.setFont(font) self.vlForm = QVBoxLayout(self) self.vlForm.setObjectName(("vl_ProceduretMngForm")) self.vlForm.setSpacing(9) self.vlForm.setMargin(9) self.basicFrame = Frame(self) self.vlForm.addWidget(self.basicFrame) self.frameName = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.frameName self.frame = Frame(self.frameName) self.frameName.Add = self.frame self.comboProjectProcedure = ComboBoxPanel(self.frame) self.comboProjectProcedure.Caption = "Project" self.comboProjectProcedure.LabelWidth = 120 self.frame.Add = self.comboProjectProcedure self.comboSubProjectProcedure = ComboBoxPanel(self.frame) self.comboSubProjectProcedure.Caption = "Sub-Project" self.comboSubProjectProcedure.LabelWidth = 120 self.frame.Add = self.comboSubProjectProcedure self.comboWorkspaceProcedure = ComboBoxPanel(self.frame) self.comboWorkspaceProcedure.Caption = "Workspace" self.comboWorkspaceProcedure.LabelWidth = 120 self.frame.Add = self.comboWorkspaceProcedure self.textNameProcedure = TextBoxPanel(self.frame) self.textNameProcedure.Caption = "Procedure Name" self.textNameProcedure.LabelWidth = 120 self.textNameProcedure.Width = 120 self.frame.Add = self.textNameProcedure self.groubox = GroupBox(self.frameName) self.groubox.Caption = "Procedures" self.frameName.Add = self.groubox self.listBoxProcedure = ListBox(self.groubox) self.groubox.Add = self.listBoxProcedure self.textPathProcedure = TextBoxPanel(self.basicFrame) self.textPathProcedure.Caption = "Procedure Path" self.textPathProcedure.imageButton.setIcon(QIcon()) self.textPathProcedure.Button = "opens.png" self.textPathProcedure.LabelWidth = 120 self.textPathProcedure.textBox.setMaximumWidth(10000) self.textPathProcedure.textBox.setMinimumWidth(100) self.basicFrame.Add = self.textPathProcedure self.btnFrame = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.btnFrame self.buttonAddProcedure = QPushButton(self.btnFrame) self.buttonAddProcedure.setObjectName("buttonAddProcedure") self.buttonAddProcedure.setText("Add") self.btnFrame.Add = self.buttonAddProcedure self.buttonModifyProcedure = QPushButton(self.btnFrame) self.buttonModifyProcedure.setObjectName("buttonModifyProcedure") self.buttonModifyProcedure.setText("Modify") self.btnFrame.Add = self.buttonModifyProcedure self.buttonDeleteProcedure = QPushButton(self.btnFrame) self.buttonDeleteProcedure.setObjectName("buttonDeleteProcedure") self.buttonDeleteProcedure.setText("Delete") self.btnFrame.Add = self.buttonDeleteProcedure self.buttonSaveProcedure = QPushButton(self.btnFrame) self.buttonSaveProcedure.setObjectName("buttonSaveProcedure") self.buttonSaveProcedure.setText("Save") self.btnFrame.Add = self.buttonSaveProcedure self.buttonCloseProcedure = QPushButton(self.btnFrame) self.buttonCloseProcedure.setObjectName("buttonCloseProcedure") self.buttonCloseProcedure.setText("Close") self.btnFrame.Add = self.buttonCloseProcedure self.connect(self.listBoxProcedure, SIGNAL("Event_0"), self.listBoxProcedure_SelectedIndexChanged) self.connect(self.comboProjectProcedure, SIGNAL("Event_0"), self.comboProjectProcedure_SelectedIndexChanged) self.connect(self.comboSubProjectProcedure, SIGNAL("Event_0"), self.comboSubProjectProcedure_SelectedIndexChanged) self.connect(self.textPathProcedure, SIGNAL("Event_1"), self.buttonBrowseWorkspace_Click) self.buttonCloseProcedure.clicked.connect( self.buttonCloseProcedure_Click) self.buttonSaveProcedure.clicked.connect( self.buttonSaveProcedure_Click) self.buttonDeleteProcedure.clicked.connect( self.buttonDeleteProcedure_Click) self.buttonModifyProcedure.clicked.connect( self.buttonModifyProcedure_Click) self.buttonAddProcedure.clicked.connect(self.buttonAddProcedure_Click) for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptFile): self.listBoxProcedure.Add(pi.Name) elif (pi.Pt == enumProjectType.ptProject): self.comboProjectProcedure.Add(pi.Name) elif (pi.Pt == enumProjectType.ptSubProject): self.comboSubProjectProcedure.Add(pi.Name) elif (pi.Pt == enumProjectType.ptWorkspace): self.comboWorkspaceProcedure.Add(pi.Name) self.comboProjectProcedure_SelectedIndexChanged() self.comboSubProjectProcedure_SelectedIndexChanged() def CheckInputValues(self): if (self.textNameProcedure.Text == None or self.textNameProcedure.Text == ""): QMessageBox.warning(self, "Warning", "Please input project name!") return False if (self.textPathProcedure.Text == None or self.textPathProcedure.Text == ""): QMessageBox.warning(self, "Warning", "Please input project path!") return False if (self.comboProjectProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select an Project!") return False if (self.comboSubProjectProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select an Sub-Project!") return False if (self.comboWorkspaceProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select an Workspace!") return directory = QDir(self.textPathProcedure.Text) if (not directory.exists()): if (QMessageBox.question( self, "Question", "Procedure path dose not exist! Do you create the directory?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes): directory.mkpath(self.textPathProcedure.Text) else: return False return True # private void WorkspaceMngForm_Load(object sender, EventArgs e) # { # try # { # foreach (ProjectInfo pi in AirCraftOperation.g_projectList.ProjectsList) # { # if (pi.Pt == enumProjectType.ptFile) # { # self.listBoxProcedure.Items.Add(pi.Name) # } # else if (pi.Pt == enumProjectType.ptProject) # { # self.comboProjectProcedure.Items.Add(pi.Name) # } # else if (pi.Pt == enumProjectType.ptSubProject) # { # self.comboSubProjectProcedure.Items.Add(pi.Name) # } # else if (pi.Pt == enumProjectType.ptWorkspace) # { # self.comboWorkspaceProcedure.Items.Add(pi.Name) # } # } # } # catch (System.Exception ex) # { # MessageBox.Show(ex.Message) # } # } def listBoxProcedure_SelectedIndexChanged(self): if (self.listBoxProcedure.SelectedIndex < 0): return pi = AirCraftOperation.g_projectList.Find( self.listBoxProcedure.Items[self.listBoxProcedure.SelectedIndex]) self.textNameProcedure.Text = AirCraftOperation.g_projectList.ProjectsList[ pi].Name self.textPathProcedure.Text = AirCraftOperation.g_projectList.ProjectsList[ pi].Path self.comboProjectProcedure.SelectedIndex = self.comboProjectProcedure.IndexOf( AirCraftOperation.g_projectList.ProjectsList[pi].ProjName) self.comboSubProjectProcedure.SelectedIndex = self.comboSubProjectProcedure.IndexOf( AirCraftOperation.g_projectList.ProjectsList[pi].SubProjName) self.comboWorkspaceProcedure.SelectedIndex = self.comboWorkspaceProcedure.IndexOf( AirCraftOperation.g_projectList.ProjectsList[pi].WorkspaceName) def buttonBrowseWorkspace_Click(self): folderPath = QFileDialog.getExistingDirectory(self, "Open Project Path") if (folderPath != None and folderPath != ""): self.textPathProcedure.Value = folderPath def buttonSaveProcedure_Click(self): res = QMessageBox.question(self, "Question", "Save changes to project information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_projectList.WriteProjectInfoXml() self.buttonSaveProcedure.setEnabled(False) def buttonCloseProcedure_Click(self): # if (self.buttonSaveProcedure.isEnabled() == True): # DialogResult res = MessageBox.Show("Save changes to project information?", "Alert", MessageBoxButtons.YesNoCancel) # if (res == DialogResult.Yes) # { # self.buttonSaveWorkspace_Click(sender, e) # } # else if (res == DialogResult.No) # { # } # else if (res == DialogResult.Cancel) # { # self.DialogResult = DialogResult.None # return # } # } self.accept() def buttonAddProcedure_Click(self): if (not self.CheckInputValues()): return if (AirCraftOperation.g_projectList.Find(self.textNameProcedure.Text) != None): QMessageBox.warning(self, "Warning", "The same name exist!") return pi = ProjectInfo() pi.Pt = enumProjectType.ptFile pi.Name = self.textNameProcedure.Text pi.Path = self.textPathProcedure.Text pi.ProjName = self.comboProjectProcedure.SelectedItem pi.SubProjName = self.comboSubProjectProcedure.SelectedItem pi.WorkspaceName = self.comboWorkspaceProcedure.SelectedItem pi.UserName = AirCraftOperation.g_loginedUser.Name AirCraftOperation.g_projectList.Add(pi) nIndex = self.listBoxProcedure.Add(pi.Name) self.listBoxProcedure.SelectedIndex = nIndex self.buttonSaveProcedure.setEnabled(True) def buttonModifyProcedure_Click(self): if (self.listBoxProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select project in the projects list!") return if (not self.CheckInputValues()): return index = AirCraftOperation.g_projectList.Find( self.listBoxProcedure.Items[self.listBoxProcedure.SelectedIndex]) AirCraftOperation.g_projectList.ProjectsList[ index].Pt = enumProjectType.ptFile AirCraftOperation.g_projectList.ProjectsList[ index].Name = self.textNameProcedure.Text AirCraftOperation.g_projectList.ProjectsList[ index].Path = self.textPathProcedure.Text AirCraftOperation.g_projectList.ProjectsList[ index].ProjName = self.comboProjectProcedure.SelectedItem AirCraftOperation.g_projectList.ProjectsList[ index].SubProjName = self.comboSubProjectProcedure.SelectedItem AirCraftOperation.g_projectList.ProjectsList[ index].WorkspaceName = self.comboWorkspaceProcedure.SelectedItem AirCraftOperation.g_projectList.ProjectsList[ index].UserName = AirCraftOperation.g_loginedUser.Name self.listBoxProcedure.Clear() for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptFile): self.listBoxProcedure.Add(pi.Name) # AirCraftOperation.g_projectList.Remove(pi) # # AirCraftOperation.g_projectList.Add(pi) self.buttonSaveProcedure.setEnabled(True) def buttonDeleteProcedure_Click(self): if (self.listBoxProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select project in the projects list!") return if (QMessageBox.question( self, "Question", "Are you sure to delete " + self.listBoxProcedure.Items[ self.listBoxProcedure.SelectedIndex] + "?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.No): return AirCraftOperation.g_projectList.Remove( self.listBoxProcedure.Items[self.listBoxProcedure.SelectedIndex], enumProjectType.ptFile) self.buttonSaveProcedure.setEnabled(True) self.listBoxProcedure.Clear() for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptFile): self.listBoxProcedure.Add(pi.Name) def comboProjectProcedure_SelectedIndexChanged(self): listSubprojects = AirCraftOperation.g_projectList.GetLinkedProjects( self.comboProjectProcedure.SelectedItem, enumProjectType.ptProject, enumProjectType.ptSubProject) self.comboSubProjectProcedure.Clear() if (listSubprojects != None and len(listSubprojects) > 0): self.comboSubProjectProcedure.Items = listSubprojects self.comboSubProjectProcedure.SelectedIndex = 0 self.comboSubProjectProcedure_SelectedIndexChanged() def comboSubProjectProcedure_SelectedIndexChanged(self): listWorkspace = AirCraftOperation.g_projectList.GetLinkedProjects( self.comboSubProjectProcedure.SelectedItem, enumProjectType.ptSubProject, enumProjectType.ptWorkspace) self.comboWorkspaceProcedure.Clear() if (listWorkspace != None and len(listWorkspace) > 0): self.comboWorkspaceProcedure.Items = listWorkspace self.comboWorkspaceProcedure.SelectedIndex = 0
class SubProjectMngForm(QDialog): def __init__(self, parent=None): QDialog.__init__(self, parent) self.setObjectName("ui_SubProjectMngForm") self.resize(200, 200) font = QFont() font.setFamily("Arial") font.setBold(False) font.setWeight(50) self.setFont(font) self.vlForm = QVBoxLayout(self) self.vlForm.setObjectName("vl_ProjectMngForm") self.vlForm.setSpacing(9) self.vlForm.setMargin(9) self.setWindowTitle("SubProject Manage Dialog") self.basicFrame = Frame(self) self.vlForm.addWidget(self.basicFrame) self.frameName = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.frameName self.frame = Frame(self.frameName) self.frameName.Add = self.frame self.comboProjectSubproject = ComboBoxPanel(self.frame) self.comboProjectSubproject.Caption = "Project" self.comboProjectSubproject.LabelWidth = 120 self.frame.Add = self.comboProjectSubproject self.textNameSubproject = TextBoxPanel(self.frame) self.textNameSubproject.Caption = "Sub-Project Name" self.textNameSubproject.LabelWidth = 120 self.textNameSubproject.Width = 120 self.frame.Add = self.textNameSubproject self.textFullName = TextBoxPanel(self.frame) self.textFullName.Caption = "Full Name" self.textFullName.LabelWidth = 120 self.textFullName.Width = 120 self.textFullName.Visible = False self.frame.Add = self.textFullName self.groubox = GroupBox(self.frameName) self.groubox.Caption = "Sub-Projects" self.frameName.Add = self.groubox self.listBoxSubproject = ListBox(self.groubox) self.groubox.Add = self.listBoxSubproject self.textPathSubproject = TextBoxPanel(self.basicFrame) self.textPathSubproject.Caption = "Sub-Project Path" self.textPathSubproject.imageButton.setIcon(QIcon()) self.textPathSubproject.Button = "opens.png" self.textPathSubproject.LabelWidth = 120 self.textPathSubproject.textBox.setMaximumWidth(10000) self.textPathSubproject.textBox.setMinimumWidth(100) self.basicFrame.Add = self.textPathSubproject self.btnFrame = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.btnFrame self.buttonAddSubproject = QPushButton(self.btnFrame) self.buttonAddSubproject.setObjectName("buttonAddSubproject") self.buttonAddSubproject.setText("Add") self.btnFrame.Add = self.buttonAddSubproject self.buttonModifySubproject = QPushButton(self.btnFrame) self.buttonModifySubproject.setObjectName("buttonModifySubproject") self.buttonModifySubproject.setText("Modify") self.btnFrame.Add = self.buttonModifySubproject self.buttonDeleteSubproject = QPushButton(self.btnFrame) self.buttonDeleteSubproject.setObjectName("buttonDeleteSubproject") self.buttonDeleteSubproject.setText("Delete") self.btnFrame.Add = self.buttonDeleteSubproject self.buttonCloseSubproject = QPushButton(self.btnFrame) self.buttonCloseSubproject.setObjectName("buttonCloseSubproject") self.buttonCloseSubproject.setText("Close") self.btnFrame.Add = self.buttonCloseSubproject self.connect(self.listBoxSubproject, SIGNAL("Event_0"), self.listBoxSubproject_SelectedIndexChanged) self.connect(self.textPathSubproject, SIGNAL("Event_1"), self.buttonBrowseSubproject_Click) self.connect(self.textNameSubproject, SIGNAL("Event_0"), self.setFullName) self.connect(self.comboProjectSubproject, SIGNAL("Event_0"), self.setFullNameProjectNameChanged) self.buttonCloseSubproject.clicked.connect( self.buttonCloseSubproject_Click) self.buttonDeleteSubproject.clicked.connect( self.buttonDeleteSubproject_Click) self.buttonModifySubproject.clicked.connect( self.buttonModifySubproject_Click) self.buttonAddSubproject.clicked.connect( self.buttonAddSubproject_Click) self.editFlag = True for pi in AirCraftOperation.g_projectList.ProjectsList: if pi.Pt == enumProjectType.ptSubProject: self.listBoxSubproject.Add(pi.Name) elif pi.Pt == enumProjectType.ptProject: self.comboProjectSubproject.Add(pi.Name) self.editFlag = False self.setFullNameProjectNameChanged() def setFullName(self): if self.editFlag: return if self.comboProjectSubproject.Count <= 0: return self.editFlag = True index = AirCraftOperation.g_projectList.Find( self.comboProjectSubproject.SelectedItem, enumProjectType.ptProject) projPath = AirCraftOperation.g_projectList.ProjectsList[index].Path self.textFullName.Value = self.comboProjectSubproject.SelectedItem + "_" + self.textNameSubproject.Value self.textPathSubproject.Value = projPath + "/" + self.textNameSubproject.Value self.editFlag = False def setFullNameProjectNameChanged(self): if self.editFlag: return self.editFlag = True index = AirCraftOperation.g_projectList.Find( self.comboProjectSubproject.SelectedItem, enumProjectType.ptProject) if index is None: self.editFlag = False return projPath = AirCraftOperation.g_projectList.ProjectsList[index].Path d = QDir(projPath) fileInfoList = d.entryInfoList() self.listBoxSubproject.Clear() self.textNameSubproject.Value = "" piList = AirCraftOperation.g_projectList.FindProjectListByPt( enumProjectType.ptSubProject) if len(piList) == 0: self.editFlag = False self.textPathSubproject.Value = projPath + "/" + self.textNameSubproject.Value self.textFullName.Value = self.comboProjectSubproject.SelectedItem + "_" + self.textNameSubproject.Value return subProjNameList = [] i = 0 for pi in piList: if pi.ProjName == self.comboProjectSubproject.SelectedItem: subProjNameList.append(pi.SubProjName) self.listBoxSubproject.Add(pi.SubProjName) i += 1 if len(subProjNameList) > 0: self.textNameSubproject.Value = subProjNameList[0] self.textFullName.Value = self.comboProjectSubproject.SelectedItem + "_" + self.textNameSubproject.Value self.textPathSubproject.Value = projPath + "/" + self.textNameSubproject.Value self.editFlag = False def CheckInputValues(self): if self.textNameSubproject.Text is None or self.textNameSubproject.Text == "": QMessageBox.warning(self, "Warning", "Please input project name!") return False if self.textPathSubproject.Text is None or self.textPathSubproject.Text == "": QMessageBox.warning(self, "Warning", "Please input project path!") return False if self.comboProjectSubproject.SelectedIndex < 0: QMessageBox.warning(self, "Warning", "Please select an project!") return False directory = QDir(self.textPathSubproject.Text) if not directory.exists(): if QMessageBox.question( self, "Question", "Procedure path dose not exist! Do you create the directory?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes: directory.mkpath(self.textPathSubproject.Text) else: return False return True def listBoxSubproject_SelectedIndexChanged(self): if self.listBoxSubproject.SelectedIndex < 0: return self.textFullName.Value = self.comboProjectSubproject.SelectedItem + "_" + self.listBoxSubproject.Items[ self.listBoxSubproject.SelectedIndex] pi = AirCraftOperation.g_projectList.Find(self.textFullName.Value) self.textNameSubproject.Text = AirCraftOperation.g_projectList.ProjectsList[ pi].Name self.textPathSubproject.Text = AirCraftOperation.g_projectList.ProjectsList[ pi].Path self.comboProjectSubproject.SelectedIndex = self.comboProjectSubproject.IndexOf( AirCraftOperation.g_projectList.ProjectsList[pi].ProjName) def buttonBrowseSubproject_Click(self): folderPath = QFileDialog.getExistingDirectory(self, "Open Project Path", define.projectManageDir) if folderPath is not None and folderPath != "": self.textPathSubproject.Value = folderPath define.projectManageDir = folderPath def buttonCloseSubproject_Click(self): res = QMessageBox.question(self, "Question", "Save changes to project information?", QMessageBox.Yes | QMessageBox.No) if res == QMessageBox.Yes: AirCraftOperation.g_projectList.WriteProjectInfoXml() self.accept() def buttonAddSubproject_Click(self): if not self.CheckInputValues(): return if AirCraftOperation.g_projectList.Find( self.textFullName.Text) is not None: QMessageBox.warning(self, "Warning", "The same sub-project exist!") return pi = ProjectInfo() pi.Pt = enumProjectType.ptSubProject pi.Name = self.textNameSubproject.Text pi.SubProjName = self.textNameSubproject.Text pi.Path = self.textPathSubproject.Text pi.ProjName = self.comboProjectSubproject.SelectedItem pi.UserName = AirCraftOperation.loginedUser.Name pi.FullName = self.textFullName.Value AirCraftOperation.g_projectList.Add(pi) nIndex = self.listBoxSubproject.Add(pi.Name) self.listBoxSubproject.SelectedIndex = nIndex def buttonModifySubproject_Click(self): if self.listBoxSubproject.SelectedIndex < 0: QMessageBox.warning(self, "Warning", "Please select project in the projects list!") return if not self.CheckInputValues(): return index = AirCraftOperation.g_projectList.Find( self.comboProjectSubproject.SelectedItem + "_" + self.listBoxSubproject.Items[self.listBoxSubproject.SelectedIndex]) AirCraftOperation.g_projectList.ProjectsList[ index].Pt = enumProjectType.ptSubProject AirCraftOperation.g_projectList.ProjectsList[ index].Name = self.textNameSubproject.Text AirCraftOperation.g_projectList.ProjectsList[ index].SubProjName = self.textNameSubproject.Text AirCraftOperation.g_projectList.ProjectsList[ index].Path = self.textPathSubproject.Text AirCraftOperation.g_projectList.ProjectsList[ index].ProjName = self.comboProjectSubproject.SelectedItem AirCraftOperation.g_projectList.ProjectsList[ index].UserName = AirCraftOperation.loginedUser.Name AirCraftOperation.g_projectList.ProjectsList[ index].FullName = self.textFullName.Value self.listBoxSubproject.Clear() for pi in AirCraftOperation.g_projectList.ProjectsList: if pi.Pt == enumProjectType.ptSubProject: self.listBoxSubproject.Add(pi.Name) def buttonDeleteSubproject_Click(self): if self.listBoxSubproject.SelectedIndex < 0: QMessageBox.warning(self, "Warning", "Please select project in the projects list!") return if QMessageBox.question( self, "Question", "Are you sure to delete " + self.listBoxSubproject.Items[ self.listBoxSubproject.SelectedIndex] + "?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.No: return AirCraftOperation.g_projectList.Remove(self.textFullName.Value) self.listBoxSubproject.Clear() self.setFullNameProjectNameChanged() AirCraftOperation.g_projectList.WriteProjectInfoXml()
class ProcedureMngForm(QDialog): def __init__(self, parent=None): QDialog.__init__(self) self.setObjectName(("ui_ProcedureMngForm")) self.resize(200, 200) font = QFont() font.setFamily(("Arial")) font.setBold(False) font.setWeight(50) self.setFont(font) self.setWindowTitle("Procedure Manage Dialog") self.vlForm = QVBoxLayout(self) self.vlForm.setObjectName(("vl_ProceduretMngForm")) self.vlForm.setSpacing(9) self.vlForm.setMargin(9) self.basicFrame = Frame(self) self.vlForm.addWidget(self.basicFrame) self.frameName = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.frameName self.frame = Frame(self.frameName) self.frameName.Add = self.frame self.comboProjectProcedure = ComboBoxPanel(self.frame) self.comboProjectProcedure.Caption = "Project" self.comboProjectProcedure.LabelWidth = 120 self.frame.Add = self.comboProjectProcedure self.comboSubProjectProcedure = ComboBoxPanel(self.frame) self.comboSubProjectProcedure.Caption = "Sub-Project" self.comboSubProjectProcedure.LabelWidth = 120 self.frame.Add = self.comboSubProjectProcedure self.comboWorkspaceProcedure = ComboBoxPanel(self.frame) self.comboWorkspaceProcedure.Caption = "Workspace" self.comboWorkspaceProcedure.LabelWidth = 120 self.frame.Add = self.comboWorkspaceProcedure self.textNameProcedure = TextBoxPanel(self.frame) self.textNameProcedure.Caption = "Procedure Name" self.textNameProcedure.LabelWidth = 120 self.textNameProcedure.Width = 120 self.frame.Add = self.textNameProcedure self.textFullName = TextBoxPanel(self.frame) self.textFullName.Caption = "Full Name" self.textFullName.LabelWidth = 120 self.textFullName.Width = 120 self.textFullName.Visible = False self.frame.Add = self.textFullName self.groubox = GroupBox(self.frameName) self.groubox.Caption = "Procedures" self.frameName.Add = self.groubox self.listBoxProcedure = ListBox(self.groubox) self.groubox.Add = self.listBoxProcedure self.textPathProcedure = TextBoxPanel(self.basicFrame) self.textPathProcedure.Caption = "Procedure Path" self.textPathProcedure.imageButton.setIcon(QIcon()) self.textPathProcedure.Button = "opens.png" self.textPathProcedure.LabelWidth = 120 self.textPathProcedure.textBox.setMaximumWidth(10000) self.textPathProcedure.textBox.setMinimumWidth(100) self.basicFrame.Add = self.textPathProcedure self.btnFrame = Frame(self.basicFrame, "HL") self.basicFrame.Add = self.btnFrame self.buttonAddProcedure = QPushButton(self.btnFrame) self.buttonAddProcedure.setObjectName("buttonAddProcedure") self.buttonAddProcedure.setText("Add") self.btnFrame.Add = self.buttonAddProcedure self.buttonModifyProcedure = QPushButton(self.btnFrame) self.buttonModifyProcedure.setObjectName("buttonModifyProcedure") self.buttonModifyProcedure.setText("Modify") self.btnFrame.Add = self.buttonModifyProcedure self.buttonDeleteProcedure = QPushButton(self.btnFrame) self.buttonDeleteProcedure.setObjectName("buttonDeleteProcedure") self.buttonDeleteProcedure.setText("Delete") self.btnFrame.Add = self.buttonDeleteProcedure self.buttonSaveProcedure = QPushButton(self.btnFrame) self.buttonSaveProcedure.setObjectName("buttonSaveProcedure") self.buttonSaveProcedure.setText("Save") self.buttonSaveProcedure.setVisible(False) self.btnFrame.Add = self.buttonSaveProcedure self.buttonCloseProcedure = QPushButton(self.btnFrame) self.buttonCloseProcedure.setObjectName("buttonCloseProcedure") self.buttonCloseProcedure.setText("Close") self.btnFrame.Add = self.buttonCloseProcedure self.connect(self.listBoxProcedure, SIGNAL("Event_0"), self.listBoxProcedure_SelectedIndexChanged) self.connect(self.comboProjectProcedure, SIGNAL("Event_0"), self.comboProjectProcedure_SelectedIndexChanged) self.connect(self.comboSubProjectProcedure, SIGNAL("Event_0"), self.comboSubProjectProcedure_SelectedIndexChanged) self.connect(self.textPathProcedure, SIGNAL("Event_1"), self.buttonBrowseWorkspace_Click) self.connect(self.comboWorkspaceProcedure, SIGNAL("Event_0"), self.comboWorkspaceProcedure_SelectedIndexChanged) self.connect(self.textNameProcedure, SIGNAL("Event_0"), self.setFullName) self.buttonCloseProcedure.clicked.connect( self.buttonCloseProcedure_Click) self.buttonSaveProcedure.clicked.connect( self.buttonSaveProcedure_Click) self.buttonDeleteProcedure.clicked.connect( self.buttonDeleteProcedure_Click) self.buttonModifyProcedure.clicked.connect( self.buttonModifyProcedure_Click) self.buttonAddProcedure.clicked.connect(self.buttonAddProcedure_Click) self.editFlag = True for pi in AirCraftOperation.g_projectList.ProjectsList: if (pi.Pt == enumProjectType.ptFile): self.listBoxProcedure.Add(pi.Name) elif (pi.Pt == enumProjectType.ptProject): self.comboProjectProcedure.Add(pi.Name) elif (pi.Pt == enumProjectType.ptSubProject): self.comboSubProjectProcedure.Add(pi.Name) elif (pi.Pt == enumProjectType.ptWorkspace): self.comboWorkspaceProcedure.Add(pi.Name) self.editFlag = False self.comboProjectProcedure_SelectedIndexChanged() def setFullName(self): if self.editFlag: return self.editFlag = True index = AirCraftOperation.g_projectList.GetIndexOfWsOrProcedure( enumProjectType.ptWorkspace, self.comboProjectProcedure.SelectedItem, self.comboSubProjectProcedure.SelectedItem, self.comboWorkspaceProcedure.SelectedItem) if index == None: self.editFlag = False return projPath = AirCraftOperation.g_projectList.ProjectsList[index].Path self.textFullName.Value = self.comboProjectProcedure.SelectedItem + "_" + self.comboSubProjectProcedure.SelectedItem + "_" + self.comboWorkspaceProcedure.SelectedItem + "_" + self.textNameProcedure.Text self.textPathProcedure.Value = projPath + "/" + self.textNameProcedure.Value self.editFlag = False def CheckInputValues(self): if (self.textNameProcedure.Text == None or self.textNameProcedure.Text == ""): QMessageBox.warning(self, "Warning", "Please input project name!") return False if (self.textPathProcedure.Text == None or self.textPathProcedure.Text == ""): QMessageBox.warning(self, "Warning", "Please input project path!") return False if (self.comboProjectProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select an Project!") return False if (self.comboSubProjectProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select an Sub-Project!") return False if (self.comboWorkspaceProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select an Workspace!") return directory = QDir(self.textPathProcedure.Text) if (not directory.exists()): if (QMessageBox.question( self, "Question", "Procedure path dose not exist! Do you create the directory?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes): directory.mkpath(self.textPathProcedure.Text) else: return False return True def listBoxProcedure_SelectedIndexChanged(self): if (self.listBoxProcedure.SelectedIndex < 0): return pi = AirCraftOperation.g_projectList.Find( self.listBoxProcedure.Items[self.listBoxProcedure.SelectedIndex]) pi = AirCraftOperation.g_projectList.GetIndexOfWsOrProcedure( enumProjectType.ptFile, self.comboProjectProcedure.SelectedItem, self.comboSubProjectProcedure.SelectedItem, self.comboWorkspaceProcedure.SelectedItem, self.listBoxProcedure.Items[self.listBoxProcedure.SelectedIndex]) if pi == None: return self.textNameProcedure.Text = AirCraftOperation.g_projectList.ProjectsList[ pi].Name self.textPathProcedure.Text = AirCraftOperation.g_projectList.ProjectsList[ pi].Path self.comboProjectProcedure.SelectedIndex = self.comboProjectProcedure.IndexOf( AirCraftOperation.g_projectList.ProjectsList[pi].ProjName) self.comboSubProjectProcedure.SelectedIndex = self.comboSubProjectProcedure.IndexOf( AirCraftOperation.g_projectList.ProjectsList[pi].SubProjName) self.comboWorkspaceProcedure.SelectedIndex = self.comboWorkspaceProcedure.IndexOf( AirCraftOperation.g_projectList.ProjectsList[pi].WorkspaceName) def buttonBrowseWorkspace_Click(self): folderPath = QFileDialog.getExistingDirectory(self, "Open Project Path", define.projectManageDir) if (folderPath != None and folderPath != ""): self.textPathProcedure.Value = folderPath define.projectManageDir = folderPath def buttonSaveProcedure_Click(self): res = QMessageBox.question(self, "Question", "Save changes to project information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_projectList.WriteProjectInfoXml() self.buttonSaveProcedure.setEnabled(False) def buttonCloseProcedure_Click(self): res = QMessageBox.question(self, "Question", "Save changes to project information?", QMessageBox.Yes | QMessageBox.No) if (res == QMessageBox.Yes): AirCraftOperation.g_projectList.WriteProjectInfoXml() self.buttonSaveProcedure.setEnabled(False) self.accept() def buttonAddProcedure_Click(self): if (not self.CheckInputValues()): return index = AirCraftOperation.g_projectList.GetIndexOfWsOrProcedure( enumProjectType.ptFile, self.comboProjectProcedure.SelectedItem, self.comboSubProjectProcedure.SelectedItem, self.comboWorkspaceProcedure.SelectedItem, self.textNameProcedure.Text) if (index != None): QMessageBox.warning(self, "Warning", "The same name exist!") return pi = ProjectInfo() pi.Pt = enumProjectType.ptFile pi.Name = self.textNameProcedure.Text pi.ProcedureName = self.textNameProcedure.Text pi.Path = self.textPathProcedure.Text pi.ProjName = self.comboProjectProcedure.SelectedItem pi.SubProjName = self.comboSubProjectProcedure.SelectedItem pi.WorkspaceName = self.comboWorkspaceProcedure.SelectedItem pi.FullName = self.textFullName.Text pi.UserName = AirCraftOperation.loginedUser.Name AirCraftOperation.g_projectList.Add(pi) nIndex = self.listBoxProcedure.Add(pi.Name) self.listBoxProcedure.SelectedIndex = nIndex self.buttonSaveProcedure.setEnabled(True) def buttonModifyProcedure_Click(self): if (self.listBoxProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select project in the projects list!") return if (not self.CheckInputValues()): return index = AirCraftOperation.g_projectList.GetIndexOfWsOrProcedure( enumProjectType.ptFile, self.comboProjectProcedure.SelectedItem, self.comboSubProjectProcedure.SelectedItem, self.comboWorkspaceProcedure.SelectedItem, self.listBoxProcedure.Items[self.listBoxProcedure.SelectedIndex]) AirCraftOperation.g_projectList.ProjectsList[ index].Pt = enumProjectType.ptFile AirCraftOperation.g_projectList.ProjectsList[ index].Name = self.textNameProcedure.Text AirCraftOperation.g_projectList.ProjectsList[ index].ProcedureName = self.textNameProcedure.Text AirCraftOperation.g_projectList.ProjectsList[ index].Path = self.textPathProcedure.Text AirCraftOperation.g_projectList.ProjectsList[ index].ProjName = self.comboProjectProcedure.SelectedItem AirCraftOperation.g_projectList.ProjectsList[ index].SubProjName = self.comboSubProjectProcedure.SelectedItem AirCraftOperation.g_projectList.ProjectsList[ index].WorkspaceName = self.comboWorkspaceProcedure.SelectedItem AirCraftOperation.g_projectList.ProjectsList[ index].FullName = self.textFullName.Text AirCraftOperation.g_projectList.ProjectsList[ index].UserName = AirCraftOperation.loginedUser.Name self.listBoxProcedure.Clear() self.comboProjectProcedure_SelectedIndexChanged() # for pi in AirCraftOperation.g_projectList.ProjectsList: # if (pi.Pt == enumProjectType.ptFile): # self.listBoxProcedure.Add(pi.Name) # AirCraftOperation.g_projectList.Remove(pi) # # AirCraftOperation.g_projectList.Add(pi) self.buttonSaveProcedure.setEnabled(True) def buttonDeleteProcedure_Click(self): if (self.listBoxProcedure.SelectedIndex < 0): QMessageBox.warning(self, "Warning", "Please select project in the projects list!") return if (QMessageBox.question( self, "Question", "Are you sure to delete " + self.listBoxProcedure.Items[ self.listBoxProcedure.SelectedIndex] + "?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.No): return index = AirCraftOperation.g_projectList.GetIndexOfWsOrProcedure( enumProjectType.ptFile, self.comboProjectProcedure.SelectedItem, self.comboSubProjectProcedure.SelectedItem, self.comboWorkspaceProcedure.SelectedItem, self.listBoxProcedure.Items[self.listBoxProcedure.SelectedIndex]) AirCraftOperation.g_projectList.Remove(index) self.buttonSaveProcedure.setEnabled(True) self.listBoxProcedure.Clear() self.comboProjectProcedure_SelectedIndexChanged() AirCraftOperation.g_projectList.WriteProjectInfoXml() # for pi in AirCraftOperation.g_projectList.ProjectsList: # if (pi.Pt == enumProjectType.ptFile): # self.listBoxProcedure.Add(pi.Name) def comboProjectProcedure_SelectedIndexChanged(self): if self.editFlag: return listSubprojects = AirCraftOperation.g_projectList.GetLinkedProjects( self.comboProjectProcedure.SelectedItem, enumProjectType.ptProject, enumProjectType.ptSubProject) self.editFlag = True self.comboSubProjectProcedure.Clear() if (listSubprojects != None and len(listSubprojects) > 0): self.comboSubProjectProcedure.Items = listSubprojects self.comboSubProjectProcedure.SelectedIndex = 0 self.editFlag = False self.comboSubProjectProcedure_SelectedIndexChanged() def comboSubProjectProcedure_SelectedIndexChanged(self): if self.editFlag: return listWorkspaceList = AirCraftOperation.g_projectList.GetListOfWsOrProcedure( enumProjectType.ptWorkspace, self.comboProjectProcedure.SelectedItem, self.comboSubProjectProcedure.SelectedItem) self.editFlag = True self.comboWorkspaceProcedure.Clear() if (listWorkspaceList != None and len(listWorkspaceList) > 0): self.comboWorkspaceProcedure.Items = listWorkspaceList self.comboWorkspaceProcedure.SelectedIndex = 0 self.editFlag = False self.comboWorkspaceProcedure_SelectedIndexChanged() def comboWorkspaceProcedure_SelectedIndexChanged(self): if self.editFlag: return listProcedureList = AirCraftOperation.g_projectList.GetListOfWsOrProcedure( enumProjectType.ptFile, self.comboProjectProcedure.SelectedItem, self.comboSubProjectProcedure.SelectedItem, self.comboWorkspaceProcedure.SelectedItem) self.textNameProcedure.Text = "" self.listBoxProcedure.Clear() self.editFlag = True if len(listProcedureList) > 0: self.listBoxProcedure.Items = listProcedureList self.listBoxProcedure.SelectedIndex = 0 self.editFlag = False self.setFullName()