Пример #1
0
 def open_ico(self): #引入ICO
     try:
         fileName1 = QFileDialog.getOpenFileName(self,
                                                           "Open ICO",
                                                 g.cur_file_dir()+"\ICO",
                                                           "ICO Files (*.ico)")   #设置文件扩展名过滤,注意用双分号间隔
         if not self.re_select(g.cur_file_dir().replace("\\","/"),str(fileName1)):
             msg.msg_box(u"操作提示",u"请本目录下ICO!")
             return
         name_file=g.cur_file_dir()   #当前程序路径
         fileName1=str(fileName1)[len(str(name_file))+1:]
         self.ico_path=str(fileName1)
         from os.path import isfile
         if isfile(self.ico_path):
             try:
                 # 你的代码
                 # path=QPixmap(r'%s'%(str(self.ico_path)))
                 # self.label_ICO.setPixmap(path)
                 # self.label_ICO.resize(path.width(),path.height())
                 self.label_ICO.setStyleSheet("background: transparent url(%s) no-repeat center center;"%(str(self.ico_path)))
             except BaseException, e:
                 pass
         #from os.path import isfile
         #if isfile(self.saveHistoryFilename):
     except BaseException, e:
         log.logging.debug("except:%s"%(str(e)))
Пример #2
0
 def while_export_shell(self):  #选择导出
     try:
         data=""
         self.window = QtGui.QMainWindow()
         files= QFileDialog.getSaveFileName(self.window,
                                            u"文件保存",
                                            u"%s\\"%(g.cur_file_dir()),
                                            "Text Files (*.txt)")
         if len(files):
             int_model = self.main_ui.tableWidget.selectionModel()  #获取选中编号
             if len(int_model.selectedRows())>=1:
                 for index in int_model.selectedRows():       #// 对于被选中的每一行
                     try:
                         int_index=index.row()#获取行号
                         ID=self.main_ui.tableWidget.item(int(int_index),0).text()  #获取某一格内容
                         #print ID
                         self.id_shell_list=db_shell.id_sitetable_shell(str(ID))  #通过ID查询SHELL的状态
                         #self.id=str(self.id_shell_list[0])         #自动编号
                         #self.type_id=str(self.id_shell_list[1])    #      类别
                         self.siteurl=str(self.id_shell_list[2])    #    网址
                         self.sitepass=str(self.id_shell_list[3])   #    密码
                         data+="%s|%s\r\n"%(str(self.siteurl),str(self.sitepass))
                     except BaseException, e:
                         pass
                 if self.TXT_file2(files,data):
                     msg.msg_lower_Left(u"导出SHELL %s 成功"%(str(files)))#设置状态栏文字信息
                     msg.msg_box(u"导出SHELL",u"导出SHELL %s 成功"%(str(files)))
                 else:
                     msg.msg_lower_Left(u"导出SHELL %s 失败"%(str(files)))#设置状态栏文字信息
                     msg.msg_box(u"导出SHELL",u"导出SHELL %s 失败"%(str(files)))
     except BaseException, e:
         log.logging.debug("except:%s"%(str(e)))
Пример #3
0
 def while_export_shell(self):  #选择导出
     try:
         data=""
         self.window = QtGui.QMainWindow()
         files= QFileDialog.getSaveFileName(self.window,
                                            u"文件保存",
                                            u"%s\\"%(g.cur_file_dir()),
                                            "Text Files (*.txt)")
         if len(files):
             int_model = self.main_ui.tableWidget.selectionModel()  #获取选中编号
             if len(int_model.selectedRows())>=1:
                 for index in int_model.selectedRows():       #// 对于被选中的每一行
                     try:
                         int_index=index.row()#获取行号
                         ID=self.main_ui.tableWidget.item(int(int_index),0).text()  #获取某一格内容
                         #print ID
                         self.id_shell_list=db_shell.id_sitetable_shell(str(ID))  #通过ID查询SHELL的状态
                         #self.id=str(self.id_shell_list[0])         #自动编号
                         #self.type_id=str(self.id_shell_list[1])    #      类别
                         self.siteurl=str(self.id_shell_list[2])    #    网址
                         self.sitepass=str(self.id_shell_list[3])   #    密码
                         data+="%s|%s\r\n"%(str(self.siteurl),str(self.sitepass))
                     except BaseException, e:
                         pass
                 if self.TXT_file2(files,data):
                     msg.msg_lower_Left(u"导出SHELL %s 成功"%(str(files)))#设置状态栏文字信息
                     msg.msg_box(u"导出SHELL",u"导出SHELL %s 成功"%(str(files)))
                 else:
                     msg.msg_lower_Left(u"导出SHELL %s 失败"%(str(files)))#设置状态栏文字信息
                     msg.msg_box(u"导出SHELL",u"导出SHELL %s 失败"%(str(files)))
     except BaseException, e:
         log.logging.debug("except:%s"%(str(e)))
Пример #4
0
 def open_path_Button(self):
     try:
         if self.Import_export==1:  #导入
             self.window = QtGui.QMainWindow()
             files = QtGui.QFileDialog.getOpenFileName(self.window,
                                                        u"选取文件"
                                                        #g.cur_file_dir()
                                                        u"%s\\"%(g.cur_file_dir()))
                                                         #"All Files (*);;Text Files (*.txt)"设置文件扩展名过滤,注意用双分号间隔
             if len(files):
                 self.link_Button.setEnabled(1)  #给改成禁用
                 self.path_Edit.setText(_fromUtf8(str(files)))  #设置当前内容
         if self.Import_export==2:  #导出
             self.window = QtGui.QMainWindow()
             files= QFileDialog.getSaveFileName(self.window,
                                            u"文件保存",
                                            u"%s\\"%(g.cur_file_dir()))
             if len(files):
                 self.link_Button.setEnabled(1)  #给改成禁用
                 self.path_Edit.setText(_fromUtf8(str(files)))  #设置当前内容
     except BaseException, e:
         log.logging.debug("except:%s"%(str(e)))
Пример #5
0
 def open_path_Button(self):
     try:
         if self.Import_export == 1:  #导入
             self.window = QtGui.QMainWindow()
             files = QtGui.QFileDialog.getOpenFileName(
                 self.window,
                 u"选取文件"
                 #g.cur_file_dir()
                 u"%s\\" % (g.cur_file_dir()))
             #"All Files (*);;Text Files (*.txt)"设置文件扩展名过滤,注意用双分号间隔
             if len(files):
                 self.link_Button.setEnabled(1)  #给改成禁用
                 self.path_Edit.setText(_fromUtf8(str(files)))  #设置当前内容
         if self.Import_export == 2:  #导出
             self.window = QtGui.QMainWindow()
             files = QFileDialog.getSaveFileName(
                 self.window, u"文件保存", u"%s\\" % (g.cur_file_dir()))
             if len(files):
                 self.link_Button.setEnabled(1)  #给改成禁用
                 self.path_Edit.setText(_fromUtf8(str(files)))  #设置当前内容
     except BaseException, e:
         log.logging.debug("except:%s" % (str(e)))