在我们项目开发过程中,可能需要大量的虚拟数据对某些功能进行测试,手动编辑这些拟真数据将会耗费大量时间,所以我想,能不能写个小脚本自动生成一些自己想要的虚拟数据,刚好Python提供了Faker这一强大的第三方库,可以生成数十种国家不同语种的模拟数据,说干就干,因为博主身在项目中,时间有限,断断续续利用几个中午午休时间,终于完成了一个雏形,接下来放图和代码。
本文出现的所有Excel内的信息皆为程序生成的模拟数据,无任何泄露个人信息行为!!!
本来这里和下面的流程都有配图的,但不知为何,审核一直不通过,所以图片就干掉了,大家可以把代码先跑起来,有不懂的地方再来看使用流程。
首先选择国家语种(这个会影响数据的语言和格式,程序默认选择中国大陆),这里我把能选的数据都勾选了,其中有一些数据无法勾选,是因为在测试过程中发现,他们生成的数据格式与Excel不兼容,会因为报错导致程序崩溃,暂时没有时间解决,所以先让其无法选中,等后期有时间会进行优化。
Excel最大行数为1048576行,所以生成数据条数我将其限制为999999条。最好不要同时生成过多的行和列,除非你实在饿的不行,想用你的电脑煎鸡蛋。
点击开始生成按钮,即可根据你的设置生成Excel文件,如果不填写数据条数,将会生成一个没有数据只有列名的空模板。
暂时没有做自定义文件名的功能,生成的Excel使用的是我设置的默认名,所以这里必须有一个文件占用的检查,如果文件被占用将会进行提示,不会继续生成数据,否则必然会出现文件被占用的错误,导致程序崩溃。
大多数场景需要的只会是一些关于人的数据,所以我做了一个一键生成的按钮,牺牲了一些自由度,但节省了大量寻找和勾选数据的时间。
无需勾选任何数据,只需要选择国家语种和设置要生成的数据条数,然后点击一键生成按钮即可快速生成一个关于人物的Excel,且不会与其他元素产生冲突。
代码量比较大,考虑到萌新的感受,我尽量将每行代码写上了注释,希望所有人都能看的轻松一点,如果有哪里不懂的地方,可以评论区回复,或私聊,我会尽快回复。
import random
import sys
import win32file
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtGui import QIntValidator
from PyQt5.QtWidgets import QLabel, QCheckBox, QHBoxLayout, QFormLayout, QPushButton, QLineEdit, \
QMessageBox, QRadioButton, QButtonGroup
from faker import Faker
from openpyxl import workbook
class Main(object):
def setupUi(self, MainWindow):
# --------------------------------------------------------------------------------创建主窗口,包括可拉伸区域和滚动区域
# 设置主窗口大小
MainWindow.resize(1780, 1000)
# 设置主窗口标题
MainWindow.setWindowTitle('模拟数据生成器')
# 创建QWidget(用户界面基类)
self.main_widget = QtWidgets.QWidget(MainWindow)
# 创建QHBoxLayout(水平布局)
self.main_layout = QtWidgets.QHBoxLayout(self.main_widget)
# 创建可拉伸区域
self.splitter = QtWidgets.QSplitter(self.main_widget)
self.splitter.setOrientation(QtCore.Qt.Vertical)
# 在可拉伸区域创建一个QWidget
self.widget_btn = QtWidgets.QWidget(self.splitter)
# 创建QHBoxLayout(水平布局)
self.surround_layout = QtWidgets.QHBoxLayout(self.widget_btn)
# 布局边距设置,可通过改变该参数达到改变可拉伸区域大小的效果
self.surround_layout.setContentsMargins(0, 0, 0, 0)
# 在QWidget创建滚动区域
self.scrollArea = QtWidgets.QScrollArea(self.widget_btn)
# 设置滚动区域部件自动调整,以避免额外空间的浪费
self.scrollArea.setWidgetResizable(True)
# 在滚动区域创建QWidget
self.scrollAreaWidgetContents = QtWidgets.QWidget()
# 在QWidget创建QFormLayout(表单布局)
self.f_layout = QFormLayout(self.scrollAreaWidgetContents)
# 设置垂直间距,增强观感
self.f_layout.setVerticalSpacing(10)
# 将上面创建的组件添加并显示
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.surround_layout.addWidget(self.scrollArea)
self.main_layout.addWidget(self.splitter)
# 将main_widget显示到MainWindow上
MainWindow.setCentralWidget(self.main_widget)
# ---------------------------------------------------------------------创建主窗口中显示的组件,包括各种标题、复选框、按钮
# 标题文本
self.region = QLabel('地区&语种:')
# 创建单选框
self.China_Mainland = QRadioButton('中国(大陆)')
self.China_Taiwan = QRadioButton('中国(台湾)')
self.English_UnitedStates = QRadioButton('英语(美国)')
self.English_GreatBritain = QRadioButton('英语(英国)')
self.English_Australia = QRadioButton('英语(澳大利亚)')
self.English_Canada = QRadioButton('英语(加拿大)')
self.English_NewZealand = QRadioButton('英语(新西兰)')
self.Japanese = QRadioButton('日语')
self.Korean = QRadioButton('韩语')
self.German = QRadioButton('德语')
self.French = QRadioButton('法语')
self.Arabic_Egypt = QRadioButton('阿拉伯语(埃及)')
self.Arabic_Palestine = QRadioButton('阿拉伯语(巴勒斯坦)')
self.Arabic_SaudiArabia = QRadioButton('阿拉伯语(沙特阿拉伯)')
self.Bulgarian = QRadioButton('保加利亚语')
self.Bosnian = QRadioButton('波斯尼亚语')
self.Czech = QRadioButton('捷克语')
self.Danish = QRadioButton('丹麦语')
self.Greek = QRadioButton('希腊语')
self.Spanish_Spain = QRadioButton('西班牙语(西班牙)')
self.Spanish_Mexico = QRadioButton('西班牙语(墨西哥)')
self.Estonian = QRadioButton('爱沙尼亚语')
self.Persian_Iran = QRadioButton('波斯语(伊朗)')
self.Finnish = QRadioButton('芬兰语')
self.Hindi = QRadioButton('印地语')
self.Croatian = QRadioButton('克罗地亚语')
self.Hungarian = QRadioButton('匈牙利语')
self.Armenian = QRadioButton('亚美尼亚语')
self.Italian = QRadioButton('意大利语')
self.Georgian_Georgia = QRadioButton('格鲁吉亚语(格鲁吉亚)')
self.Lithuanian = QRadioButton('立陶宛语')
self.Latvian = QRadioButton('拉脱维亚语')
self.Nepali = QRadioButton('尼泊尔语')
self.Dutch_Netherlands = QRadioButton('荷兰语(荷兰)')
self.Norwegian = QRadioButton('挪威语')
self.Polish = QRadioButton('波兰语')
self.Portuguese_Brazil = QRadioButton('葡萄牙语(巴西)')
self.Portuguese_Portugal = QRadioButton('葡萄牙语(葡萄牙)')
self.Romanian = QRadioButton('罗马尼亚语')
self.Russian = QRadioButton('俄语')
self.Slovene = QRadioButton('斯洛文尼亚语')
self.Swedish = QRadioButton('瑞典语')
self.Turkish = QRadioButton('土耳其语')
self.Ukrainian = QRadioButton('乌克兰语')
# 创建单选框组
self.region_group = QButtonGroup()
# 将单选框加入单选框组
self.region_group.addButton(self.China_Mainland)
self.region_group.addButton(self.China_Taiwan)
self.region_group.addButton(self.English_UnitedStates)
self.region_group.addButton(self.English_GreatBritain)
self.region_group.addButton(self.English_Australia)
self.region_group.addButton(self.English_Canada)
self.region_group.addButton(self.English_NewZealand)
self.region_group.addButton(self.Japanese)
self.region_group.addButton(self.Korean)
self.region_group.addButton(self.German)
self.region_group.addButton(self.French)
self.region_group.addButton(self.Arabic_Egypt)
self.region_group.addButton(self.Arabic_Palestine)
self.region_group.addButton(self.Arabic_SaudiArabia)
self.region_group.addButton(self.Bulgarian)
self.region_group.addButton(self.Bosnian)
self.region_group.addButton(self.Czech)
self.region_group.addButton(self.Danish)
self.region_group.addButton(self.Greek)
self.region_group.addButton(self.Spanish_Spain)
self.region_group.addButton(self.Spanish_Mexico)
self.region_group.addButton(self.Estonian)
self.region_group.addButton(self.Persian_Iran)
self.region_group.addButton(self.Finnish)
self.region_group.addButton(self.Hindi)
self.region_group.addButton(self.Croatian)
self.region_group.addButton(self.Hungarian)
self.region_group.addButton(self.Armenian)
self.region_group.addButton(self.Italian)
self.region_group.addButton(self.Georgian_Georgia)
self.region_group.addButton(self.Lithuanian)
self.region_group.addButton(self.Latvian)
self.region_group.addButton(self.Nepali)
self.region_group.addButton(self.Dutch_Netherlands)
self.region_group.addButton(self.Norwegian)
self.region_group.addButton(self.Polish)
self.region_group.addButton(self.Portuguese_Brazil)
self.region_group.addButton(self.Portuguese_Portugal)
self.region_group.addButton(self.Romanian)
self.region_group.addButton(self.Russian)
self.region_group.addButton(self.Slovene)
self.region_group.addButton(self.Swedish)
self.region_group.addButton(self.Turkish)
self.region_group.addButton(self.Ukrainian)
# 创建一个QHBoxLayout(水平布局)
self.region_widget = QHBoxLayout()
# 往QHBoxLayout里添加复选框组件
self.region_widget.addWidget(self.China_Mainland)
self.region_widget.addWidget(self.China_Taiwan)
self.region_widget.addWidget(self.English_UnitedStates)
self.region_widget.addWidget(self.English_GreatBritain)
self.region_widget.addWidget(self.English_Australia)
self.region_widget.addWidget(self.English_Canada)
self.region_widget.addWidget(self.English_NewZealand)
self.region_widget.addWidget(self.Japanese)
self.region_widget.addWidget(self.Korean)
self.region_widget.addWidget(self.German)
self.region_widget.addWidget(self.French)
self.region_widget.addWidget(self.Arabic_Egypt)
self.region_widget.addWidget(self.Arabic_Palestine)
self.region_widget.addWidget(self.Arabic_SaudiArabia)
self.region_widget.addWidget(self.Bulgarian)
self.region_widget.addWidget(self.Bosnian)
self.region_widget.addWidget(self.Czech)
self.region_widget.addWidget(self.Danish)
self.region_widget.addWidget(self.Greek)
self.region_widget.addWidget(self.Spanish_Spain)
self.region_widget.addWidget(self.Spanish_Mexico)
self.region_widget.addWidget(self.Estonian)
self.region_widget.addWidget(self.Persian_Iran)
self.region_widget.addWidget(self.Finnish)
self.region_widget.addWidget(self.Hindi)
self.region_widget.addWidget(self.Croatian)
self.region_widget.addWidget(self.Hungarian)
self.region_widget.addWidget(self.Armenian)
self.region_widget.addWidget(self.Italian)
self.region_widget.addWidget(self.Georgian_Georgia)
self.region_widget.addWidget(self.Lithuanian)
self.region_widget.addWidget(self.Latvian)
self.region_widget.addWidget(self.Nepali)
self.region_widget.addWidget(self.Dutch_Netherlands)
self.region_widget.addWidget(self.Norwegian)
self.region_widget.addWidget(self.Polish)
self.region_widget.addWidget(self.Portuguese_Brazil)
self.region_widget.addWidget(self.Portuguese_Portugal)
self.region_widget.addWidget(self.Romanian)
self.region_widget.addWidget(self.Russian)
self.region_widget.addWidget(self.Slovene)
self.region_widget.addWidget(self.Swedish)
self.region_widget.addWidget(self.Turkish)
self.region_widget.addWidget(self.Ukrainian)
# 将region(标题文本)和QHBoxLayout(水平布局)添加进表单布局
self.f_layout.addRow(self.region, self.region_widget)
# 单选框选中、取消事件
self.China_Mainland.toggled.connect(self.onChinaMainland)
self.China_Taiwan.toggled.connect(self.onChinaTaiwan)
self.English_UnitedStates.toggled.connect(self.onEnglishUnitedStates)
self.English_GreatBritain.toggled.connect(self.onEnglishGreatBritain)
self.English_Australia.toggled.connect(self.onEnglishAustralia)
self.English_Canada.toggled.connect(self.onEnglishCanada)
self.English_NewZealand.toggled.connect(self.onEnglishNewZealand)
self.Japanese.toggled.connect(self.onJapanese)
self.Korean.toggled.connect(self.onKorean)
self.German.toggled.connect(self.onGerman)
self.French.toggled.connect(self.onFrench)
self.Arabic_Egypt.toggled.connect(self.onArabicEgypt)
self.Arabic_Palestine.toggled.connect(self.onArabicPalestine)
self.Arabic_SaudiArabia.toggled.connect(self.onArabicSaudiArabia)
self.Bulgarian.toggled.connect(self.onBulgarian)
self.Bosnian.toggled.connect(self.onBosnian)
self.Czech.toggled.connect(self.onCzech)
self.Danish.toggled.connect(self.onDanish)
self.Greek.toggled.connect(self.onGreek)
self.Spanish_Spain.toggled.connect(self.onSpanishSpain)
self.Spanish_Mexico.toggled.connect(self.onSpanishMexico)
self.Estonian.toggled.connect(self.onEstonian)
self.Persian_Iran.toggled.connect(self.onPersianIran)
self.Finnish.toggled.connect(self.onFinnish)
self.Hindi.toggled.connect(self.onHindi)
self.Croatian.toggled.connect(self.onCroatian)
self.Hungarian.toggled.connect(self.onHungarian)
self.Armenian.toggled.connect(self.onArmenian)
self.Italian.toggled.connect(self.onItalian)
self.Georgian_Georgia.toggled.connect(self.onGeorgianGeorgia)
self.Lithuanian.toggled.connect(self.onLithuanian)
self.Latvian.toggled.connect(self.onLatvian)
self.Nepali.toggled.connect(self.onNepali)
self.Dutch_Netherlands.toggled.connect(self.onDutchNetherlands)
self.Norwegian.toggled.connect(self.onNorwegian)
self.Polish.toggled.connect(self.onPolish)
self.Portuguese_Brazil.toggled.connect(self.onPortugueseBrazil)
self.Portuguese_Portugal.toggled.connect(self.onPortuguesePortugal)
self.Romanian.toggled.connect(self.onRomanian)
self.Russian.toggled.connect(self.onRussian)
self.Slovene.toggled.connect(self.onSlovene)
self.Swedish.toggled.connect(self.onSwedish)
self.Turkish.toggled.connect(self.onTurkish)
self.Ukrainian.toggled.connect(self.onUkrainian)
# 设置为默认选中
self.China_Mainland.setChecked(True)
# 地址相关
self.addressBe = QLabel('地址相关:')
# 复选框
self.address_all = QCheckBox('全选')
self.address = QCheckBox('地址')
self.building_number = QCheckBox('楼名')
self.city = QCheckBox('完整城市名')
self.city_name = QCheckBox('城市名(无市县)')
self.city_suffix = QCheckBox('城市后缀名')
self.country = QCheckBox('国家名称')
self.country_code = QCheckBox('国家编号')
self.district = QCheckBox('地区')
self.postcode = QCheckBox('邮编')
self.province = QCheckBox('省(中国)')
self.street_address = QCheckBox('街道地址')
self.street_name = QCheckBox('街道名称')
self.street_suffix = QCheckBox('街道后缀名')
# 创建一个QHBoxLayout
self.address_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.address_widget.setContentsMargins(0, 0, 3350, 0)
# 往QHBoxLayout添加复选框组件
self.address_widget.addWidget(self.address_all)
self.address_widget.addWidget(self.address)
self.address_widget.addWidget(self.building_number)
self.address_widget.addWidget(self.city)
self.address_widget.addWidget(self.city_name)
self.address_widget.addWidget(self.city_suffix)
self.address_widget.addWidget(self.country)
self.address_widget.addWidget(self.country_code)
self.address_widget.addWidget(self.district)
self.address_widget.addWidget(self.postcode)
self.address_widget.addWidget(self.province)
self.address_widget.addWidget(self.street_address)
self.address_widget.addWidget(self.street_name)
self.address_widget.addWidget(self.street_suffix)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.addressBe, self.address_widget)
# 复选框选中、取消事件
self.address_all.stateChanged.connect(self.onAddressAll)
self.address.stateChanged.connect(self.onAddress)
self.building_number.stateChanged.connect(self.onBuildingNumber)
self.city.stateChanged.connect(self.onCity)
self.city_name.stateChanged.connect(self.onCityName)
self.city_suffix.stateChanged.connect(self.onCitySuffix)
self.country.stateChanged.connect(self.onCountry)
self.country_code.stateChanged.connect(self.onCountryCode)
self.district.stateChanged.connect(self.onDistrict)
self.postcode.stateChanged.connect(self.onPostcode)
self.province.stateChanged.connect(self.onProvince)
self.street_address.stateChanged.connect(self.onStreetAddress)
self.street_name.stateChanged.connect(self.onStreetName)
self.street_suffix.stateChanged.connect(self.onStreetSuffix)
# 汽车相关
self.automobile = QLabel('汽车相关:')
# 复选框
self.automobile_all = QCheckBox('全选')
self.license_plate = QCheckBox('牌照')
# 创建一个QHBoxLayout
self.automobile_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.automobile_widget.setContentsMargins(0, 0, 4433, 0)
# 往QHBoxLayout添加复选框组件
self.automobile_widget.addWidget(self.automobile_all)
self.automobile_widget.addWidget(self.license_plate)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.automobile, self.automobile_widget)
# 复选框选中、取消事件
self.automobile_all.stateChanged.connect(self.onAutomobileAll)
self.license_plate.stateChanged.connect(self.onLicensePlate)
# 银行相关
self.bank = QLabel('银行相关:')
# 复选框
self.bank_all = QCheckBox('全选')
self.bank_country = QCheckBox('银行所属国家')
self.bban = QCheckBox('基本银行账号')
self.iban = QCheckBox('国际银行代码')
# 创建一个QHBoxLayout
self.bank_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.bank_widget.setContentsMargins(0, 0, 4139, 0)
# 往QHBoxLayout添加复选框组件
self.bank_widget.addWidget(self.bank_all)
self.bank_widget.addWidget(self.bank_country)
self.bank_widget.addWidget(self.bban)
self.bank_widget.addWidget(self.iban)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.bank, self.bank_widget)
# 复选框选中、取消事件
self.bank_all.stateChanged.connect(self.onBankAll)
self.bank_country.stateChanged.connect(self.onBankCountry)
self.bban.stateChanged.connect(self.onBban)
self.iban.stateChanged.connect(self.onIban)
# 条形码相关
self.bar_code = QLabel('条形码相关:')
# 复选框
self.bar_code_all = QCheckBox('全选')
self.ean = QCheckBox('EAN条形码')
self.ean13 = QCheckBox('EAN13条形码')
self.ean8 = QCheckBox('EAN8条形码')
# 创建一个QHBoxLayout
self.bar_code_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.bar_code_widget.setContentsMargins(0, 0, 4177, 0)
# 往QHBoxLayout添加复选框组件
self.bar_code_widget.addWidget(self.bar_code_all)
self.bar_code_widget.addWidget(self.ean)
self.bar_code_widget.addWidget(self.ean13)
self.bar_code_widget.addWidget(self.ean8)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.bar_code, self.bar_code_widget)
# 复选框选中、取消事件
self.bar_code_all.stateChanged.connect(self.onBarCodeAll)
self.ean.stateChanged.connect(self.onEan)
self.ean13.stateChanged.connect(self.onEan13)
self.ean8.stateChanged.connect(self.onEan8)
# 颜色相关
self.color = QLabel('颜色相关:')
# 复选框
self.color_all = QCheckBox('全选')
self.color_name = QCheckBox('颜色名称')
self.hex_color = QCheckBox('颜色十六进制值')
self.rgb_color = QCheckBox('颜色RGB值')
self.rgb_css_color = QCheckBox('CSS颜色值')
self.safe_color_name = QCheckBox('安全色')
self.safe_hex_color = QCheckBox('安全色十六进制值')
# 创建一个QHBoxLayout
self.color_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.color_widget.setContentsMargins(0, 0, 3860, 0)
# 往QHBoxLayout添加复选框组件
self.color_widget.addWidget(self.color_all)
self.color_widget.addWidget(self.color_name)
self.color_widget.addWidget(self.hex_color)
self.color_widget.addWidget(self.rgb_color)
self.color_widget.addWidget(self.rgb_css_color)
self.color_widget.addWidget(self.safe_color_name)
self.color_widget.addWidget(self.safe_hex_color)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.color, self.color_widget)
# 复选框选中、取消事件
self.color_all.stateChanged.connect(self.onColorAll)
self.color_name.stateChanged.connect(self.onColorName)
self.hex_color.stateChanged.connect(self.onHexColor)
self.rgb_color.stateChanged.connect(self.onRgbColor)
self.rgb_css_color.stateChanged.connect(self.onRgbCssColor)
self.safe_color_name.stateChanged.connect(self.onSafeColorName)
self.safe_hex_color.stateChanged.connect(self.onSafeHexColor)
# 公司相关
self.company = QLabel('公司相关:')
# 复选框
self.company_all = QCheckBox('全选')
self.bs = QCheckBox('商业用词')
self.catch_phrase = QCheckBox('妙句(口号)')
self.company_name = QCheckBox('公司名称')
self.company_prefix = QCheckBox('公司名称前缀')
self.company_suffix = QCheckBox('公司名称后缀')
# 创建一个QHBoxLayout
self.company_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.company_widget.setContentsMargins(0, 0, 3978, 0)
# 往QHBoxLayout添加复选框组件
self.company_widget.addWidget(self.company_all)
self.company_widget.addWidget(self.bs)
self.company_widget.addWidget(self.catch_phrase)
self.company_widget.addWidget(self.company_name)
self.company_widget.addWidget(self.company_prefix)
self.company_widget.addWidget(self.company_suffix)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.company, self.company_widget)
# 复选框选中、取消事件
self.company_all.stateChanged.connect(self.onCompanyAll)
self.bs.stateChanged.connect(self.onBs)
self.catch_phrase.stateChanged.connect(self.onCatchPhrase)
self.company_name.stateChanged.connect(self.onCompanyName)
self.company_prefix.stateChanged.connect(self.onCompanyPrefix)
self.company_suffix.stateChanged.connect(self.onCompanySuffix)
# 信用卡相关
self.credit_cards = QLabel('信用卡相关:')
# 复选框
self.credit_cards_all = QCheckBox('全选')
self.credit_card_expire = QCheckBox('过期年月')
self.credit_card_full = QCheckBox('完整信用卡信息')
self.credit_card_number = QCheckBox('信用卡卡号')
self.credit_card_provider = QCheckBox('信用卡提供商')
self.credit_card_security_code = QCheckBox('信用卡安全码')
# 创建一个QHBoxLayout
self.credit_cards_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.credit_cards_widget.setContentsMargins(0, 0, 3935, 0)
# 往QHBoxLayout添加复选框组件
self.credit_cards_widget.addWidget(self.credit_cards_all)
self.credit_cards_widget.addWidget(self.credit_card_expire)
self.credit_cards_widget.addWidget(self.credit_card_full)
self.credit_cards_widget.addWidget(self.credit_card_number)
self.credit_cards_widget.addWidget(self.credit_card_provider)
self.credit_cards_widget.addWidget(self.credit_card_security_code)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.credit_cards, self.credit_cards_widget)
# 复选框选中、取消事件
self.credit_cards_all.stateChanged.connect(self.onCreditCardsAll)
self.credit_card_expire.stateChanged.connect(self.onCreditCardExpire)
self.credit_card_full.stateChanged.connect(self.onCreditCardFull)
self.credit_card_number.stateChanged.connect(self.onCreditCardNumber)
self.credit_card_provider.stateChanged.connect(self.onCreditCardProvider)
self.credit_card_security_code.stateChanged.connect(self.onCreditCardSecurityCode)
# 货币相关
self.money = QLabel('货币相关:')
# 复选框
self.money_all = QCheckBox('全选')
self.cryptocurrency = QCheckBox('加密货币代码+名称')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.cryptocurrency.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.cryptocurrency.setFocusPolicy(QtCore.Qt.NoFocus)
self.cryptocurrency_code = QCheckBox('加密货币代码')
self.cryptocurrency_name = QCheckBox('加密货币名称')
self.currency = QCheckBox('货币代码+名称')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.currency.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.currency.setFocusPolicy(QtCore.Qt.NoFocus)
self.currency_code = QCheckBox('货币代码')
self.currency_name = QCheckBox('货币名称')
# 创建一个QHBoxLayout
self.money_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.money_widget.setContentsMargins(0, 0, 3800, 0)
# 往QHBoxLayout添加复选框组件
self.money_widget.addWidget(self.money_all)
self.money_widget.addWidget(self.cryptocurrency)
self.money_widget.addWidget(self.cryptocurrency_code)
self.money_widget.addWidget(self.cryptocurrency_name)
self.money_widget.addWidget(self.currency)
self.money_widget.addWidget(self.currency_code)
self.money_widget.addWidget(self.currency_name)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.money, self.money_widget)
# 复选框选中、取消事件
self.money_all.stateChanged.connect(self.onMoneyAll)
self.cryptocurrency.stateChanged.connect(self.onCryptocurrency)
self.cryptocurrency_code.stateChanged.connect(self.onCryptocurrencyCode)
self.cryptocurrency_name.stateChanged.connect(self.onCryptocurrencyName)
self.currency.stateChanged.connect(self.onCurrency)
self.currency_code.stateChanged.connect(self.onCurrencyCode)
self.currency_name.stateChanged.connect(self.onCurrencyName)
# 时间相关
self.times = QLabel('时间相关:')
# 复选框
self.time_all = QCheckBox('全选')
self.am_pm = QCheckBox('AM或PM')
self.century = QCheckBox('世纪')
self.date = QCheckBox('日期字符串')
self.date_between = QCheckBox('日期(限定范围)')
self.date_between_dates = QCheckBox('日期(同左)')
self.date_object = QCheckBox('日期(最大限制)')
self.date_of_birth = QCheckBox('出生日期')
self.date_this_century = QCheckBox('本世纪日期')
self.date_this_decade = QCheckBox('本年代日期')
self.date_this_month = QCheckBox('本月日期')
self.date_this_year = QCheckBox('本年日期')
self.date_time = QCheckBox('日期时间')
self.date_time_ad = QCheckBox('日期时间(从001年1月1日到现在)')
self.date_time_between = QCheckBox('日期时间(限定范围)')
self.date_time_between_dates = QCheckBox('日期时间(同左)')
self.date_time_this_century = QCheckBox('本世纪中的日期和时间')
self.date_time_this_decade = QCheckBox('本年代中的日期和时间')
self.date_time_this_month = QCheckBox('本月中的日期和时间')
self.date_time_this_year = QCheckBox('本年中的日期和时间')
self.day_of_month = QCheckBox('几号')
self.day_of_week = QCheckBox('星期几')
self.future_date = QCheckBox('未来日期')
self.future_datetime = QCheckBox('未来日期和时间')
self.iso8601 = QCheckBox('iso8601格式日期和时间')
self.month = QCheckBox('月份')
self.month_name = QCheckBox('月份名称')
self.past_date = QCheckBox('过去日期')
self.past_datetime = QCheckBox('过去日期和时间')
self.time = QCheckBox('时间')
self.time_delta = QCheckBox('时间间隔')
self.time_object = QCheckBox('时间(最大限制)')
self.timezone = QCheckBox('时区')
self.unix_time = QCheckBox('UNIX时间戳')
self.year = QCheckBox('某年')
# 创建一个QHBoxLayout
self.time_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.time_widget.setContentsMargins(0, 0, 650, 0)
# 往QHBoxLayout添加复选框组件
self.time_widget.addWidget(self.time_all)
self.time_widget.addWidget(self.am_pm)
self.time_widget.addWidget(self.century)
self.time_widget.addWidget(self.date)
self.time_widget.addWidget(self.date_between)
self.time_widget.addWidget(self.date_between_dates)
self.time_widget.addWidget(self.date_object)
self.time_widget.addWidget(self.date_of_birth)
self.time_widget.addWidget(self.date_this_century)
self.time_widget.addWidget(self.date_this_decade)
self.time_widget.addWidget(self.date_this_month)
self.time_widget.addWidget(self.date_this_year)
self.time_widget.addWidget(self.date_time)
self.time_widget.addWidget(self.date_time_ad)
self.time_widget.addWidget(self.date_time_between)
self.time_widget.addWidget(self.date_time_between_dates)
self.time_widget.addWidget(self.date_time_this_century)
self.time_widget.addWidget(self.date_time_this_decade)
self.time_widget.addWidget(self.date_time_this_month)
self.time_widget.addWidget(self.date_time_this_year)
self.time_widget.addWidget(self.day_of_month)
self.time_widget.addWidget(self.day_of_week)
self.time_widget.addWidget(self.future_date)
self.time_widget.addWidget(self.future_datetime)
self.time_widget.addWidget(self.iso8601)
self.time_widget.addWidget(self.month)
self.time_widget.addWidget(self.month_name)
self.time_widget.addWidget(self.past_date)
self.time_widget.addWidget(self.past_datetime)
self.time_widget.addWidget(self.time)
self.time_widget.addWidget(self.time_delta)
self.time_widget.addWidget(self.time_object)
self.time_widget.addWidget(self.timezone)
self.time_widget.addWidget(self.unix_time)
self.time_widget.addWidget(self.year)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.times, self.time_widget)
# 复选框选中、取消事件
self.time_all.stateChanged.connect(self.onTimeAll)
self.am_pm.stateChanged.connect(self.onAmPm)
self.century.stateChanged.connect(self.onCentury)
self.date.stateChanged.connect(self.onDate)
self.date_between.stateChanged.connect(self.onDateBetween)
self.date_between_dates.stateChanged.connect(self.onDateBetweenDates)
self.date_object.stateChanged.connect(self.onDateObject)
self.date_of_birth.stateChanged.connect(self.onDateOfBirth)
self.date_this_century.stateChanged.connect(self.onDateThisCentury)
self.date_this_decade.stateChanged.connect(self.onDateThisDecade)
self.date_this_month.stateChanged.connect(self.onDateThisMonth)
self.date_this_year.stateChanged.connect(self.onDateThisYear)
self.date_time.stateChanged.connect(self.onDateTime)
self.date_time_ad.stateChanged.connect(self.onDateTimeAd)
self.date_time_between.stateChanged.connect(self.onDateTimeBetween)
self.date_time_between_dates.stateChanged.connect(self.onDateTimeBetweenDates)
self.date_time_this_century.stateChanged.connect(self.onDateTimeThisCentury)
self.date_time_this_decade.stateChanged.connect(self.onDateTimeThisDecade)
self.date_time_this_month.stateChanged.connect(self.onDateTimeThisMonth)
self.date_time_this_year.stateChanged.connect(self.onDateTimeThisYear)
self.day_of_month.stateChanged.connect(self.onDayOfMonth)
self.day_of_week.stateChanged.connect(self.onDayOfWeek)
self.future_date.stateChanged.connect(self.onFutureDate)
self.future_datetime.stateChanged.connect(self.onFutureDatetime)
self.iso8601.stateChanged.connect(self.onIso8601)
self.month.stateChanged.connect(self.onMonth)
self.month_name.stateChanged.connect(self.onMonthName)
self.past_date.stateChanged.connect(self.onPastDate)
self.past_datetime.stateChanged.connect(self.onPastDatetime)
self.time.stateChanged.connect(self.onTime)
self.time_delta.stateChanged.connect(self.onTimeDelta)
self.time_object.stateChanged.connect(self.onTimeObject)
self.timezone.stateChanged.connect(self.onTimezone)
self.unix_time.stateChanged.connect(self.onUnixTime)
self.year.stateChanged.connect(self.onYear)
# 文件相关
self.files = QLabel('文件相关:')
# 复选框
self.files_all = QCheckBox('全选')
self.file_extension = QCheckBox('文件扩展名')
self.file_name = QCheckBox('文件名')
self.file_path = QCheckBox('文件路径')
self.mime_type = QCheckBox('MIME类型')
self.unix_device = QCheckBox('UNIX设备')
self.unix_partition = QCheckBox('UNIX分区')
# 创建一个QHBoxLayout
self.files_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.files_widget.setContentsMargins(0, 0, 3960, 0)
# 往QHBoxLayout添加复选框组件
self.files_widget.addWidget(self.files_all)
self.files_widget.addWidget(self.file_extension)
self.files_widget.addWidget(self.file_name)
self.files_widget.addWidget(self.file_path)
self.files_widget.addWidget(self.mime_type)
self.files_widget.addWidget(self.unix_device)
self.files_widget.addWidget(self.unix_partition)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.files, self.files_widget)
# 复选框选中、取消事件
self.files_all.stateChanged.connect(self.onFilesAll)
self.file_extension.stateChanged.connect(self.onFileExtension)
self.file_name.stateChanged.connect(self.onFileName)
self.file_path.stateChanged.connect(self.onFilePath)
self.mime_type.stateChanged.connect(self.onMimeType)
self.unix_device.stateChanged.connect(self.onUnixDevice)
self.unix_partition.stateChanged.connect(self.onUnixPartition)
# 坐标相关
self.co_ordinate = QLabel('坐标相关:')
# 复选框
self.co_ordinate_all = QCheckBox('全选')
self.coordinate = QCheckBox('坐标')
self.latitude = QCheckBox('纬度')
self.latlng = QCheckBox('经纬度')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.latlng.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.latlng.setFocusPolicy(QtCore.Qt.NoFocus)
self.local_latlng = QCheckBox('某个国家某地的经纬度')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.local_latlng.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.local_latlng.setFocusPolicy(QtCore.Qt.NoFocus)
self.location_on_land = QCheckBox('地球上某个位置的经纬度')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.location_on_land.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.location_on_land.setFocusPolicy(QtCore.Qt.NoFocus)
self.longitude = QCheckBox('经度')
# 创建一个QHBoxLayout
self.co_ordinate_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.co_ordinate_widget.setContentsMargins(0, 0, 3865, 0)
# 往QHBoxLayout添加复选框组件
self.co_ordinate_widget.addWidget(self.co_ordinate_all)
self.co_ordinate_widget.addWidget(self.coordinate)
self.co_ordinate_widget.addWidget(self.latitude)
self.co_ordinate_widget.addWidget(self.latlng)
self.co_ordinate_widget.addWidget(self.local_latlng)
self.co_ordinate_widget.addWidget(self.location_on_land)
self.co_ordinate_widget.addWidget(self.longitude)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.co_ordinate, self.co_ordinate_widget)
# 复选框选中、取消事件
self.co_ordinate_all.stateChanged.connect(self.onCoOrdinateAll)
self.coordinate.stateChanged.connect(self.onCoordinate)
self.latitude.stateChanged.connect(self.onLatitude)
self.latlng.stateChanged.connect(self.onLatlng)
self.local_latlng.stateChanged.connect(self.onLocalLatlng)
self.location_on_land.stateChanged.connect(self.onLocationOnLand)
self.longitude.stateChanged.connect(self.onLongitude)
# 网络相关
self.network = QLabel('网络相关:')
# 复选框
self.network_all = QCheckBox('全选')
self.ascii_company_email = QCheckBox('企业邮箱(ascii编码)')
self.ascii_email = QCheckBox('企业邮箱+免费邮箱(ascii编码)')
self.ascii_free_email = QCheckBox('免费邮箱(ascii编码)')
self.ascii_safe_email = QCheckBox('安全邮箱(ascii编码)')
self.company_email = QCheckBox('企业邮箱')
self.domain_name = QCheckBox('域名')
self.domain_word = QCheckBox('二级域名')
self.email = QCheckBox('企业邮箱+免费邮箱')
self.free_email = QCheckBox('免费邮箱')
self.free_email_domain = QCheckBox('免费邮箱域名')
self.hostname = QCheckBox('主机名')
self.image_url = QCheckBox('图片URL')
self.ipv4 = QCheckBox('ipv4')
self.ipv4_network_class = QCheckBox('ipv4网络等级')
self.ipv4_private = QCheckBox('私有ipv4')
self.ipv4_public = QCheckBox('公共ipv4')
self.ipv6 = QCheckBox('ipv6')
self.mac_address = QCheckBox('MAC地址')
self.safe_email = QCheckBox('安全邮箱')
self.slug = QCheckBox('URL中的slug')
self.tld = QCheckBox('顶级域名')
self.uri = QCheckBox('URI(精确到文件)')
self.uri_extension = QCheckBox('URI扩展')
self.uri_page = QCheckBox('URI页')
self.uri_path = QCheckBox('URI路径')
self.url_schemes = QCheckBox('URL(精确到路径)')
self.user_name = QCheckBox('用户名')
# 创建一个QHBoxLayout
self.network_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.network_widget.setContentsMargins(0, 0, 1730, 0)
# 往QHBoxLayout添加复选框组件
self.network_widget.addWidget(self.network_all)
self.network_widget.addWidget(self.ascii_company_email)
self.network_widget.addWidget(self.ascii_email)
self.network_widget.addWidget(self.ascii_free_email)
self.network_widget.addWidget(self.ascii_safe_email)
self.network_widget.addWidget(self.company_email)
self.network_widget.addWidget(self.domain_name)
self.network_widget.addWidget(self.domain_word)
self.network_widget.addWidget(self.email)
self.network_widget.addWidget(self.free_email)
self.network_widget.addWidget(self.free_email_domain)
self.network_widget.addWidget(self.hostname)
self.network_widget.addWidget(self.ipv4_network_class)
self.network_widget.addWidget(self.ipv4_private)
self.network_widget.addWidget(self.ipv4_public)
self.network_widget.addWidget(self.ipv6)
self.network_widget.addWidget(self.mac_address)
self.network_widget.addWidget(self.safe_email)
self.network_widget.addWidget(self.slug)
self.network_widget.addWidget(self.tld)
self.network_widget.addWidget(self.uri)
self.network_widget.addWidget(self.uri_extension)
self.network_widget.addWidget(self.uri_page)
self.network_widget.addWidget(self.uri_path)
self.network_widget.addWidget(self.url_schemes)
self.network_widget.addWidget(self.user_name)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.network, self.network_widget)
# 复选框选中、取消事件
self.network_all.stateChanged.connect(self.onNetworkAll)
self.ascii_company_email.stateChanged.connect(self.onAsciiCompanyEmail)
self.ascii_email.stateChanged.connect(self.onAsciiEmail)
self.ascii_free_email.stateChanged.connect(self.onAsciiFreeEmail)
self.ascii_safe_email.stateChanged.connect(self.onAsciiSafeEmail)
self.company_email.stateChanged.connect(self.onCompanyEmail)
self.domain_name.stateChanged.connect(self.onDomainName)
self.domain_word.stateChanged.connect(self.onDomainWord)
self.email.stateChanged.connect(self.onEmail)
self.free_email.stateChanged.connect(self.onFreeEmail)
self.free_email_domain.stateChanged.connect(self.onFreeEmailDomain)
self.hostname.stateChanged.connect(self.onHostname)
self.ipv4_network_class.stateChanged.connect(self.onIpv4NetworkClass)
self.ipv4_private.stateChanged.connect(self.onIpv4Private)
self.ipv4_public.stateChanged.connect(self.onIpv4Public)
self.ipv6.stateChanged.connect(self.onIpv6)
self.mac_address.stateChanged.connect(self.onMacAddress)
self.safe_email.stateChanged.connect(self.onSafeEmail)
self.slug.stateChanged.connect(self.onSlug)
self.tld.stateChanged.connect(self.onTld)
self.uri.stateChanged.connect(self.onUri)
self.uri_extension.stateChanged.connect(self.onUriExtension)
self.uri_page.stateChanged.connect(self.onUriPage)
self.uri_path.stateChanged.connect(self.onUriPath)
self.url_schemes.stateChanged.connect(self.onUrlSchemes)
self.user_name.stateChanged.connect(self.onUserName)
# 图书相关
self.books = QLabel('图书相关:')
# 复选框
self.books_all = QCheckBox('全选')
self.isbn10 = QCheckBox('ISBN-10图书编号')
self.isbn13 = QCheckBox('ISBN-13图书编号')
# 创建一个QHBoxLayout
self.books_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.books_widget.setContentsMargins(0, 0, 4200, 0)
# 往QHBoxLayout添加复选框组件
self.books_widget.addWidget(self.books_all)
self.books_widget.addWidget(self.isbn10)
self.books_widget.addWidget(self.isbn13)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.books, self.books_widget)
# 复选框选中、取消事件
self.books_all.stateChanged.connect(self.onBooksAll)
self.isbn10.stateChanged.connect(self.onIsbn10)
self.isbn13.stateChanged.connect(self.onIsbn13)
# 职位相关
self.position = QLabel('职位相关:')
# 复选框
self.position_all = QCheckBox('全选')
self.job = QCheckBox('职位')
# 创建一个QHBoxLayout
self.position_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.position_widget.setContentsMargins(0, 0, 4430, 0)
# 往QHBoxLayout添加复选框组件
self.position_widget.addWidget(self.position_all)
self.position_widget.addWidget(self.job)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.position, self.position_widget)
# 复选框选中、取消事件
self.position_all.stateChanged.connect(self.onPositionAll)
self.job.stateChanged.connect(self.onJob)
# 文本相关
self.textBe = QLabel('文本相关:')
# 复选框
self.text_all = QCheckBox('全选')
self.paragraph = QCheckBox('单个段落')
self.paragraphs = QCheckBox('多个段落')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.paragraphs.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.paragraphs.setFocusPolicy(QtCore.Qt.NoFocus)
self.sentence = QCheckBox('单个句子')
self.sentences = QCheckBox('多个句子')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.sentences.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.sentences.setFocusPolicy(QtCore.Qt.NoFocus)
self.text = QCheckBox('单个文本')
self.texts = QCheckBox('多个文本')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.texts.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.texts.setFocusPolicy(QtCore.Qt.NoFocus)
self.word = QCheckBox('单个词语')
self.words = QCheckBox('多个词语')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.words.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.words.setFocusPolicy(QtCore.Qt.NoFocus)
# 创建一个QHBoxLayout
self.text_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.text_widget.setContentsMargins(0, 0, 3790, 0)
# 往QHBoxLayout添加复选框组件
self.text_widget.addWidget(self.text_all)
self.text_widget.addWidget(self.paragraph)
self.text_widget.addWidget(self.paragraphs)
self.text_widget.addWidget(self.sentence)
self.text_widget.addWidget(self.sentences)
self.text_widget.addWidget(self.text)
self.text_widget.addWidget(self.texts)
self.text_widget.addWidget(self.word)
self.text_widget.addWidget(self.words)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.textBe, self.text_widget)
# 复选框选中、取消事件
self.text_all.stateChanged.connect(self.onTextAll)
self.paragraph.stateChanged.connect(self.onParagraph)
self.paragraphs.stateChanged.connect(self.onParagraphs)
self.sentence.stateChanged.connect(self.onSentence)
self.sentences.stateChanged.connect(self.onSentences)
self.text.stateChanged.connect(self.onText)
self.texts.stateChanged.connect(self.onTexts)
self.word.stateChanged.connect(self.onWord)
self.words.stateChanged.connect(self.onWords)
# 编码相关
self.code = QLabel('编码相关:')
# 复选框
self.code_all = QCheckBox('全选')
self.binary = QCheckBox('二进制')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.binary.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.binary.setFocusPolicy(QtCore.Qt.NoFocus)
self.boolean = QCheckBox('布尔值')
self.md5 = QCheckBox('Md5')
self.null_boolean = QCheckBox('NULL+布尔值')
self.password = QCheckBox('密码')
self.sha1 = QCheckBox('SHA1')
self.sha256 = QCheckBox('SHA256')
self.uuid4 = QCheckBox('UUID4')
# 创建一个QHBoxLayout
self.code_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.code_widget.setContentsMargins(0, 0, 3900, 0)
# 往QHBoxLayout添加复选框组件
self.code_widget.addWidget(self.code_all)
self.code_widget.addWidget(self.binary)
self.code_widget.addWidget(self.boolean)
self.code_widget.addWidget(self.md5)
self.code_widget.addWidget(self.null_boolean)
self.code_widget.addWidget(self.password)
self.code_widget.addWidget(self.sha1)
self.code_widget.addWidget(self.sha256)
self.code_widget.addWidget(self.uuid4)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.code, self.code_widget)
# 复选框选中、取消事件
self.code_all.stateChanged.connect(self.onCodeAll)
self.binary.stateChanged.connect(self.onBinary)
self.boolean.stateChanged.connect(self.onBoolean)
self.md5.stateChanged.connect(self.onMd5)
self.null_boolean.stateChanged.connect(self.onNullBoolean)
self.password.stateChanged.connect(self.onPassword)
self.sha1.stateChanged.connect(self.onSha1)
self.sha256.stateChanged.connect(self.onSha256)
self.uuid4.stateChanged.connect(self.onUuid4)
# 人物相关
self.peoples = QLabel('人物相关:')
# 复选框
self.peoples_all = QCheckBox('全选')
self.first_name = QCheckBox('名')
self.first_name_female = QCheckBox('名(女)')
self.first_name_male = QCheckBox('名(男)')
self.first_romanized_name = QCheckBox('名(罗马文)')
self.last_name = QCheckBox('姓')
self.last_name_female = QCheckBox('姓(女)')
self.last_name_male = QCheckBox('姓(男)')
self.last_romanized_name = QCheckBox('姓(罗马文)')
self.name = QCheckBox('姓名')
self.name_female = QCheckBox('姓名(女)')
self.name_male = QCheckBox('姓名(男)')
self.prefix = QCheckBox('称谓')
self.prefix_female = QCheckBox('称谓(女)')
self.prefix_male = QCheckBox('称谓(男)')
self.romanized_name = QCheckBox('称谓(罗马文)')
self.suffix = QCheckBox('姓名后缀(中文不适用)')
# 创建一个QHBoxLayout
self.peoples_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.peoples_widget.setContentsMargins(0, 0, 3080, 0)
# 往QHBoxLayout添加复选框组件
self.peoples_widget.addWidget(self.peoples_all)
self.peoples_widget.addWidget(self.first_name)
self.peoples_widget.addWidget(self.first_name_female)
self.peoples_widget.addWidget(self.first_name_male)
self.peoples_widget.addWidget(self.first_romanized_name)
self.peoples_widget.addWidget(self.last_name)
self.peoples_widget.addWidget(self.last_name_female)
self.peoples_widget.addWidget(self.last_name_male)
self.peoples_widget.addWidget(self.last_romanized_name)
self.peoples_widget.addWidget(self.name)
self.peoples_widget.addWidget(self.name_female)
self.peoples_widget.addWidget(self.name_male)
self.peoples_widget.addWidget(self.prefix)
self.peoples_widget.addWidget(self.prefix_female)
self.peoples_widget.addWidget(self.prefix_male)
self.peoples_widget.addWidget(self.romanized_name)
self.peoples_widget.addWidget(self.suffix)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.peoples, self.peoples_widget)
# 复选框选中、取消事件
self.peoples_all.stateChanged.connect(self.onPeoplesAll)
self.first_name.stateChanged.connect(self.onFirstName)
self.first_name_female.stateChanged.connect(self.onFirstNameFemale)
self.first_name_male.stateChanged.connect(self.onFirstNameMale)
self.first_romanized_name.stateChanged.connect(self.onFirstRomanizedName)
self.last_name.stateChanged.connect(self.onLastName)
self.last_name_female.stateChanged.connect(self.onLastNameFemale)
self.last_name_male.stateChanged.connect(self.onLastNameMale)
self.last_romanized_name.stateChanged.connect(self.onLastRomanizedName)
self.name.stateChanged.connect(self.onName)
self.name_female.stateChanged.connect(self.onNameFemale)
self.name_male.stateChanged.connect(self.onNameMale)
self.prefix.stateChanged.connect(self.onPrefix)
self.prefix_female.stateChanged.connect(self.onPrefixFemale)
self.prefix_male.stateChanged.connect(self.onPrefixMale)
self.romanized_name.stateChanged.connect(self.onRomanizedName)
self.suffix.stateChanged.connect(self.onSuffix)
# 电话相关
self.phone = QLabel('电话相关:')
# 复选框
self.phone_all = QCheckBox('全选')
self.msisdn = QCheckBox('完整手机号码(包含国家和国内区号)')
self.phone_number = QCheckBox('手机号')
self.phonenumber_prefix = QCheckBox('区号')
# 创建一个QHBoxLayout
self.phone_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.phone_widget.setContentsMargins(0, 0, 4085, 0)
# 往QHBoxLayout添加复选框组件
self.phone_widget.addWidget(self.phone_all)
self.phone_widget.addWidget(self.msisdn)
self.phone_widget.addWidget(self.phone_number)
self.phone_widget.addWidget(self.phonenumber_prefix)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.phone, self.phone_widget)
# 复选框选中、取消事件
self.phone_all.stateChanged.connect(self.onPhoneAll)
self.msisdn.stateChanged.connect(self.onMsisdn)
self.phone_number.stateChanged.connect(self.onPhoneNumber)
self.phonenumber_prefix.stateChanged.connect(self.onPhoneNumberPrefix)
# 档案相关
self.archives = QLabel('档案相关:')
# 复选框
self.archives_all = QCheckBox('全选')
self.profile = QCheckBox('档案(完整)')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.profile.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.profile.setFocusPolicy(QtCore.Qt.NoFocus)
self.simple_profile = QCheckBox('档案(简单)')
# 由于该方法暂时不能在Excel中生成,所以将其不能选择
self.simple_profile.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.simple_profile.setFocusPolicy(QtCore.Qt.NoFocus)
# 创建一个QHBoxLayout
self.archives_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.archives_widget.setContentsMargins(0, 0, 4280, 0)
# 往QHBoxLayout添加复选框组件
self.archives_widget.addWidget(self.archives_all)
self.archives_widget.addWidget(self.profile)
self.archives_widget.addWidget(self.simple_profile)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.archives, self.archives_widget)
# 复选框选中、取消事件
self.archives_all.stateChanged.connect(self.onArchivesAll)
self.profile.stateChanged.connect(self.onProfile)
self.simple_profile.stateChanged.connect(self.onSimpleProfile)
# 身份证相关
self.id_card = QLabel('身份证相关:')
# 复选框
self.id_card_all = QCheckBox('全选')
self.ssn = QCheckBox('身份证')
# 创建一个QHBoxLayout
self.id_card_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.id_card_widget.setContentsMargins(0, 0, 4415, 0)
# 往QHBoxLayout添加复选框组件
self.id_card_widget.addWidget(self.id_card_all)
self.id_card_widget.addWidget(self.ssn)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.id_card, self.id_card_widget)
# 复选框选中、取消事件
self.id_card_all.stateChanged.connect(self.onIdCardAll)
self.ssn.stateChanged.connect(self.onSsn)
# 用户代理相关
self.user_agentBe = QLabel('用户代理相关:')
# 复选框
self.user_agent_all = QCheckBox('全选')
self.android_platform_token = QCheckBox('安卓')
self.chrome = QCheckBox('Chrome')
self.firefox = QCheckBox('FireFox')
self.internet_explorer = QCheckBox('Ie')
self.ios_platform_token = QCheckBox('ios')
self.linux_platform_token = QCheckBox('Linux')
self.linux_processor = QCheckBox('Linux处理器')
self.mac_platform_token = QCheckBox('Mac')
self.mac_processor = QCheckBox('Mac处理器')
self.opera = QCheckBox('Opera')
self.safari = QCheckBox('Safari')
self.user_agent = QCheckBox('随机用户代理')
self.windows_platform_token = QCheckBox('Windows')
# 创建一个QHBoxLayout
self.user_agent_widget = QHBoxLayout()
# 设置布局管理器的边界,防止组件自适用间距过大影响观感,分别为:左、上、右、下
self.user_agent_widget.setContentsMargins(0, 0, 3500, 0)
# 往QHBoxLayout添加复选框组件
self.user_agent_widget.addWidget(self.user_agent_all)
self.user_agent_widget.addWidget(self.android_platform_token)
self.user_agent_widget.addWidget(self.chrome)
self.user_agent_widget.addWidget(self.firefox)
self.user_agent_widget.addWidget(self.internet_explorer)
self.user_agent_widget.addWidget(self.ios_platform_token)
self.user_agent_widget.addWidget(self.linux_platform_token)
self.user_agent_widget.addWidget(self.linux_processor)
self.user_agent_widget.addWidget(self.mac_platform_token)
self.user_agent_widget.addWidget(self.mac_processor)
self.user_agent_widget.addWidget(self.opera)
self.user_agent_widget.addWidget(self.safari)
self.user_agent_widget.addWidget(self.user_agent)
self.user_agent_widget.addWidget(self.windows_platform_token)
# 将QHBoxLayout添加进QFormLayout,这样可以防止addRow时出现参数过多的报错
self.f_layout.addRow(self.user_agentBe, self.user_agent_widget)
# 复选框选中、取消事件
self.user_agent_all.stateChanged.connect(self.onUserAgentAll)
self.android_platform_token.stateChanged.connect(self.onAndroidPlatformToken)
self.chrome.stateChanged.connect(self.onChrome)
self.firefox.stateChanged.connect(self.onFirefox)
self.internet_explorer.stateChanged.connect(self.onInternetExplorer)
self.ios_platform_token.stateChanged.connect(self.onIosPlatformToken)
self.linux_platform_token.stateChanged.connect(self.onLinuxPlatformToken)
self.linux_processor.stateChanged.connect(self.onLinuxProcessor)
self.mac_platform_token.stateChanged.connect(self.onMacPlatformToken)
self.mac_processor.stateChanged.connect(self.onMacProcessor)
self.opera.stateChanged.connect(self.onOpera)
self.safari.stateChanged.connect(self.onSafari)
self.user_agent.stateChanged.connect(self.onUserAgent)
self.windows_platform_token.stateChanged.connect(self.onWindowsPlatformToken)
# 创建文本输入框
self.pIntLineEdit = QLineEdit()
# 创建输入框约束——只能输入数字
self.pIntValidator = QIntValidator()
# 给该输入框添加约束
self.pIntLineEdit.setValidator(self.pIntValidator)
# 限制输入字符数,过高会导致Excel行号不够,以至于程序崩溃,并会占用过多的内存,导致响应时间过长
self.pIntLineEdit.setMaxLength(6)
# 添加输入框到表单布局
self.pIntLineEdit_widget = QHBoxLayout()
self.pIntLineEdit_widget.addWidget(self.pIntLineEdit)
self.pIntLineEdit_widget.setContentsMargins(0, 0, 4400, 0)
self.f_layout.addRow("请输入生成数据的条数:", self.pIntLineEdit_widget)
# 生成按钮
self.createExcel = QPushButton('开始生成')
# self.createExcel.setStyleSheet("color: #ffffff; background-color: rgb(87,174,231)")
self.createExcel_widget = QHBoxLayout()
self.createExcel_widget.addWidget(self.createExcel)
self.createExcel_widget.setContentsMargins(0, 0, 3000, 0)
self.f_layout.addRow(self.createExcel_widget)
self.createExcel.clicked.connect(self.onCreateExcel)
# 生成按钮
self.createExcel1 = QPushButton('一键生成人物相关信息')
# self.createExcel.setStyleSheet("color: #ffffff; background-color: rgb(87,174,231)")
self.createExcel_widget1 = QHBoxLayout()
self.createExcel_widget1.addWidget(self.createExcel1)
self.createExcel_widget1.setContentsMargins(0, 0, 3000, 0)
self.f_layout.addRow(self.createExcel_widget1)
self.createExcel1.clicked.connect(self.onCreateExcel1)
# 生成列标题
self.line = ['序号']
# 生成表地区语言格式
self.form = []
# 创建workbook用于生成Excel
self.wb = workbook.Workbook()
# 在Excel中创建一个工作表
self.sheet = self.wb.worksheets[0]
# 国家语种单选框选中事件,选中后给Faker赋值对应的国家编码
def onChinaMainland(self, i):
if i == True:
self.fk = Faker(locale='zh_CN')
def onChinaTaiwan(self, i):
if i == True:
self.fk = Faker(locale='zh_TW')
def onEnglishUnitedStates(self, i):
if i == True:
self.fk = Faker(locale='en_US')
def onEnglishGreatBritain(self, i):
if i == True:
self.fk = Faker(locale='en_GB')
def onEnglishAustralia(self, i):
if i == True:
self.fk = Faker(locale='en_AU')
def onEnglishCanada(self, i):
if i == True:
self.fk = Faker(locale='en_CA')
def onEnglishNewZealand(self, i):
if i == True:
self.fk = Faker(locale='en_NZ')
def onJapanese(self, i):
if i == True:
self.fk = Faker(locale='ja_JP')
def onKorean(self, i):
if i == True:
self.fk = Faker(locale='ko_KR')
def onGerman(self, i):
if i == True:
self.fk = Faker(locale='de_DE')
def onFrench(self, i):
if i == True:
self.fk = Faker(locale='fr_FR')
def onArabicEgypt(self, i):
if i == True:
self.fk = Faker(locale='ar_EG')
def onArabicPalestine(self, i):
if i == True:
self.fk = Faker(locale='ar_PS')
def onArabicSaudiArabia(self, i):
if i == True:
self.fk = Faker(locale='ar_SA')
def onBulgarian(self, i):
if i == True:
self.fk = Faker(locale='bg_BG')
def onBosnian(self, i):
if i == True:
self.fk = Faker(locale='bs_BA')
def onCzech(self, i):
if i == True:
self.fk = Faker(locale='cs_CZ')
def onDanish(self, i):
if i == True:
self.fk = Faker(locale='dk_DK')
def onGreek(self, i):
if i == True:
self.fk = Faker(locale='el_GR')
def onSpanishSpain(self, i):
if i == True:
self.fk = Faker(locale='es_ES')
def onSpanishMexico(self, i):
if i == True:
self.fk = Faker(locale='es_MX')
def onEstonian(self, i):
if i == True:
self.fk = Faker(locale='et_EE')
def onPersianIran(self, i):
if i == True:
self.fk = Faker(locale='fa_IR')
def onFinnish(self, i):
if i == True:
self.fk = Faker(locale='fi_FI')
def onHindi(self, i):
if i == True:
self.fk = Faker(locale='hi_IN')
def onCroatian(self, i):
if i == True:
self.fk = Faker(locale='hr_HR')
def onHungarian(self, i):
if i == True:
self.fk = Faker(locale='hu_HU')
def onArmenian(self, i):
if i == True:
self.fk = Faker(locale='hy_AM')
def onItalian(self, i):
if i == True:
self.fk = Faker(locale='it_IT')
def onGeorgianGeorgia(self, i):
if i == True:
self.fk = Faker(locale='ka_GE')
def onLithuanian(self, i):
if i == True:
self.fk = Faker(locale='lt_LT')
def onLatvian(self, i):
if i == True:
self.fk = Faker(locale='lv_LV')
def onNepali(self, i):
if i == True:
self.fk = Faker(locale='ne_NP')
def onDutchNetherlands(self, i):
if i == True:
self.fk = Faker(locale='nl_NL')
def onNorwegian(self, i):
if i == True:
self.fk = Faker(locale='no_NO')
def onPolish(self, i):
if i == True:
self.fk = Faker(locale='pl_PL')
def onPortugueseBrazil(self, i):
if i == True:
self.fk = Faker(locale='pt_BR')
def onPortuguesePortugal(self, i):
if i == True:
self.fk = Faker(locale='pt_PT')
def onRomanian(self, i):
if i == True:
self.fk = Faker(locale='ro_RO')
def onRussian(self, i):
if i == True:
self.fk = Faker(locale='ru_RU')
def onSlovene(self, i):
if i == True:
self.fk = Faker(locale='sl_SI')
def onSwedish(self, i):
if i == True:
self.fk = Faker(locale='sv_SE')
def onTurkish(self, i):
if i == True:
self.fk = Faker(locale='tr_TR')
def onUkrainian(self, i):
if i == True:
self.fk = Faker(locale='uk_UA')
# 复选框选中事件,点击全选选中该组所有复选框
def onAddressAll(self, i):
if i == 2:
self.address.setChecked(True)
self.building_number.setChecked(True)
self.city.setChecked(True)
self.city_name.setChecked(True)
self.city_suffix.setChecked(True)
self.country.setChecked(True)
self.country_code.setChecked(True)
self.district.setChecked(True)
self.postcode.setChecked(True)
self.province.setChecked(True)
self.street_address.setChecked(True)
self.street_name.setChecked(True)
self.street_suffix.setChecked(True)
if i == 0:
self.address.setChecked(False)
self.building_number.setChecked(False)
self.city.setChecked(False)
self.city_name.setChecked(False)
self.city_suffix.setChecked(False)
self.country.setChecked(False)
self.country_code.setChecked(False)
self.district.setChecked(False)
self.postcode.setChecked(False)
self.province.setChecked(False)
self.street_address.setChecked(False)
self.street_name.setChecked(False)
self.street_suffix.setChecked(False)
# 将选中的值添加到line(列标题)里,用于后续判断要生成那些数据
def onAddress(self, i):
if i == 2:
self.line.append('地址')
if i == 0:
self.line.remove('地址')
def onBuildingNumber(self, i):
if i == 2:
self.line.append('楼名')
if i == 0:
self.line.remove('楼名')
def onCity(self, i):
if i == 2:
self.line.append('完整城市名')
if i == 0:
self.line.remove('完整城市名')
def onCityName(self, i):
if i == 2:
self.line.append('城市名(无市县)')
if i == 0:
self.line.remove('城市名(无市县)')
def onCitySuffix(self, i):
if i == 2:
self.line.append('城市后缀名')
if i == 0:
self.line.remove('城市后缀名')
def onCountry(self, i):
if i == 2:
self.line.append('国家名称')
if i == 0:
self.line.remove('国家名称')
def onCountryCode(self, i):
if i == 2:
self.line.append('国家编号')
if i == 0:
self.line.remove('国家编号')
def onDistrict(self, i):
if i == 2:
self.line.append('地区')
if i == 0:
self.line.remove('地区')
def onPostcode(self, i):
if i == 2:
self.line.append('邮编')
if i == 0:
self.line.remove('邮编')
def onProvince(self, i):
if i == 2:
self.line.append('省(中国)')
if i == 0:
self.line.remove('省(中国)')
def onStreetAddress(self, i):
if i == 2:
self.line.append('街道地址')
if i == 0:
self.line.remove('街道地址')
def onStreetName(self, i):
if i == 2:
self.line.append('街道名称')
if i == 0:
self.line.remove('街道名称')
def onStreetSuffix(self, i):
if i == 2:
self.line.append('街道后缀名')
if i == 0:
self.line.remove('街道后缀名')
def onAutomobileAll(self, i):
if i == 2:
self.license_plate.setChecked(True)
if i == 0:
self.license_plate.setChecked(False)
def onLicensePlate(self, i):
if i == 2:
self.line.append('牌照')
if i == 0:
self.line.remove('牌照')
def onBankAll(self, i):
if i == 2:
self.bank_country.setChecked(True)
self.bban.setChecked(True)
self.iban.setChecked(True)
if i == 0:
self.bank_country.setChecked(False)
self.bban.setChecked(False)
self.iban.setChecked(False)
def onBankCountry(self, i):
if i == 2:
self.line.append('银行所属国家')
if i == 0:
self.line.remove('银行所属国家')
def onBban(self, i):
if i == 2:
self.line.append('基本银行账号')
if i == 0:
self.line.remove('基本银行账号')
def onIban(self, i):
if i == 2:
self.line.append('国际银行代码')
if i == 0:
self.line.remove('国际银行代码')
def onBarCodeAll(self, i):
if i == 2:
self.ean.setChecked(True)
self.ean13.setChecked(True)
self.ean8.setChecked(True)
if i == 0:
self.ean.setChecked(False)
self.ean13.setChecked(False)
self.ean8.setChecked(False)
def onEan(self, i):
if i == 2:
self.line.append('EAN条形码')
if i == 0:
self.line.remove('EAN条形码')
def onEan13(self, i):
if i == 2:
self.line.append('EAN13条形码')
if i == 0:
self.line.remove('EAN13条形码')
def onEan8(self, i):
if i == 2:
self.line.append('EAN8条形码')
if i == 0:
self.line.remove('EAN8条形码')
def onColorAll(self, i):
if i == 2:
self.color_name.setChecked(True)
self.hex_color.setChecked(True)
self.rgb_color.setChecked(True)
self.rgb_css_color.setChecked(True)
self.safe_color_name.setChecked(True)
self.safe_hex_color.setChecked(True)
if i == 0:
self.color_name.setChecked(False)
self.hex_color.setChecked(False)
self.rgb_color.setChecked(False)
self.rgb_css_color.setChecked(False)
self.safe_color_name.setChecked(False)
self.safe_hex_color.setChecked(False)
def onColorName(self, i):
if i == 2:
self.line.append('颜色名称')
if i == 0:
self.line.remove('颜色名称')
def onHexColor(self, i):
if i == 2:
self.line.append('颜色十六进制值')
if i == 0:
self.line.remove('颜色十六进制值')
def onRgbColor(self, i):
if i == 2:
self.line.append('颜色RGB值')
if i == 0:
self.line.remove('颜色RGB值')
def onRgbCssColor(self, i):
if i == 2:
self.line.append('CSS颜色值')
if i == 0:
self.line.remove('CSS颜色值')
def onSafeColorName(self, i):
if i == 2:
self.line.append('安全色')
if i == 0:
self.line.remove('安全色')
def onSafeHexColor(self, i):
if i == 2:
self.line.append('安全色十六进制值')
if i == 0:
self.line.remove('安全色十六进制值')
def onCompanyAll(self, i):
if i == 2:
self.bs.setChecked(True)
self.catch_phrase.setChecked(True)
self.company_name.setChecked(True)
self.company_prefix.setChecked(True)
self.company_suffix.setChecked(True)
if i == 0:
self.bs.setChecked(False)
self.catch_phrase.setChecked(False)
self.company_name.setChecked(False)
self.company_prefix.setChecked(False)
self.company_suffix.setChecked(False)
def onBs(self, i):
if i == 2:
self.line.append('商业用词')
if i == 0:
self.line.remove('商业用词')
def onCatchPhrase(self, i):
if i == 2:
self.line.append('妙句(口号)')
if i == 0:
self.line.remove('妙句(口号)')
def onCompanyName(self, i):
if i == 2:
self.line.append('公司名称')
if i == 0:
self.line.remove('公司名称')
def onCompanyPrefix(self, i):
if i == 2:
self.line.append('公司名称前缀')
if i == 0:
self.line.remove('公司名称前缀')
def onCompanySuffix(self, i):
if i == 2:
self.line.append('公司名称后缀')
if i == 0:
self.line.remove('公司名称后缀')
def onCreditCardsAll(self, i):
if i == 2:
self.credit_card_expire.setChecked(True)
self.credit_card_full.setChecked(True)
self.credit_card_number.setChecked(True)
self.credit_card_provider.setChecked(True)
self.credit_card_security_code.setChecked(True)
if i == 0:
self.credit_card_expire.setChecked(False)
self.credit_card_full.setChecked(False)
self.credit_card_number.setChecked(False)
self.credit_card_provider.setChecked(False)
self.credit_card_security_code.setChecked(False)
def onCreditCardExpire(self, i):
if i == 2:
self.line.append('过期年月')
if i == 0:
self.line.remove('过期年月')
def onCreditCardFull(self, i):
if i == 2:
self.line.append('完整信用卡信息')
if i == 0:
self.line.remove('完整信用卡信息')
def onCreditCardNumber(self, i):
if i == 2:
self.line.append('信用卡卡号')
if i == 0:
self.line.remove('信用卡卡号')
def onCreditCardProvider(self, i):
if i == 2:
self.line.append('信用卡提供商')
if i == 0:
self.line.remove('信用卡提供商')
def onCreditCardSecurityCode(self, i):
if i == 2:
self.line.append('信用卡安全码')
if i == 0:
self.line.remove('信用卡安全码')
def onMoneyAll(self, i):
if i == 2:
self.cryptocurrency.setChecked(False)
self.cryptocurrency_code.setChecked(True)
self.cryptocurrency_name.setChecked(True)
self.currency.setChecked(False)
self.currency_code.setChecked(True)
self.currency_name.setChecked(True)
if i == 0:
self.cryptocurrency.setChecked(False)
self.cryptocurrency_code.setChecked(False)
self.cryptocurrency_name.setChecked(False)
self.currency.setChecked(False)
self.currency_code.setChecked(False)
self.currency_name.setChecked(False)
def onCryptocurrency(self, i):
if i == 2:
self.line.append('加密货币代码+名称')
if i == 0:
self.line.remove('加密货币代码+名称')
def onCryptocurrencyCode(self, i):
if i == 2:
self.line.append('加密货币代码')
if i == 0:
self.line.remove('加密货币代码')
def onCryptocurrencyName(self, i):
if i == 2:
self.line.append('加密货币名称')
if i == 0:
self.line.remove('加密货币名称')
def onCurrency(self, i):
if i == 2:
self.line.append('货币代码+名称')
if i == 0:
self.line.remove('货币代码+名称')
def onCurrencyCode(self, i):
if i == 2:
self.line.append('货币代码')
if i == 0:
self.line.remove('货币代码')
def onCurrencyName(self, i):
if i == 2:
self.line.append('货币名称')
if i == 0:
self.line.remove('货币名称')
def onTimeAll(self, i):
if i == 2:
self.am_pm.setChecked(True)
self.century.setChecked(True)
self.date.setChecked(True)
self.date_between.setChecked(True)
self.date_between_dates.setChecked(True)
self.date_object.setChecked(True)
self.date_of_birth.setChecked(True)
self.date_this_century.setChecked(True)
self.date_this_decade.setChecked(True)
self.date_this_month.setChecked(True)
self.date_this_year.setChecked(True)
self.date_time.setChecked(True)
self.date_time_ad.setChecked(True)
self.date_time_between.setChecked(True)
self.date_time_between_dates.setChecked(True)
self.date_time_this_century.setChecked(True)
self.date_time_this_decade.setChecked(True)
self.date_time_this_month.setChecked(True)
self.date_time_this_year.setChecked(True)
self.day_of_month.setChecked(True)
self.day_of_week.setChecked(True)
self.future_date.setChecked(True)
self.future_datetime.setChecked(True)
self.iso8601.setChecked(True)
self.month.setChecked(True)
self.month_name.setChecked(True)
self.past_date.setChecked(True)
self.past_datetime.setChecked(True)
self.time.setChecked(True)
self.time_delta.setChecked(True)
self.time_object.setChecked(True)
self.timezone.setChecked(True)
self.unix_time.setChecked(True)
self.year.setChecked(True)
if i == 0:
self.am_pm.setChecked(False)
self.century.setChecked(False)
self.date.setChecked(False)
self.date_between.setChecked(False)
self.date_between_dates.setChecked(False)
self.date_object.setChecked(False)
self.date_of_birth.setChecked(False)
self.date_this_century.setChecked(False)
self.date_this_decade.setChecked(False)
self.date_this_month.setChecked(False)
self.date_this_year.setChecked(False)
self.date_time.setChecked(False)
self.date_time_ad.setChecked(False)
self.date_time_between.setChecked(False)
self.date_time_between_dates.setChecked(False)
self.date_time_this_century.setChecked(False)
self.date_time_this_decade.setChecked(False)
self.date_time_this_month.setChecked(False)
self.date_time_this_year.setChecked(False)
self.day_of_month.setChecked(False)
self.day_of_week.setChecked(False)
self.future_date.setChecked(False)
self.future_datetime.setChecked(False)
self.iso8601.setChecked(False)
self.month.setChecked(False)
self.month_name.setChecked(False)
self.past_date.setChecked(False)
self.past_datetime.setChecked(False)
self.time.setChecked(False)
self.time_delta.setChecked(False)
self.time_object.setChecked(False)
self.timezone.setChecked(False)
self.unix_time.setChecked(False)
self.year.setChecked(False)
def onAmPm(self, i):
if i == 2:
self.line.append('AM或PM')
if i == 0:
self.line.remove('AM或PM')
def onCentury(self, i):
if i == 2:
self.line.append('世纪')
if i == 0:
self.line.remove('世纪')
def onDate(self, i):
if i == 2:
self.line.append('日期字符串')
if i == 0:
self.line.remove('日期字符串')
def onDateBetween(self, i):
if i == 2:
self.line.append('日期(限定范围)')
if i == 0:
self.line.remove('日期(限定范围)')
def onDateBetweenDates(self, i):
if i == 2:
self.line.append('日期(同左)')
if i == 0:
self.line.remove('日期(同左)')
def onDateObject(self, i):
if i == 2:
self.line.append('日期(最大限制)')
if i == 0:
self.line.remove('日期(最大限制)')
def onDateOfBirth(self, i):
if i == 2:
self.line.append('出生日期')
if i == 0:
self.line.remove('出生日期')
def onDateThisCentury(self, i):
if i == 2:
self.line.append('本世纪日期')
if i == 0:
self.line.remove('本世纪日期')
def onDateThisDecade(self, i):
if i == 2:
self.line.append('本年代日期')
if i == 0:
self.line.remove('本年代日期')
def onDateThisMonth(self, i):
if i == 2:
self.line.append('本月日期')
if i == 0:
self.line.remove('本月日期')
def onDateThisYear(self, i):
if i == 2:
self.line.append('本年日期')
if i == 0:
self.line.remove('本年日期')
def onDateTime(self, i):
if i == 2:
self.line.append('日期时间')
if i == 0:
self.line.remove('日期时间')
def onDateTimeAd(self, i):
if i == 2:
self.line.append('日期时间(从001年1月1日到现在)')
if i == 0:
self.line.remove('日期时间(从001年1月1日到现在)')
def onDateTimeBetween(self, i):
if i == 2:
self.line.append('日期时间(限定范围)')
if i == 0:
self.line.remove('日期时间(限定范围)')
def onDateTimeBetweenDates(self, i):
if i == 2:
self.line.append('日期时间(同左)')
if i == 0:
self.line.remove('日期时间(同左)')
def onDateTimeThisCentury(self, i):
if i == 2:
self.line.append('本世纪中的日期和时间')
if i == 0:
self.line.remove('本世纪中的日期和时间')
def onDateTimeThisDecade(self, i):
if i == 2:
self.line.append('本年代中的日期和时间')
if i == 0:
self.line.remove('本年代中的日期和时间')
def onDateTimeThisMonth(self, i):
if i == 2:
self.line.append('本月中的日期和时间')
if i == 0:
self.line.remove('本月中的日期和时间')
def onDateTimeThisYear(self, i):
if i == 2:
self.line.append('本年中的日期和时间')
if i == 0:
self.line.remove('本年中的日期和时间')
def onDayOfMonth(self, i):
if i == 2:
self.line.append('几号')
if i == 0:
self.line.remove('几号')
def onDayOfWeek(self, i):
if i == 2:
self.line.append('星期几')
if i == 0:
self.line.remove('星期几')
def onFutureDate(self, i):
if i == 2:
self.line.append('未来日期')
if i == 0:
self.line.remove('未来日期')
def onFutureDatetime(self, i):
if i == 2:
self.line.append('未来日期和时间')
if i == 0:
self.line.remove('未来日期和时间')
def onIso8601(self, i):
if i == 2:
self.line.append('iso8601格式日期和时间')
if i == 0:
self.line.remove('iso8601格式日期和时间')
def onMonth(self, i):
if i == 2:
self.line.append('月份')
if i == 0:
self.line.remove('月份')
def onMonthName(self, i):
if i == 2:
self.line.append('月份名称')
if i == 0:
self.line.remove('月份名称')
def onPastDate(self, i):
if i == 2:
self.line.append('过去日期')
if i == 0:
self.line.remove('过去日期')
def onPastDatetime(self, i):
if i == 2:
self.line.append('过去日期和时间')
if i == 0:
self.line.remove('过去日期和时间')
def onTime(self, i):
if i == 2:
self.line.append('时间')
if i == 0:
self.line.remove('时间')
def onTimeDelta(self, i):
if i == 2:
self.line.append('时间间隔')
if i == 0:
self.line.remove('时间间隔')
def onTimeObject(self, i):
if i == 2:
self.line.append('时间(最大限制)')
if i == 0:
self.line.remove('时间(最大限制)')
def onTimeSeries(self, i):
if i == 2:
self.line.append('时间序列')
if i == 0:
self.line.remove('时间序列')
def onTimezone(self, i):
if i == 2:
self.line.append('时区')
if i == 0:
self.line.remove('时区')
def onUnixTime(self, i):
if i == 2:
self.line.append('UNIX时间戳')
if i == 0:
self.line.remove('UNIX时间戳')
def onYear(self, i):
if i == 2:
self.line.append('某年')
if i == 0:
self.line.remove('某年')
def onFilesAll(self, i):
if i == 2:
self.file_extension.setChecked(True)
self.file_name.setChecked(True)
self.file_path.setChecked(True)
self.mime_type.setChecked(True)
self.unix_device.setChecked(True)
self.unix_partition.setChecked(True)
if i == 0:
self.file_extension.setChecked(False)
self.file_name.setChecked(False)
self.file_path.setChecked(False)
self.mime_type.setChecked(False)
self.unix_device.setChecked(False)
self.unix_partition.setChecked(False)
def onFileExtension(self, i):
if i == 2:
self.line.append('文件扩展名')
if i == 0:
self.line.remove('文件扩展名')
def onFileName(self, i):
if i == 2:
self.line.append('文件名')
if i == 0:
self.line.remove('文件名')
def onFilePath(self, i):
if i == 2:
self.line.append('文件路径')
if i == 0:
self.line.remove('文件路径')
def onMimeType(self, i):
if i == 2:
self.line.append('MIME类型')
if i == 0:
self.line.remove('MIME类型')
def onUnixDevice(self, i):
if i == 2:
self.line.append('UNIX设备')
if i == 0:
self.line.remove('UNIX设备')
def onUnixPartition(self, i):
if i == 2:
self.line.append('UNIX分区')
if i == 0:
self.line.remove('UNIX分区')
def onCoOrdinateAll(self, i):
if i == 2:
self.coordinate.setChecked(True)
self.latitude.setChecked(True)
self.latlng.setChecked(False)
self.local_latlng.setChecked(False)
self.location_on_land.setChecked(False)
self.longitude.setChecked(True)
if i == 0:
self.coordinate.setChecked(False)
self.latitude.setChecked(False)
self.latlng.setChecked(False)
self.local_latlng.setChecked(False)
self.location_on_land.setChecked(False)
self.longitude.setChecked(False)
def onCoordinate(self, i):
if i == 2:
self.line.append('坐标')
if i == 0:
self.line.remove('坐标')
def onLatitude(self, i):
if i == 2:
self.line.append('纬度')
if i == 0:
self.line.remove('纬度')
def onLatlng(self, i):
if i == 2:
self.line.append('经纬度')
if i == 0:
self.line.remove('经纬度')
def onLocalLatlng(self, i):
if i == 2:
self.line.append('某个国家某地的经纬度')
if i == 0:
self.line.remove('某个国家某地的经纬度')
def onLocationOnLand(self, i):
if i == 2:
self.line.append('地球上某个位置的经纬度')
if i == 0:
self.line.remove('地球上某个位置的经纬度')
def onLongitude(self, i):
if i == 2:
self.line.append('经度')
if i == 0:
self.line.remove('经度')
def onNetworkAll(self, i):
if i == 2:
self.ascii_company_email.setChecked(True)
self.ascii_email.setChecked(True)
self.ascii_free_email.setChecked(True)
self.ascii_safe_email.setChecked(True)
self.company_email.setChecked(True)
self.domain_name.setChecked(True)
self.domain_word.setChecked(True)
self.email.setChecked(True)
self.free_email.setChecked(True)
self.free_email_domain.setChecked(True)
self.hostname.setChecked(True)
self.ipv4_network_class.setChecked(True)
self.ipv4_private.setChecked(True)
self.ipv4_public.setChecked(True)
self.ipv6.setChecked(True)
self.mac_address.setChecked(True)
self.safe_email.setChecked(True)
self.slug.setChecked(True)
self.tld.setChecked(True)
self.uri.setChecked(True)
self.uri_extension.setChecked(True)
self.uri_page.setChecked(True)
self.uri_path.setChecked(True)
self.url_schemes.setChecked(True)
self.user_name.setChecked(True)
if i == 0:
self.ascii_company_email.setChecked(False)
self.ascii_email.setChecked(False)
self.ascii_free_email.setChecked(False)
self.ascii_safe_email.setChecked(False)
self.company_email.setChecked(False)
self.domain_name.setChecked(False)
self.domain_word.setChecked(False)
self.email.setChecked(False)
self.free_email.setChecked(False)
self.free_email_domain.setChecked(False)
self.hostname.setChecked(False)
self.ipv4_network_class.setChecked(False)
self.ipv4_private.setChecked(False)
self.ipv4_public.setChecked(False)
self.ipv6.setChecked(False)
self.mac_address.setChecked(False)
self.safe_email.setChecked(False)
self.slug.setChecked(False)
self.tld.setChecked(False)
self.uri.setChecked(False)
self.uri_extension.setChecked(False)
self.uri_page.setChecked(False)
self.uri_path.setChecked(False)
self.url_schemes.setChecked(False)
self.user_name.setChecked(False)
def onAsciiCompanyEmail(self, i):
if i == 2:
self.line.append('企业邮箱(ascii编码)')
if i == 0:
self.line.remove('企业邮箱(ascii编码)')
def onAsciiEmail(self, i):
if i == 2:
self.line.append('企业邮箱+免费邮箱(ascii编码)')
if i == 0:
self.line.remove('企业邮箱+免费邮箱(ascii编码)')
def onAsciiFreeEmail(self, i):
if i == 2:
self.line.append('免费邮箱(ascii编码)')
if i == 0:
self.line.remove('免费邮箱(ascii编码)')
def onAsciiSafeEmail(self, i):
if i == 2:
self.line.append('安全邮箱(ascii编码)')
if i == 0:
self.line.remove('安全邮箱(ascii编码)')
def onCompanyEmail(self, i):
if i == 2:
self.line.append('企业邮箱')
if i == 0:
self.line.remove('企业邮箱')
def onDomainName(self, i):
if i == 2:
self.line.append('域名')
if i == 0:
self.line.remove('域名')
def onDomainWord(self, i):
if i == 2:
self.line.append('二级域名')
if i == 0:
self.line.remove('二级域名')
def onEmail(self, i):
if i == 2:
self.line.append('企业邮箱+免费邮箱')
if i == 0:
self.line.remove('企业邮箱+免费邮箱')
def onFreeEmail(self, i):
if i == 2:
self.line.append('免费邮箱')
if i == 0:
self.line.remove('免费邮箱')
def onFreeEmailDomain(self, i):
if i == 2:
self.line.append('免费邮箱域名')
if i == 0:
self.line.remove('免费邮箱域名')
def onHostname(self, i):
if i == 2:
self.line.append('主机名')
if i == 0:
self.line.remove('主机名')
def onIpv4NetworkClass(self, i):
if i == 2:
self.line.append('ipv4网络等级')
if i == 0:
self.line.remove('ipv4网络等级')
def onIpv4Private(self, i):
if i == 2:
self.line.append('私有ipv4')
if i == 0:
self.line.remove('私有ipv4')
def onIpv4Public(self, i):
if i == 2:
self.line.append('公共ipv4')
if i == 0:
self.line.remove('公共ipv4')
def onIpv6(self, i):
if i == 2:
self.line.append('ipv6')
if i == 0:
self.line.remove('ipv6')
def onMacAddress(self, i):
if i == 2:
self.line.append('MAC地址')
if i == 0:
self.line.remove('MAC地址')
def onSafeEmail(self, i):
if i == 2:
self.line.append('安全邮箱')
if i == 0:
self.line.remove('安全邮箱')
def onSlug(self, i):
if i == 2:
self.line.append('URL中的slug')
if i == 0:
self.line.remove('URL中的slug')
def onTld(self, i):
if i == 2:
self.line.append('顶级域名')
if i == 0:
self.line.remove('顶级域名')
def onUri(self, i):
if i == 2:
self.line.append('URI(精确到文件)')
if i == 0:
self.line.remove('URI(精确到文件)')
def onUriExtension(self, i):
if i == 2:
self.line.append('URI扩展')
if i == 0:
self.line.remove('URI扩展')
def onUriPage(self, i):
if i == 2:
self.line.append('URI页')
if i == 0:
self.line.remove('URI页')
def onUriPath(self, i):
if i == 2:
self.line.append('URI路径')
if i == 0:
self.line.remove('URI路径')
def onUrlSchemes(self, i):
if i == 2:
self.line.append('URL(精确到路径)')
if i == 0:
self.line.remove('URL(精确到路径)')
def onUserName(self, i):
if i == 2:
self.line.append('用户名')
if i == 0:
self.line.remove('用户名')
def onBooksAll(self, i):
if i == 2:
self.isbn10.setChecked(True)
self.isbn13.setChecked(True)
if i == 0:
self.isbn10.setChecked(False)
self.isbn13.setChecked(False)
def onIsbn10(self, i):
if i == 2:
self.line.append('ISBN-10图书编号')
if i == 0:
self.line.remove('ISBN-10图书编号')
def onIsbn13(self, i):
if i == 2:
self.line.append('ISBN-13图书编号')
if i == 0:
self.line.remove('ISBN-13图书编号')
def onPositionAll(self, i):
if i == 2:
self.job.setChecked(True)
if i == 0:
self.job.setChecked(False)
def onJob(self, i):
if i == 2:
self.line.append('职位')
if i == 0:
self.line.remove('职位')
def onTextAll(self, i):
if i == 2:
self.paragraph.setChecked(True)
self.paragraphs.setChecked(False)
self.sentence.setChecked(True)
self.sentences.setChecked(False)
self.text.setChecked(True)
self.texts.setChecked(False)
self.word.setChecked(True)
self.words.setChecked(False)
if i == 0:
self.paragraph.setChecked(False)
self.paragraphs.setChecked(False)
self.sentence.setChecked(False)
self.sentences.setChecked(False)
self.text.setChecked(False)
self.texts.setChecked(False)
self.word.setChecked(False)
self.words.setChecked(False)
def onParagraph(self, i):
if i == 2:
self.line.append('单个段落')
if i == 0:
self.line.remove('单个段落')
def onParagraphs(self, i):
if i == 2:
self.line.append('多个段落')
if i == 0:
self.line.remove('多个段落')
def onSentence(self, i):
if i == 2:
self.line.append('单个句子')
if i == 0:
self.line.remove('单个句子')
def onSentences(self, i):
if i == 2:
self.line.append('多个句子')
if i == 0:
self.line.remove('多个句子')
def onText(self, i):
if i == 2:
self.line.append('单个文本')
if i == 0:
self.line.remove('单个文本')
def onTexts(self, i):
if i == 2:
self.line.append('多个文本')
if i == 0:
self.line.remove('多个文本')
def onWord(self, i):
if i == 2:
self.line.append('单个词语')
if i == 0:
self.line.remove('单个词语')
def onWords(self, i):
if i == 2:
self.line.append('多个词语')
if i == 0:
self.line.remove('多个词语')
def onCodeAll(self, i):
if i == 2:
self.binary.setChecked(False)
self.boolean.setChecked(True)
self.md5.setChecked(True)
self.null_boolean.setChecked(True)
self.password.setChecked(True)
self.sha1.setChecked(True)
self.sha256.setChecked(True)
self.uuid4.setChecked(True)
if i == 0:
self.binary.setChecked(False)
self.boolean.setChecked(False)
self.md5.setChecked(False)
self.null_boolean.setChecked(False)
self.password.setChecked(False)
self.sha1.setChecked(False)
self.sha256.setChecked(False)
self.uuid4.setChecked(False)
def onBinary(self, i):
if i == 2:
self.line.append('二进制')
if i == 0:
self.line.remove('二进制')
def onBoolean(self, i):
if i == 2:
self.line.append('布尔值')
if i == 0:
self.line.remove('布尔值')
def onMd5(self, i):
if i == 2:
self.line.append('Md5')
if i == 0:
self.line.remove('Md5')
def onNullBoolean(self, i):
if i == 2:
self.line.append('NULL+布尔值')
if i == 0:
self.line.remove('NULL+布尔值')
def onPassword(self, i):
if i == 2:
self.line.append('密码')
if i == 0:
self.line.remove('密码')
def onSha1(self, i):
if i == 2:
self.line.append('SHA1')
if i == 0:
self.line.remove('SHA1')
def onSha256(self, i):
if i == 2:
self.line.append('SHA256')
if i == 0:
self.line.remove('SHA256')
def onUuid4(self, i):
if i == 2:
self.line.append('UUID4')
if i == 0:
self.line.remove('UUID4')
def onPeoplesAll(self, i):
if i == 2:
self.first_name.setChecked(True)
self.first_name_female.setChecked(True)
self.first_name_male.setChecked(True)
self.first_romanized_name.setChecked(True)
self.last_name.setChecked(True)
self.last_name_female.setChecked(True)
self.last_name_male.setChecked(True)
self.last_romanized_name.setChecked(True)
self.name.setChecked(True)
self.name_female.setChecked(True)
self.name_male.setChecked(True)
self.prefix.setChecked(True)
self.prefix_female.setChecked(True)
self.prefix_male.setChecked(True)
self.romanized_name.setChecked(True)
self.suffix.setChecked(True)
if i == 0:
self.first_name.setChecked(False)
self.first_name_female.setChecked(False)
self.first_name_male.setChecked(False)
self.first_romanized_name.setChecked(False)
self.last_name.setChecked(False)
self.last_name_female.setChecked(False)
self.last_name_male.setChecked(False)
self.last_romanized_name.setChecked(False)
self.name.setChecked(False)
self.name_female.setChecked(False)
self.name_male.setChecked(False)
self.prefix.setChecked(False)
self.prefix_female.setChecked(False)
self.prefix_male.setChecked(False)
self.romanized_name.setChecked(False)
self.suffix.setChecked(False)
def onFirstName(self, i):
if i == 2:
self.line.append('名')
if i == 0:
self.line.remove('名')
def onFirstNameFemale(self, i):
if i == 2:
self.line.append('名(女)')
if i == 0:
self.line.remove('名(女)')
def onFirstNameMale(self, i):
if i == 2:
self.line.append('名(男)')
if i == 0:
self.line.remove('名(男)')
def onFirstRomanizedName(self, i):
if i == 2:
self.line.append('名(罗马文)')
if i == 0:
self.line.remove('名(罗马文)')
def onLastName(self, i):
if i == 2:
self.line.append('姓')
if i == 0:
self.line.remove('姓')
def onLastNameFemale(self, i):
if i == 2:
self.line.append('姓(女)')
if i == 0:
self.line.remove('姓(女)')
def onLastNameMale(self, i):
if i == 2:
self.line.append('姓(男)')
if i == 0:
self.line.remove('姓(男)')
def onLastRomanizedName(self, i):
if i == 2:
self.line.append('姓(罗马文)')
if i == 0:
self.line.remove('姓(罗马文)')
def onName(self, i):
if i == 2:
self.line.append('姓名')
if i == 0:
self.line.remove('姓名')
def onNameFemale(self, i):
if i == 2:
self.line.append('姓名(女)')
if i == 0:
self.line.remove('姓名(女)')
def onNameMale(self, i):
if i == 2:
self.line.append('姓名(男)')
if i == 0:
self.line.remove('姓名(男)')
def onPrefix(self, i):
if i == 2:
self.line.append('称谓')
if i == 0:
self.line.remove('称谓')
def onPrefixFemale(self, i):
if i == 2:
self.line.append('称谓(女)')
if i == 0:
self.line.remove('称谓(女)')
def onPrefixMale(self, i):
if i == 2:
self.line.append('称谓(男)')
if i == 0:
self.line.remove('称谓(男)')
def onRomanizedName(self, i):
if i == 2:
self.line.append('称谓(罗马文)')
if i == 0:
self.line.remove('称谓(罗马文)')
def onSuffix(self, i):
if i == 2:
self.line.append('姓名后缀(中文不适用)')
if i == 0:
self.line.remove('姓名后缀(中文不适用)')
def onPhoneAll(self, i):
if i == 2:
self.msisdn.setChecked(True)
self.phone_number.setChecked(True)
self.phonenumber_prefix.setChecked(True)
if i == 0:
self.msisdn.setChecked(False)
self.phone_number.setChecked(False)
self.phonenumber_prefix.setChecked(False)
def onMsisdn(self, i):
if i == 2:
self.line.append('完整手机号码(包含国家和国内区号)')
if i == 0:
self.line.remove('完整手机号码(包含国家和国内区号)')
def onPhoneNumber(self, i):
if i == 2:
self.line.append('手机号')
if i == 0:
self.line.remove('手机号')
def onPhoneNumberPrefix(self, i):
if i == 2:
self.line.append('区号')
if i == 0:
self.line.remove('区号')
def onArchivesAll(self, i):
if i == 2:
self.profile.setChecked(False)
self.simple_profile.setChecked(False)
if i == 0:
self.profile.setChecked(False)
self.simple_profile.setChecked(False)
def onProfile(self, i):
if i == 2:
self.line.append('档案(完整)')
if i == 0:
self.line.remove('档案(完整)')
def onSimpleProfile(self, i):
if i == 2:
self.line.append('档案(简单)')
if i == 0:
self.line.remove('档案(简单)')
def onIdCardAll(self, i):
if i == 2:
self.ssn.setChecked(True)
if i == 0:
self.ssn.setChecked(False)
def onSsn(self, i):
if i == 2:
self.line.append('身份证')
if i == 0:
self.line.remove('身份证')
def onUserAgentAll(self, i):
if i == 2:
self.android_platform_token.setChecked(True)
self.chrome.setChecked(True)
self.firefox.setChecked(True)
self.internet_explorer.setChecked(True)
self.ios_platform_token.setChecked(True)
self.linux_platform_token.setChecked(True)
self.linux_processor.setChecked(True)
self.mac_platform_token.setChecked(True)
self.mac_processor.setChecked(True)
self.opera.setChecked(True)
self.safari.setChecked(True)
self.user_agent.setChecked(True)
self.windows_platform_token.setChecked(True)
if i == 0:
self.android_platform_token.setChecked(False)
self.chrome.setChecked(False)
self.firefox.setChecked(False)
self.internet_explorer.setChecked(False)
self.ios_platform_token.setChecked(False)
self.linux_platform_token.setChecked(False)
self.linux_processor.setChecked(False)
self.mac_platform_token.setChecked(False)
self.mac_processor.setChecked(False)
self.opera.setChecked(False)
self.safari.setChecked(False)
self.user_agent.setChecked(False)
self.windows_platform_token.setChecked(False)
def onAndroidPlatformToken(self, i):
if i == 2:
self.line.append('安卓')
if i == 0:
self.line.remove('安卓')
def onChrome(self, i):
if i == 2:
self.line.append('Chrome')
if i == 0:
self.line.remove('Chrome')
def onFirefox(self, i):
if i == 2:
self.line.append('FireFox')
if i == 0:
self.line.remove('FireFox')
def onInternetExplorer(self, i):
if i == 2:
self.line.append('Ie')
if i == 0:
self.line.remove('Ie')
def onIosPlatformToken(self, i):
if i == 2:
self.line.append('ios')
if i == 0:
self.line.remove('ios')
def onLinuxPlatformToken(self, i):
if i == 2:
self.line.append('Linux')
if i == 0:
self.line.remove('Linux')
def onLinuxProcessor(self, i):
if i == 2:
self.line.append('Linux处理器')
if i == 0:
self.line.remove('Linux处理器')
def onMacPlatformToken(self, i):
if i == 2:
self.line.append('Mac')
if i == 0:
self.line.remove('Mac')
def onMacProcessor(self, i):
if i == 2:
self.line.append('Mac处理器')
if i == 0:
self.line.remove('Mac处理器')
def onOpera(self, i):
if i == 2:
self.line.append('Opera')
if i == 0:
self.line.remove('Opera')
def onSafari(self, i):
if i == 2:
self.line.append('Safari')
if i == 0:
self.line.remove('Safari')
def onUserAgent(self, i):
if i == 2:
self.line.append('随机用户代理')
if i == 0:
self.line.remove('随机用户代理')
def onWindowsPlatformToken(self, i):
if i == 2:
self.line.append('Windows')
if i == 0:
self.line.remove('Windows')
# 生成按钮点击事件
def onCreateExcel(self):
# 判断:如果输入的条数不为空,则获取生成数据条数,否则给予默认值1(给第一行列名留位置)
if self.pIntLineEdit.text() != '' and self.pIntLineEdit.text() is not None:
self.num = int(self.pIntLineEdit.text())
else:
self.num = 1
# 文件名
file_name = "基础信息表.xlsx"
# 判断文件是否被打开
if not self.is_file_occupy(file_name):
with open(file_name, mode='w', encoding='utf-8') as f:
# 循环生成标题
for num, item in enumerate(self.line, 1):
self.sheet.cell(1, num).value = item
# 生成内容
for num, i in enumerate(range(1, int(self.num + 1)), 1):
self.sheet.cell(i + 1, 1).value = num
for x, item in enumerate(self.line, 1):
if item == '地址':
self.sheet.cell(num + 1, x).value = self.fk.address()
if item == '楼名':
self.sheet.cell(num + 1, x).value = self.fk.building_number()
if item == '完整城市名':
self.sheet.cell(num + 1, x).value = self.fk.city()
if item == '城市名(无市县)':
self.sheet.cell(num + 1, x).value = self.fk.city_name()
if item == '城市后缀名':
self.sheet.cell(num + 1, x).value = self.fk.city_suffix()
if item == '国家名称':
self.sheet.cell(num + 1, x).value = self.fk.country()
if item == '国家编号':
self.sheet.cell(num + 1, x).value = self.fk.country_code()
if item == '地区':
self.sheet.cell(num + 1, x).value = self.fk.district()
if item == '邮编':
self.sheet.cell(num + 1, x).value = self.fk.postcode()
if item == '省(中国)':
self.sheet.cell(num + 1, x).value = self.fk.province()
if item == '街道地址':
self.sheet.cell(num + 1, x).value = self.fk.street_address()
if item == '街道名称':
self.sheet.cell(num + 1, x).value = self.fk.street_name()
if item == '街道后缀名':
self.sheet.cell(num + 1, x).value = self.fk.street_suffix()
if item == '牌照':
self.sheet.cell(num + 1, x).value = self.fk.license_plate()
if item == '银行所属国家':
self.sheet.cell(num + 1, x).value = self.fk.bank_country()
if item == '基本银行账号':
self.sheet.cell(num + 1, x).value = self.fk.bban()
if item == '国际银行代码':
self.sheet.cell(num + 1, x).value = self.fk.iban()
if item == 'EAN条形码':
self.sheet.cell(num + 1, x).value = self.fk.ean()
if item == 'EAN13条形码':
self.sheet.cell(num + 1, x).value = self.fk.ean13()
if item == 'EAN8条形码':
self.sheet.cell(num + 1, x).value = self.fk.ean8()
if item == '颜色名称':
self.sheet.cell(num + 1, x).value = self.fk.color_name()
if item == '颜色十六进制值':
self.sheet.cell(num + 1, x).value = self.fk.hex_color()
if item == '颜色RGB值':
self.sheet.cell(num + 1, x).value = self.fk.rgb_color()
if item == 'CSS颜色值':
self.sheet.cell(num + 1, x).value = self.fk.rgb_css_color()
if item == '安全色':
self.sheet.cell(num + 1, x).value = self.fk.safe_color_name()
if item == '安全色十六进制值':
self.sheet.cell(num + 1, x).value = self.fk.safe_hex_color()
if item == '商业用词':
self.sheet.cell(num + 1, x).value = self.fk.bs()
if item == '妙句(口号)':
self.sheet.cell(num + 1, x).value = self.fk.catch_phrase()
if item == '公司名称':
self.sheet.cell(num + 1, x).value = self.fk.company()
if item == '公司名称前缀':
self.sheet.cell(num + 1, x).value = self.fk.company_prefix()
if item == '公司名称后缀':
self.sheet.cell(num + 1, x).value = self.fk.company_suffix()
if item == '过期年月':
self.sheet.cell(num + 1, x).value = self.fk.credit_card_expire()
if item == '完整信用卡信息':
self.sheet.cell(num + 1, x).value = self.fk.credit_card_full()
if item == '信用卡卡号':
self.sheet.cell(num + 1, x).value = self.fk.credit_card_number()
if item == '信用卡提供商':
self.sheet.cell(num + 1, x).value = self.fk.credit_card_provider()
if item == '信用卡安全码':
self.sheet.cell(num + 1, x).value = self.fk.credit_card_security_code()
if item == '加密货币代码+名称':
self.sheet.cell(num + 1, x).value = self.fk.cryptocurrency()
if item == '加密货币代码':
self.sheet.cell(num + 1, x).value = self.fk.cryptocurrency_code()
if item == '加密货币名称':
self.sheet.cell(num + 1, x).value = self.fk.cryptocurrency_name()
if item == '货币代码+名称':
self.sheet.cell(num + 1, x).value = self.fk.currency()
if item == '货币代码':
self.sheet.cell(num + 1, x).value = self.fk.currency_code()
if item == '货币名称':
self.sheet.cell(num + 1, x).value = self.fk.currency_name()
if item == 'AM或PM':
self.sheet.cell(num + 1, x).value = self.fk.am_pm()
if item == '世纪':
self.sheet.cell(num + 1, x).value = self.fk.century()
if item == '日期字符串':
self.sheet.cell(num + 1, x).value = self.fk.date()
if item == '日期(限定范围)':
self.sheet.cell(num + 1, x).value = self.fk.date_between()
if item == '日期(同左)':
self.sheet.cell(num + 1, x).value = self.fk.date_between_dates()
if item == '日期(最大限制)':
self.sheet.cell(num + 1, x).value = self.fk.date_object()
if item == '出生日期':
self.sheet.cell(num + 1, x).value = self.fk.date_of_birth()
if item == '本世纪日期':
self.sheet.cell(num + 1, x).value = self.fk.date_this_century()
if item == '本年代日期':
self.sheet.cell(num + 1, x).value = self.fk.date_this_decade()
if item == '本月日期':
self.sheet.cell(num + 1, x).value = self.fk.date_this_month()
if item == '本年日期':
self.sheet.cell(num + 1, x).value = self.fk.date_this_year()
if item == '日期时间':
self.sheet.cell(num + 1, x).value = self.fk.date_time()
if item == '日期时间(从001年1月1日到现在)':
self.sheet.cell(num + 1, x).value = self.fk.date_time_ad()
if item == '日期时间(限定范围)':
self.sheet.cell(num + 1, x).value = self.fk.date_time_between()
if item == '日期时间(同左)':
self.sheet.cell(num + 1, x).value = self.fk.date_time_between_dates()
if item == '本世纪中的日期和时间':
self.sheet.cell(num + 1, x).value = self.fk.date_time_this_century()
if item == '本年代中的日期和时间':
self.sheet.cell(num + 1, x).value = self.fk.date_time_this_decade()
if item == '本月中的日期和时间':
self.sheet.cell(num + 1, x).value = self.fk.date_time_this_month()
if item == '本年中的日期和时间':
self.sheet.cell(num + 1, x).value = self.fk.date_time_this_year()
if item == '几号':
self.sheet.cell(num + 1, x).value = self.fk.day_of_month()
if item == '星期几':
self.sheet.cell(num + 1, x).value = self.fk.day_of_week()
if item == '未来日期':
self.sheet.cell(num + 1, x).value = self.fk.future_date()
if item == '未来日期和时间':
self.sheet.cell(num + 1, x).value = self.fk.future_datetime()
if item == 'iso8601格式日期和时间':
self.sheet.cell(num + 1, x).value = self.fk.iso8601()
if item == '月份':
self.sheet.cell(num + 1, x).value = self.fk.month()
if item == '月份名称':
self.sheet.cell(num + 1, x).value = self.fk.month_name()
if item == '过去日期':
self.sheet.cell(num + 1, x).value = self.fk.past_date()
if item == '过去日期和时间':
self.sheet.cell(num + 1, x).value = self.fk.past_datetime()
if item == '时间':
self.sheet.cell(num + 1, x).value = self.fk.time()
if item == '时间间隔':
self.sheet.cell(num + 1, x).value = self.fk.time_delta()
if item == '时间(最大限制)':
self.sheet.cell(num + 1, x).value = self.fk.time_object()
if item == '时区':
self.sheet.cell(num + 1, x).value = self.fk.timezone()
if item == 'UNIX时间戳':
self.sheet.cell(num + 1, x).value = self.fk.unix_time()
if item == '某年':
self.sheet.cell(num + 1, x).value = self.fk.year()
if item == '文件扩展名':
self.sheet.cell(num + 1, x).value = self.fk.file_extension()
if item == '文件名':
self.sheet.cell(num + 1, x).value = self.fk.file_name()
if item == '文件路径':
self.sheet.cell(num + 1, x).value = self.fk.file_path()
if item == 'MIME类型':
self.sheet.cell(num + 1, x).value = self.fk.mime_type()
if item == 'UNIX设备':
self.sheet.cell(num + 1, x).value = self.fk.unix_device()
if item == 'UNIX分区':
self.sheet.cell(num + 1, x).value = self.fk.unix_partition()
if item == '坐标':
self.sheet.cell(num + 1, x).value = self.fk.coordinate()
if item == '纬度':
self.sheet.cell(num + 1, x).value = self.fk.latitude()
if item == '经纬度':
self.sheet.cell(num + 1, x).value = self.fk.latlng()
if item == '某个国家某地的经纬度':
self.sheet.cell(num + 1, x).value = self.fk.local_latlng()
if item == '地球上某个位置的经纬度':
self.sheet.cell(num + 1, x).value = self.fk.location_on_land()
if item == '经度':
self.sheet.cell(num + 1, x).value = self.fk.longitude()
if item == '企业邮箱(ascii编码)':
self.sheet.cell(num + 1, x).value = self.fk.ascii_company_email()
if item == '企业邮箱+免费邮箱(ascii编码)':
self.sheet.cell(num + 1, x).value = self.fk.ascii_email()
if item == '免费邮箱(ascii编码)':
self.sheet.cell(num + 1, x).value = self.fk.ascii_free_email()
if item == '安全邮箱(ascii编码)':
self.sheet.cell(num + 1, x).value = self.fk.ascii_safe_email()
if item == '企业邮箱':
self.sheet.cell(num + 1, x).value = self.fk.company_email()
if item == '域名':
self.sheet.cell(num + 1, x).value = self.fk.domain_name()
if item == '二级域名':
self.sheet.cell(num + 1, x).value = self.fk.domain_word()
if item == '企业邮箱+免费邮箱':
self.sheet.cell(num + 1, x).value = self.fk.email()
if item == '免费邮箱':
self.sheet.cell(num + 1, x).value = self.fk.free_email()
if item == '免费邮箱域名':
self.sheet.cell(num + 1, x).value = self.fk.free_email_domain()
if item == '主机名':
self.sheet.cell(num + 1, x).value = self.fk.hostname()
if item == '图片URL':
self.sheet.cell(num + 1, x).value = self.fk.image_url()
if item == 'ipv4':
self.sheet.cell(num + 1, x).value = self.fk.ipv4()
if item == 'ipv4网络等级':
self.sheet.cell(num + 1, x).value = self.fk.ipv4_network_class()
if item == '私有ipv4':
self.sheet.cell(num + 1, x).value = self.fk.ipv4_private()
if item == '公共ipv4':
self.sheet.cell(num + 1, x).value = self.fk.ipv4_public()
if item == 'ipv6':
self.sheet.cell(num + 1, x).value = self.fk.ipv6()
if item == 'MAC地址':
self.sheet.cell(num + 1, x).value = self.fk.mac_address()
if item == '安全邮箱':
self.sheet.cell(num + 1, x).value = self.fk.safe_email()
if item == 'URL中的slug':
self.sheet.cell(num + 1, x).value = self.fk.slug()
if item == '顶级域名':
self.sheet.cell(num + 1, x).value = self.fk.tld()
if item == 'URI(精确到文件)':
self.sheet.cell(num + 1, x).value = self.fk.uri()
if item == 'URI扩展':
self.sheet.cell(num + 1, x).value = self.fk.uri_extension()
if item == 'URI页':
self.sheet.cell(num + 1, x).value = self.fk.uri_page()
if item == 'URI路径':
self.sheet.cell(num + 1, x).value = self.fk.uri_path()
if item == 'URL(精确到路径)':
self.sheet.cell(num + 1, x).value = self.fk.url()
if item == '用户名':
self.sheet.cell(num + 1, x).value = self.fk.user_name()
if item == 'ISBN-10图书编号':
self.sheet.cell(num + 1, x).value = self.fk.isbn10()
if item == 'ISBN-13图书编号':
self.sheet.cell(num + 1, x).value = self.fk.isbn13()
if item == '职位':
self.sheet.cell(num + 1, x).value = self.fk.job()
if item == '单个段落':
self.sheet.cell(num + 1, x).value = self.fk.paragraph()
if item == '多个段落':
self.sheet.cell(num + 1, x).value = self.fk.paragraphs()
if item == '单个句子':
self.sheet.cell(num + 1, x).value = self.fk.sentence()
if item == '多个句子':
self.sheet.cell(num + 1, x).value = self.fk.sentences()
if item == '单个文本':
self.sheet.cell(num + 1, x).value = self.fk.text()
if item == '多个文本':
self.sheet.cell(num + 1, x).value = self.fk.texts()
if item == '单个词语':
self.sheet.cell(num + 1, x).value = self.fk.word()
if item == '多个词语':
self.sheet.cell(num + 1, x).value = self.fk.words()
if item == '二进制':
self.sheet.cell(num + 1, x).value = self.fk.binary()
if item == '布尔值':
self.sheet.cell(num + 1, x).value = self.fk.boolean()
if item == 'Md5':
self.sheet.cell(num + 1, x).value = self.fk.md5()
if item == 'NULL+布尔值':
self.sheet.cell(num + 1, x).value = self.fk.null_boolean()
if item == '密码':
self.sheet.cell(num + 1, x).value = self.fk.password()
if item == 'SHA1':
self.sheet.cell(num + 1, x).value = self.fk.sha1()
if item == 'SHA256':
self.sheet.cell(num + 1, x).value = self.fk.sha256()
if item == 'UUID4':
self.sheet.cell(num + 1, x).value = self.fk.uuid4()
if item == '名':
self.sheet.cell(num + 1, x).value = self.fk.first_name()
if item == '名(女)':
self.sheet.cell(num + 1, x).value = self.fk.first_name_female()
if item == '名(男)':
self.sheet.cell(num + 1, x).value = self.fk.first_name_male()
if item == '名(罗马文)':
self.sheet.cell(num + 1, x).value = self.fk.first_romanized_name()
if item == '姓':
self.sheet.cell(num + 1, x).value = self.fk.last_name()
if item == '姓(女)':
self.sheet.cell(num + 1, x).value = self.fk.last_name_female()
if item == '姓(男)':
self.sheet.cell(num + 1, x).value = self.fk.last_name_male()
if item == '姓(罗马文)':
self.sheet.cell(num + 1, x).value = self.fk.last_romanized_name()
if item == '姓名':
self.sheet.cell(num + 1, x).value = self.fk.name()
if item == '姓名(女)':
self.sheet.cell(num + 1, x).value = self.fk.name_female()
if item == '姓名(男)':
self.sheet.cell(num + 1, x).value = self.fk.name_male()
if item == '称谓':
self.sheet.cell(num + 1, x).value = self.fk.prefix()
if item == '称谓(女)':
self.sheet.cell(num + 1, x).value = self.fk.prefix_female()
if item == '称谓(男)':
self.sheet.cell(num + 1, x).value = self.fk.prefix_male()
if item == '称谓(罗马文)':
self.sheet.cell(num + 1, x).value = self.fk.romanized_name()
if item == '姓名后缀(中文不适用)':
self.sheet.cell(num + 1, x).value = self.fk.suffix()
if item == '完整手机号码(包含国家和国内区号)':
self.sheet.cell(num + 1, x).value = self.fk.msisdn()
if item == '手机号':
self.sheet.cell(num + 1, x).value = self.fk.phone_number()
if item == '区号':
self.sheet.cell(num + 1, x).value = self.fk.phonenumber_prefix()
if item == '档案(完整)':
self.sheet.cell(num + 1, x).value = self.fk.profile()
if item == '档案(简单)':
self.sheet.cell(num + 1, x).value = self.fk.simple_profile()
if item == '身份证':
self.sheet.cell(num + 1, x).value = self.fk.ssn()
if item == '安卓':
self.sheet.cell(num + 1, x).value = self.fk.android_platform_token()
if item == 'Chrome':
self.sheet.cell(num + 1, x).value = self.fk.chrome()
if item == 'FireFox':
self.sheet.cell(num + 1, x).value = self.fk.firefox()
if item == 'Ie':
self.sheet.cell(num + 1, x).value = self.fk.internet_explorer()
if item == 'ios':
self.sheet.cell(num + 1, x).value = self.fk.ios_platform_token()
if item == 'Linux':
self.sheet.cell(num + 1, x).value = self.fk.linux_platform_token()
if item == 'Linux处理器':
self.sheet.cell(num + 1, x).value = self.fk.linux_processor()
if item == 'Mac':
self.sheet.cell(num + 1, x).value = self.fk.mac_platform_token()
if item == 'Mac处理器':
self.sheet.cell(num + 1, x).value = self.fk.mac_processor()
if item == 'Opera':
self.sheet.cell(num + 1, x).value = self.fk.opera()
if item == 'Safari':
self.sheet.cell(num + 1, x).value = self.fk.safari()
if item == '随机用户代理':
self.sheet.cell(num + 1, x).value = self.fk.user_agent()
if item == 'Windows':
self.sheet.cell(num + 1, x).value = self.fk.windows_platform_token()
self.wb.save(file_name)
msg_box = QMessageBox(QMessageBox.Warning, '提示', '数据生成成功')
msg_box.exec_()
else:
msg_box = QMessageBox(QMessageBox.Warning, '提示', '生成文件被占用,请关闭后再试')
msg_box.exec_()
# 一键生成人物按钮
def onCreateExcel1(self):
# 判断:如果输入的条数不为空,则获取生成数据条数,否则给予默认值1(给第一行列名留位置)
if self.pIntLineEdit.text() != '' and self.pIntLineEdit.text() is not None:
self.num = int(self.pIntLineEdit.text())
else:
self.num = 1
# 列标题
self.line = ['序号', '姓名', '年龄', '性别', '身份证', '电话号码', '出生日期', '所属省(中国)', '所属市', '所属街道', '详细地址', '所属公司', '工作职位',
'车牌号', '银行账号', '信用卡卡号', '企业邮箱', '个人邮箱', '用户名', '主机名', 'IPV4地址', 'IPV6地址', 'MAC地址']
file_name = "人员基础信息表.xlsx"
if not self.is_file_occupy(file_name):
with open(file_name, mode='w', encoding='utf-8') as f:
for num, item in enumerate(self.line, 1):
self.sheet.cell(1, num).value = item
for num, i in enumerate(range(1, self.num), 1):
gender = random.choice(['男', '女'])
self.sheet.cell(i + 1, 1).value = num
self.sheet.cell(i + 1, 2).value = self.fk.name()
self.sheet.cell(i + 1, 3).value = random.randint(1, 100)
self.sheet.cell(i + 1, 4).value = gender
self.sheet.cell(i + 1, 5).value = self.fk.ssn()
self.sheet.cell(i + 1, 6).value = self.fk.phone_number()
self.sheet.cell(i + 1, 7).value = self.fk.date_of_birth()
self.sheet.cell(i + 1, 8).value = self.fk.province()
self.sheet.cell(i + 1, 9).value = self.fk.city()
self.sheet.cell(i + 1, 10).value = self.fk.street_address()
self.sheet.cell(i + 1, 11).value = self.fk.address()
self.sheet.cell(i + 1, 12).value = self.fk.company()
self.sheet.cell(i + 1, 13).value = self.fk.job()
self.sheet.cell(i + 1, 14).value = self.fk.license_plate()
self.sheet.cell(i + 1, 15).value = self.fk.bban()
self.sheet.cell(i + 1, 16).value = self.fk.credit_card_number()
self.sheet.cell(i + 1, 17).value = self.fk.ascii_company_email()
self.sheet.cell(i + 1, 18).value = self.fk.ascii_free_email()
self.sheet.cell(i + 1, 19).value = self.fk.user_name()
self.sheet.cell(i + 1, 20).value = self.fk.hostname()
self.sheet.cell(i + 1, 21).value = self.fk.ipv4()
self.sheet.cell(i + 1, 22).value = self.fk.ipv6()
self.sheet.cell(i + 1, 23).value = self.fk.mac_address()
self.wb.save(file_name)
msg_box = QMessageBox(QMessageBox.Warning, '提示', '人物数据一键生成成功')
# 数据生成成功后清除全局变量数据,以防影响到后续功能使用
self.line = [] # 清除列
msg_box.exec_()
else:
msg_box = QMessageBox(QMessageBox.Warning, '提示', '生成文件被占用,请关闭后再试')
msg_box.exec_()
# 判断文件是否被占用
def is_file_occupy(self, file_name):
try:
occupy = win32file.CreateFile(file_name, win32file.GENERIC_READ, 0, None, win32file.OPEN_EXISTING,
win32file.FILE_ATTRIBUTE_NORMAL, None)
return int(occupy) == win32file.INVALID_HANDLE_VALUE
except:
return True
finally:
try:
win32file.CloseHandle(occupy)
except:
pass
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Main()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
因为这个东西刚写完不久,使用的次数也不多,还有很多问题要改,很多地方需要优化,大家在使用过程中出现了问题,或有什么优化意见欢迎在评论区回复或私聊我。
还有一个问题一直困扰着我,在我使用pyinstaller将该项目打包成exe文件,运行会报错如下错误。为此我翻阅了很多相关博客和GitHub,至今没有找到解决办法,大概是Faker和pyinstaller有着某些冲突,如有哪位大佬能够提供一个解决办法,我将感激不尽。
Traceback (most recent call last):
File "ForgePeople.py", line 1131, in onChinaMainland
File "faker\proxy.py", line 72, in __init__
File "faker\factory.py", line 43, in create
AttributeError: Invalid configuration for faker locale `zh_CN`
[已退出进程,代码为 3221226505]
我坚持“分享知识”的原则,免费透明的将全部代码公开展示,并提供力所能及的技术支持。