def test030_Category_Name(self):
     FunctionCommon.smartsearch(self,"Ignition")
     Mutil_Selection.Products_ViewDetail(self)
     Verification.Verify_Category(self,"Ignition")
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
Exemple #2
0
 def test_case3(self):
     driver = self.driver
     time.sleep(3)
     # 步骤A
     timeA = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     for i in range(10):
         print(i)
         driver.find_elements_by_id('com.baidu.searchbox:id/eq')[0].click()
         time.sleep(3)
         for i in range(20):
             try:
                 driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x, 0.4 * self.y, 1000)
             except:
                 pass
             time.sleep(1)
             el = PublicFunctions.isElement(self,'id','com.baidu.searchbox:id/rl_commentitem')
             if el:
                 for i in range(2):
                     driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x, 0.4 * self.y, 1000)
                     time.sleep(1)
                 break
         driver.keyevent(4)
         time.sleep(3)
     time.sleep(10)
     #步骤B
     timeB = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     timeData = timeA + ',' + timeB
     # 将A 和 B 的时间用逗号连起来后,存储到相应的case文件中
     timeFile = os.getcwd() + baseConfig['case3']['directory'] + '/' + baseConfig['case3']['time_file']
     PublicFunctions.writeDateToFile(timeData, timeFile)
Exemple #3
0
    def setUp(self):        
        self.verificationErrors = []
        self.selenium = selenium("localhost", 4444, "*firefox3 E:/Program Files/Mozilla Firefox/firefox.exe", "http://www.lofinc.net/login/account")
        sel=self.selenium
        sel.start()
        sel.set_timeout("0")        
        sel.open("/")

        # Login
        for i in range(0, 30):
            if sel.is_element_present("login_email") == True:
                sel.type("login_email","*****@*****.**")
                sel.type("login_pass","123456")
                sel.click("LoginButton")
                break
            else :
                time.sleep(1)

        PublicFunctions.my_wait_text_present(self, "Quick Search")  

        # If YMM have values, clean them.
        IsClean = True
        if sel.is_element_present("//span[@id='side_selected_year']/label") == True:
            IsClean = False 
        elif sel.is_element_present("//span[@id='side_selected_make']/label") == True:
            IsClean = False
        elif sel.is_element_present("//span[@id='side_selected_model']/label") == True:
            IsClean = False

        if IsClean == False:
            FunctionCommon.Clear(self,"all")
 def test022_Brand_Name(self):
     FunctionCommon.smartsearch(self,"Extang")
     Mutil_Selection.Products_ViewDetail(self)
     Verification.Verify_Brand(self,"Extang")
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
Exemple #5
0
def CropPic(picPath, cropParams, Save_Path):

    saveFilePath = Save_Path + '/' + os.path.split(
        os.path.dirname(os.path.dirname(picPath)))[1] + '/' + os.path.split(
            os.path.dirname(picPath))[1]
    if os.path.exists(saveFilePath) == False:
        os.makedirs(saveFilePath)
    with im.open(picPath) as picHandle:
        W, H = picHandle.size
        if abs(W - H) < threshold:
            new_img = picHandle.resize((cropParams[0], cropParams[1]),
                                       im.BILINEAR)

            pf.Add_Thread(
                lambda: new_img.save(saveFilePath + '/' + os.path.split(
                    picPath)[1]), 'setDaemon')
            print('正在处理:' + picPath)
        else:
            if W > H:
                new_img = picHandle.crop(((W - H) / 2, 0, (W + H) / 2, H))

                pf.Add_Thread(
                    lambda: new_img.save(saveFilePath + '/' + os.path.split(
                        picPath)[1]), 'setDaemon')

            else:
                new_img = picHandle.crop(
                    (0, (H - W) / 2, W, (H + W) / 2)).resize(
                        (cropParams[0], cropParams[1]), im.BILINEAR)

                pf.Add_Thread(
                    lambda: new_img.save(saveFilePath + '/' + os.path.split(
                        picPath)[1]), 'setDaemon')
                print('正在处理:' + picPath)
def Brand(self,value):
    PublicFunctions.my_wait_element(self,"//div[@id='LayoutColumn1']/div[2]/div[2]/ul[1]/li[2]/img")
    if PublicFunctions.my_wait_element(self,"//input[@name=\'%s\']" %value) is False:
        self.selenium.click("//div[@id='LayoutColumn1']/div[2]/div[2]/ul[1]/li[2]/img") 
    self.selenium.click("//div[@id='LayoutColumn1']/div[2]/div[2]/ul[1]/li[2]/img")
    PublicFunctions.my_wait_element(self,"//input[@name=\'%s\']" %value)
    self.selenium.click("//input[@name=\'%s\']" %value)
 def test012_Prod_SKU(self):
     FunctionCommon.smartsearch(self,"82016")
     Mutil_Selection.Products_ViewDetail(self)
     Verification.Verify_SKU(self,"82016")
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self) 
 def test030_MoreProd(self):
     Mutil_Selection.Make(self,"FORD")
     Mutil_Selection.Categories_QP(self,"Bed Mats")     
     FunctionCommon.Browser(self)   
     Mutil_Selection.SubCategories_Link(self,"category/68/subcategory/636/make/ford")
     Mutil_Selection.ProdList_AddToCart(self, "1")
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)       
 def test032_MoreProd(self):
     Mutil_Selection.Year(self,"2005")
     Mutil_Selection.Brand(self,"Extang")              
     FunctionCommon.Browser(self)
     Mutil_Selection.Series_options(self,"Extang EXPRESS Universal Tailgate Seal")
     Mutil_Selection.ProdList_AddToCart(self, "4")
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
 def test031_MoreProd(self):
     Mutil_Selection.Year(self,"2006")
     Mutil_Selection.Make(self,"DODGE")
     Mutil_Selection.Categories_QP(self,"Nerf Bars")     
     FunctionCommon.Browser(self)   
     Mutil_Selection.SubCategories_Link(self,"category/57/subcategory/728/year/2006/make/dodge")
     Mutil_Selection.ProdList_AddToCart(self, "5")
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
Exemple #11
0
 def SelectFilePath(self, method, target):
     if method == 'dir':
         directory = QFileDialog.getExistingDirectory(
             None, '文件夹选择', pf.GetDesktopPath())
         target.setText(directory)
     else:
         file = QFileDialog.getOpenFileName(None, '文件选择',
                                            pf.GetDesktopPath())
         target.setText(file[0])
 def test020_MoreProd(self):
     Mutil_Selection.Make(self,"HONDA")
     Mutil_Selection.Categories_QP(self,"Mufflers")     
     FunctionCommon.Browser(self) 
     Mutil_Selection.SubCategories_Link(self,"category/224/subcategory/421/make/honda")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.UpdateQty(self,"3")
     AddCart.CheckOut(self)
 def test021_MoreProd(self):
     Mutil_Selection.Year(self,"2009")
     Mutil_Selection.Brand(self,"K&N")              
     FunctionCommon.Browser(self)
     Mutil_Selection.Series_options(self,"Air Filter Accessories") 
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.UpdateQty(self,"3")
     AddCart.CheckOut(self)
 def test_case1(self):
     # 步骤A
     timeA = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     time.sleep(2)
     # 步骤B
     timeB = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     timeData = timeA + ',' + timeB
     # 将A 和 B 的时间用逗号连起来后,存储到相应的case文件中
     timeFile = os.getcwd() + baseConfig['case1']['directory'] + '/' + baseConfig['case1']['time_file']
     PublicFunctions.writeDateToFile(timeData, timeFile)
 def test011_TwoSubCategories(self):
     Mutil_Selection.Make(self,"TOYOTA")
     Mutil_Selection.Categories_QP(self,"Bed Mats")
     time.sleep(3)
     Mutil_Selection.Categories_QP(self,"Oil Filters")        
     FunctionCommon.Browser(self)
     Mutil_Selection.TwoSubCategories_select(self,"Universal Oil Filters","Harley Davidson Bed Mat")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
 def test010_TwoSubCategories(self):
     Mutil_Selection.Year(self,"2010")
     Mutil_Selection.Categories_QP(self,"Tonneau Covers")
     time.sleep(3)
     Mutil_Selection.Categories_QP(self,"Nerf Bars")        
     FunctionCommon.Browser(self)
     Mutil_Selection.TwoSubCategories_select(self,"Truck Champ Drop Step","Snap Tonneau Covers")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
 def test022_TwoSeries(self):
     Mutil_Selection.Year(self,"2007")
     Mutil_Selection.Brand(self,"K&N")
     time.sleep(3)
     Mutil_Selection.Brand(self,"Lund")       
     FunctionCommon.Browser(self)
     Mutil_Selection.TwoSeries_select(self,"//div[@id='subcatleftcolumn']/img","//div[5]/li[1]/div[1]/img")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
 def test020_TwoSeries(self):
     Mutil_Selection.Year(self,"2010")
     Mutil_Selection.Brand(self,"Advantage")
     time.sleep(3)
     Mutil_Selection.Brand(self,"AEM")       
     FunctionCommon.Browser(self)
     Mutil_Selection.TwoSeries_select(self,"//li[2]/div[1]/img","//div[2]/li[1]/div[1]/img")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
    def test_case4(self):
        driver = self.driver
        time.sleep(30)
        # 步骤A
        timeA = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        list = [
            '日本新防卫大纲担忧中国军事动向 华春莹:老调重弹,冷战思维', '韬蕴资本:贾跃亭躲在豪宅大门紧闭 拒绝接受任何法律文书',
            '凉凉!谷歌中国版搜索引擎被内部“毙了”', '中美经贸微妙时期,中国率先释放一重磅信号',
            '李彦宏:百度将在正确轨道上为人类服务', '无人店实地调查!风口未起的2018,门前冷清,多家关店',
            '优酷出台网络电影分账新规,能有效破除唯流量论吗?', '推特称检测到自中国和沙特IP地址的可疑活动 外交部回应',
            '解剖京东数科:刘强东持股或超25%,仍是实际控制人', '一个月播放32亿+!快手政务号引爆“政能量”传播'
        ]
        for i in range(50):
            aa = self.driver.find_elements_by_id(
                'com.baidu.searchbox:id/eq')[0].text
            if aa in list:
                self.driver.find_elements_by_id(
                    'com.baidu.searchbox:id/eq')[0].click()
                time.sleep(3)
                for i in range(20):
                    try:
                        driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x,
                                     0.4 * self.y, 1000)
                    except:
                        pass
                    time.sleep(1)
                    el = PublicFunctions.isElement(
                        self, 'id', 'com.baidu.searchbox:id/rl_commentitem')
                    if el:
                        for i in range(2):
                            driver.swipe(0.5 * self.x, 0.9 * self.y,
                                         0.5 * self.x, 0.4 * self.y, 1000)
                            time.sleep(1)
                        break
                driver.keyevent(4)
                time.sleep(3)
                del list[0]
            elif len(list) == 0:
                print('测试完成!')
                break
            else:
                print len(list)
                driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x,
                             0.8 * self.y, 1000)
        time.sleep(10)
        # 步骤B
        timeB = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        timeData = timeA + ',' + timeB
        # 将A 和 B 的时间用逗号连起来后,存储到相应的case文件中
        timeFile = os.getcwd() + baseConfig['case4'][
            'directory'] + '/' + baseConfig['case4']['time_file']

        PublicFunctions.writeDateToFile(timeData, timeFile)
 def test012_TwoSubCategories(self):
     Mutil_Selection.Year(self,"2009")
     Mutil_Selection.Categories_QP(self,"Fender Flares")
     time.sleep(3)
     Mutil_Selection.Categories_QP(self,"Gauges")        
     FunctionCommon.Browser(self)
     Mutil_Selection.TwoSubCategories_select(self,"Edge Gauge","Extended Fender Flares")
     time.sleep(5)
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
Exemple #21
0
 def test_case6(self):
     driver = self.driver
     time.sleep(30)
     # 步骤A
     timeA = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     # 把所有title都写进来
     list = [
         '样子也太可爱了吧!早期出席活动的郭碧婷,看起来好开心!',
         '娱乐圈让人羡慕的6对夫妻,黄晓明Angelababy上榜,你最看好哪对',
         '美丽少女张雪迎,穿什么衣服都好看,美貌身材兼备的小鲜肉', '佟丽娅厉害了,在耳朵上戴“戒指”不够还单扎麻花辫,美成了初恋',
         'Angelababy早期出席活动,一袭优雅高贵的礼服,犹如仙子般惊艳',
         '鹿晗真会打扮,卫衣叠加风衣帅气十足,搭配中分发型意外的时髦', '刘亦菲在裙上安扣子不够,还配双“雨滴鞋”,和黄晓明同框太抢镜',
         '网友偶遇张雪迎,街拍素颜的张雪迎也是仙气满满!', '这还是我认识的那个陈妍希吗?早期出席活动的她,这一波美我认了',
         '不愧是“亚洲第一美”!早期走活动的克拉拉,穿吊带裙没一丝赘肉'
     ]
     driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x, 0.1 * self.y,
                  1000)
     driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x, 0.1 * self.y,
                  1000)
     for i in range(50):
         aa = self.driver.find_elements_by_id(
             'com.baidu.searchbox:id/eq')[0].text
         if aa in list:
             self.driver.find_elements_by_id(
                 'com.baidu.searchbox:id/eq')[0].click()
             time.sleep(3)
             for i in range(10):
                 try:
                     driver.swipe(0.8 * self.x, 0.5 * self.y, 0.2 * self.x,
                                  0.5 * self.y, 1000)
                 except:
                     pass
                 time.sleep(1)
             self.driver.keyevent(4)
             time.sleep(3)
             del list[0]
         elif len(list) == 0:
             print('测试完成!')
             break
         else:
             print len(list)
             driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x,
                          0.8 * self.y, 1000)
     time.sleep(10)
     # 步骤B
     timeB = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     timeData = timeA + ',' + timeB
     # 将A 和 B 的时间用逗号连起来后,存储到相应的case文件中
     timeFile = os.getcwd() + baseConfig['case6'][
         'directory'] + '/' + baseConfig['case6']['time_file']
     PublicFunctions.writeDateToFile(timeData, timeFile)
 def test010_Cat_AirFilter_AirFilters(self):
     Mutil_Selection.Year(self, "2010")
     Mutil_Selection.Make(self, "FORD")
     Mutil_Selection.Categories_QP(self, "Air Filter")
     FunctionCommon.Browser(self)
     Mutil_Selection.SubCategories_Link(self, "category/15/subcategory/587/year/2010/make/ford")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self, "Your Shopping Cart")
     AddCart.CheckOut(self)
     PublicFunctions.my_wait_text_present(self, "Express Checkout")
     Payment.Step1_ProceedCheckOut(self, False)
     Payment.Step3_ShippingMethod(self)
     Payment.Step4_OrderConfirm(self)
 def test021_Cat_NerfBars_3WWRoundTube(self):
     Mutil_Selection.Year(self, "2009")
     Mutil_Selection.Make(self, "FORD")
     Mutil_Selection.Categories_QP(self, "Nerf Bars")
     FunctionCommon.Browser(self)
     Mutil_Selection.SubCategories_Link(self, "category/57/subcategory/257/year/2009/make/ford")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self, "Your Shopping Cart")
     AddCart.CheckOut(self)
     PublicFunctions.my_wait_text_present(self, "Express Checkout")
     Payment.Step1_ProceedCheckOut(self, False)
     Payment.Step3_ShippingMethod(self)
     Payment.Step4_OrderConfirm(self)
 def test110_Brand_BestInAUTO_3rdBrakeLights(self):
     Mutil_Selection.Year(self, "2009")
     Mutil_Selection.Make(self, "GMC")
     Mutil_Selection.Brand(self, "BestInAUTO")
     FunctionCommon.Browser(self)
     Mutil_Selection.SubCategories_Link(self, "brand/83/series/555/year/2009/make/gmc")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self, "Your Shopping Cart")
     AddCart.CheckOut(self)
     PublicFunctions.my_wait_text_present(self, "Express Checkout")
     Payment.Step1_ProceedCheckOut(self, False)
     Payment.Step3_ShippingMethod(self)
     Payment.Step4_OrderConfirm(self)
 def test031_Cat_TonneauCovers_ToolBox(self):
     Mutil_Selection.Year(self, "2009")
     Mutil_Selection.Make(self, "GMC")
     Mutil_Selection.Categories_QP(self, "Tonneau Covers")
     FunctionCommon.Browser(self)
     Mutil_Selection.SubCategories_Link(self, "category/4/subcategory/99/year/2009/make/gmc")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self, "Your Shopping Cart")
     AddCart.CheckOut(self)
     PublicFunctions.my_wait_text_present(self, "Express Checkout")
     Payment.Step1_ProceedCheckOut(self, False)
     Payment.Step3_ShippingMethod(self)
     Payment.Step4_OrderConfirm(self)
Exemple #26
0
 def test_case2(self):
     driver = self.driver
     time.sleep(30)
     # 步骤A
     timeA = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     for i in range(10):
         driver.find_elements_by_id('com.baidu.searchbox:id/tab_indi_title')[1].click()
         time.sleep(3)
     time.sleep(10)
     #步骤B
     timeB = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     timeData = timeA + ',' + timeB
     #将A 和 B 的时间用逗号连起来后,存储到相应的case文件中
     timeFile = os.getcwd() + baseConfig['case2']['directory'] + '/' + baseConfig['case2']['time_file']
     PublicFunctions.writeDateToFile(timeData, timeFile)
 def test111_Brand_BestInAUTO_ValveStemExtensions(self):
     Mutil_Selection.Year(self, "2010")
     Mutil_Selection.Make(self, "FORD")
     Mutil_Selection.Brand(self, "BestInAUTO")
     time.sleep(3)
     FunctionCommon.Browser(self)
     Mutil_Selection.SubCategories_Link(self, "brand/83/series/531/year/2010/make/ford")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self, "Your Shopping Cart")
     AddCart.CheckOut(self)
     PublicFunctions.my_wait_text_present(self, "Express Checkout")
     Payment.Step1_ProceedCheckOut(self, False)
     Payment.Step3_ShippingMethod(self)
     Payment.Step4_OrderConfirm(self)
 def test120_Brand_TruckChamp_StainlessSteelBullBars(self):
     Mutil_Selection.Year(self, "2009")
     Mutil_Selection.Make(self, "GMC")
     Mutil_Selection.Brand(self, "Truck Champ")
     time.sleep(3)
     FunctionCommon.Browser(self)
     Mutil_Selection.SubCategories_Link(self, "brand/7/series/42/year/2009/make/gmc")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self, "Your Shopping Cart")
     AddCart.CheckOut(self)
     PublicFunctions.my_wait_text_present(self, "Express Checkout")
     Payment.Step1_ProceedCheckOut(self, False)
     Payment.Step3_ShippingMethod(self)
     Payment.Step4_OrderConfirm(self)
 def test121_Brand_TruckChamp_TCDropSteps(self):
     Mutil_Selection.Year(self, "2008")
     Mutil_Selection.Make(self, "CHEVROLET")
     Mutil_Selection.Brand(self, "Truck Champ")
     time.sleep(3)
     FunctionCommon.Browser(self)
     Mutil_Selection.SubCategories_Link(self, "brand/7/series/535/year/2008/make/chevrolet")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self, "Your Shopping Cart")
     AddCart.CheckOut(self)
     PublicFunctions.my_wait_text_present(self, "Express Checkout")
     Payment.Step1_ProceedCheckOut(self, False)
     Payment.Step3_ShippingMethod(self)
     Payment.Step4_OrderConfirm(self)
 def test011_Cat_AitFilter_UniversalAirFitlerCleaner(self):
     Mutil_Selection.Year(self, "2009")
     Mutil_Selection.Make(self, "GMC")
     Mutil_Selection.Categories_QP(self, "Air Filter")
     ##        time.sleep(3)
     FunctionCommon.Browser(self)
     Mutil_Selection.SubCategories_Link(self, "category/15/subcategory/380/year/2009/make/gmc")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self, "Your Shopping Cart")
     AddCart.CheckOut(self)
     PublicFunctions.my_wait_text_present(self, "Express Checkout")
     Payment.Step1_ProceedCheckOut(self, False)
     Payment.Step3_ShippingMethod(self)
     Payment.Step4_OrderConfirm(self)
Exemple #31
0
def CheckOut(self):    
    PublicFunctions.my_wait_title(self,"Click here to proceed to checkout")
    time.sleep(5)
    sel = self.selenium
    sel.click("//img[contains(@src, 'images/blue/CheckoutButton.gif') and @alt='']")
    time.sleep(5)
    
    for i in range(0, 8):
        if sel.get_title().find("Express Checkout")<0 or sel.is_element_present("//input[@value='Continue shopping']"):break
        else :
            time.sleep(1)
            
    if sel.is_element_present("//input[@value='Continue shopping']"):
        sel.click("//input[@value='Checkout']")

    PublicFunctions.my_wait_text_present(self,"Express Checkout")
Exemple #32
0
def PostDataProcessing(filePath, username, password, method, object):
    fileHandler = xlrd.open_workbook(filePath)
    Sheet = fileHandler.sheet_by_index(0)
    object.RefreshStatusbar('开始准备上传数据...请稍后')
    #object.PostDataButton.setEnabled(False)
    #time.sleep(0.5)
    URL = AppConfig.METHOD[method]['URL']
    JSESSIONID = GetSessionID(username, GetMD5(password))
    if JSESSIONID:
        cookie = {"JSESSIONID": JSESSIONID[0]}

        FieldsList = Sheet.row_values(1)
        Row_Count = len(Sheet.col_values(7))
        Column_Count = len(FieldsList)
        # print(Column_Count)
        if CheckTempXlSX(GetMD5(''.join(FieldsList)), Row_Count):
            for i in range(2, Row_Count):
                postData = copy.deepcopy(ProductFields.AddData)
                for j in range(Column_Count - 1):
                    if j <= 38:
                        postData["productBasicModel"][Sheet.cell(
                            1, j).value] = str(Sheet.cell(i, j).value).replace(
                                '.0', '')
                    else:
                        #print(i,j,Sheet.cell(i, j).value)
                        postData["skuModels"] = FormatSkuModelsData(
                            Sheet.cell(i, j).value,
                            postData["productBasicModel"]["bonusPointsRate"],
                            postData["productBasicModel"]['salePrice'])

                        postData["id"] = postData["productBasicModel"][
                            "productId"]
                postData["productBasicModel"]['mediaModels'] = []
                postData["productBasicModel"]['models'] = []
                # print(postData)
                Datas = json.dumps(postData, ensure_ascii=False).encode()

                object.RefreshStatusbar(
                    "上传%s数据中..." %
                    postData["productBasicModel"]['productName'])
                pf.Add_Thread(
                    lambda: StartOperating(
                        URL, Datas, cookie, postData["productBasicModel"][
                            'productName']), 'setDaemon')
            #object.PostDataButton.setEnabled(True)
            object.RefreshStatusbar('上传%s条商品信息数据完成...' % str(Row_Count - 2))
        else:
            object.RefreshStatusbar('导入数据或者模板有误!')
            object.PostDataButton.setEnabled(True)
    else:
        object.RefreshStatusbar('账号密码错误!')
        object.PostDataButton.setEnabled(True)
        return False
    object.PostDataButton.setEnabled(True)
    for x in locals().keys():
        del locals()[x]
    gc.collect()
Exemple #33
0
 def StartProcess(self, method):
     gv.set_value('width', 640)
     if method == 'imageadjust':
         pf.Add_Thread(
             lambda: WPicAdjust.MultiStart(
                 self.ImagePathlineEdit.text(),
                 self.ImageSavePathlineEdit.text(), self), 'setDaemon')
     elif method == 'datapost':
         pf.Add_Thread(
             lambda: WUploadData.PostDataProcessing(
                 self.ExcelPathlineEdit.text(), self.UserNamelineEdit.text(
                 ), self.PassWordlineEdit.text(), 'Add'
                 if self.AddradioButton.isChecked() else 'Update', self),
             'setDaemon')
     elif method == 'imagepost':
         pf.Add_Thread(
             lambda: WUploadData.PostImageProcessing(
                 self.ImagePostPathlineEdit.text(),
                 self.UserNamelineEdit.text(), self.PassWordlineEdit.text(
                 ), 'PicUpload' if self.SaveradioButton.isChecked() else
                 'PicUploadExamine', self), 'setDaemon')
 def test_case5(self):
     driver = self.driver
     time.sleep(30)
     # 步骤A
     timeA = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x, 0.1 * self.y,
                  1000)
     driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x, 0.1 * self.y,
                  1000)
     title1 = '样子也太可爱了吧!早期出席活动的郭碧婷,看起来好开心!'
     for i in range(10):
         print(i)
         for i in range(50):
             aa = self.driver.find_elements_by_id(
                 'com.baidu.searchbox:id/eq')[0].text
             if aa == title1:
                 self.driver.find_elements_by_id(
                     'com.baidu.searchbox:id/eq')[0].click()
                 time.sleep(3)
                 for i in range(8):
                     try:
                         driver.swipe(0.8 * self.x, 0.5 * self.y,
                                      0.2 * self.x, 0.5 * self.y, 1000)
                     except:
                         pass
                     time.sleep(1)
                 self.driver.keyevent(4)
                 time.sleep(3)
                 break
             else:
                 driver.swipe(0.5 * self.x, 0.9 * self.y, 0.5 * self.x,
                              0.8 * self.y, 1000)
     time.sleep(10)
     # 步骤B
     timeB = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     timeData = timeA + ',' + timeB
     # 将A 和 B 的时间用逗号连起来后,存储到相应的case文件中
     timeFile = os.getcwd() + baseConfig['case5'][
         'directory'] + '/' + baseConfig['case5']['time_file']
     PublicFunctions.writeDateToFile(timeData, timeFile)
def TwoSubCategories_select(self, alt1, alt2):
    PublicFunctions.my_wait_element(self,"//img[@alt=\'%s\']" % alt1)
    self.selenium.click("//img[@alt=\'%s\']" % alt1)
    PublicFunctions.my_wait_element(self,"//img[@alt=\'%s\']" % alt2)
    self.selenium.click("//img[@alt=\'%s\']" % alt2)
    PublicFunctions.my_wait_element(self,"//div[@id='FavoriteDivPar']/div[1]/a[1]")
    self.selenium.click("//div[@id='FavoriteDivPar']/div[1]/a[1]")
def TwoSeries_select(self,link1,link2):
    PublicFunctions.my_wait_element(self,link1)
    self.selenium.click(link1)
    PublicFunctions.my_wait_element(self,link2)
    self.selenium.click(link2)
    PublicFunctions.my_wait_element(self,"//div[@id='HomeNewProducts']/div[4]/div[1]/a[1]")
    self.selenium.click("//div[@id='HomeNewProducts']/div[4]/div[1]/a[1]")    
Exemple #37
0
def ResizeLock(picPath, width, Save_Path):
    saveFilePath = Save_Path + '/' + os.path.split(
        os.path.dirname(os.path.dirname(picPath)))[1] + '/' + os.path.split(
            os.path.dirname(picPath))[1]
    if os.path.exists(saveFilePath) == False:
        os.makedirs(saveFilePath)
    with im.open(picPath) as picHandle:
        W, H = picHandle.size
        new_img = picHandle.resize((width, int(H / W * width)), im.BILINEAR)
        pf.Add_Thread(
            lambda: new_img.save(saveFilePath + '/' + os.path.split(picPath)[1]
                                 ), 'setDaemon')
        print('正在处理:' + picPath)
Exemple #38
0
 def setUp(self):
     self.verificationErrors = []
     self.selenium = selenium("localhost", 4444, "*chrome", "http://dev.lofinc.net/")
     self.selenium.start()
     self.selenium.set_timeout("0")
     sel=self.selenium
     sel.open("/")
     for i in range(0, 30):
         if self.selenium.is_element_present("login_email") == True:
             self.selenium.type("login_email","*****@*****.**")
             self.selenium.type("login_pass","123456")
             self.selenium.click("LoginButton")
         else :
             time.sleep(1)
     PublicFunctions.my_wait_element(self,"side_selected_year")
     a1=self.selenium.get_text("side_selected_year")
     a2=self.selenium.get_text("side_selected_make")
     a3=self.selenium.get_text("side_selected_brand")
     a4=self.selenium.get_text("side_selected_category")
     if (a1 or a2 or a3 or a4) == "" :
         return True
     else:
         FunctionCommon.Clear(self,"all")
Exemple #39
0
def PostImageProcessing(filePath, username, password, method, object):
    URL = AppConfig.METHOD[method]['URL']
    #object.ImageAdjustButton.setEnabled(False)
    #time.sleep(0.1)
    JSESSIONID = GetSessionID(username, GetMD5(password))
    if JSESSIONID:
        cookie = {"JSESSIONID": JSESSIONID[0]}
        PicsInfo = GetPicsInfo(filePath)
        for picinfo in PicsInfo:
            postData = json.dumps(FormatImagePostData(picinfo),
                                  ensure_ascii=False).encode()
            object.RefreshStatusbar("上传'%s'商品信息..." % picinfo[0])
            pf.Add_Thread(
                lambda: StartOperating(URL, postData, cookie, picinfo[0]),
                'setDaemon')

    else:
        object.RefreshStatusbar('账号密码错误!')
        return False
 def test010_MoreProd(self):
     Mutil_Selection.Year(self,"2010")
     Mutil_Selection.Categories_QP(self,"Tonneau Covers")     
     FunctionCommon.Browser(self)
     Mutil_Selection.SubCategories_Link(self,"category/4/subcategory/6/year/2010")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     ## Go back homepage and clean all
     self.selenium.click("//div[@id='TopMenu']/ul/li[2]/a/span")
     PublicFunctions.my_wait_text_present(self, "Quick Search")
     FunctionCommon.Clear(self)
     ## Add another product
     Mutil_Selection.Year(self,"2010")
     Mutil_Selection.Brand(self,"Advantage")      
     FunctionCommon.Browser(self)
     Mutil_Selection.Series_options(self,"Advantage Sure-Fit")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
 def test012_MoreProd(self):
     Mutil_Selection.Year(self,"2007")
     Mutil_Selection.Make(self,"TOYOTA")
     Mutil_Selection.Categories_QP(self,"Bed Mats")     
     FunctionCommon.Browser(self)  
     Mutil_Selection.SubCategories_Link(self,"category/68/subcategory/675/year/2007/make/toyota")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     ## Go back homepage and clean all
     self.selenium.click("//div[@id='TopMenu']/ul/li[2]/a/span")
     time.sleep(8)
     PublicFunctions.my_wait_text_present(self, "Quick Search")
     FunctionCommon.Clear(self)
     ## Add another product
     Mutil_Selection.Year(self,"2007")
     Mutil_Selection.Make(self,"NISSAN")
     Mutil_Selection.Brand(self,"Edge")              
     FunctionCommon.Browser(self)
     Mutil_Selection.Series_options(self,"Edge Plug-In") 
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
 def test011_MoreProd(self):
     Mutil_Selection.Year(self,"2005")
     Mutil_Selection.Make(self,"CHEVROLET")
     Mutil_Selection.Brand(self,"AEM")              
     FunctionCommon.Browser(self)
     Mutil_Selection.Series_options(self,"AEM Analog Guage")        
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     ## Go back homepage and clean all
     self.selenium.click("//div[@id='TopMenu']/ul/li[2]/a/span")
     time.sleep(8)
     PublicFunctions.my_wait_text_present(self, "Quick Search")
     FunctionCommon.Clear(self)
     ## Add another product
     time.sleep(5)
     Mutil_Selection.Year(self,"2007")
     Mutil_Selection.Categories_QP(self,"Oil Filters")     
     FunctionCommon.Browser(self) 
     Mutil_Selection.SubCategories_Link(self,"category/19/subcategory/419/year/2007")
     Mutil_Selection.Products_ViewDetail(self)
     AddCart.AddCart(self)
     PublicFunctions.my_wait_text_present(self,"Your Shopping Cart")
     AddCart.CheckOut(self)
Exemple #43
0
def PSOClusteringAlgorithm(datapoints, dataname, run):
    """---------------------------------------------------------------------------------------
    :function:  PSO clustering algorithm
    :parameter: datapoints: data points
                dataname:   data set's name
                run:  indicates which time is it and use to set the seed for random
    :return:    lables: the labels of data points assigned by the algorithm
                k:      number of cluster detected
    ------------------------------------------------------------------------------------------"""
    band_dict = {"data/aggregation.txt": 1.5, "data/flame.txt": 1.3, "data/DS850.txt": 0.3, "data/R15.txt": 0.3,
                 "data/D31.txt": 0.5, "data/dim512.txt": 0.40, "data/iris.txt": 0.09, "data/wdbc.txt": 0.09,
                 "data/seeds.txt": 0.10, "data/segmentation_all.txt": 0.16, "data/ecoli.txt": 0.07,
                 "data/appendicitis.txt": 0.12}

    spread_dict = {"data/aggregation.txt": 1.8, "data/flame.txt": 2.2, "data/DS850.txt": 0.3, "data/R15.txt": 0.5,
                   "data/D31.txt": 1.0, "data/dim512.txt": 0.40, "data/iris.txt": 0.10, "data/wdbc.txt": 0.08,
                   "data/seeds.txt": 0.20, "data/segmentation_all.txt": 0.15, "data/ecoli.txt": 0.09,
                   "data/appendicitis.txt": 0.18}
    # use for drawing figures
    num_dict = {"data/aggregation.txt": 7, "data/flame.txt": 3, "data/DS850.txt": 5, "data/R15.txt": 15,
                "data/D31.txt": 31, "data/iris.txt": 0.10, "data/wdbc.txt": 0.08, "data/seeds.txt": 0.20,
                "data/segmentation_all.txt": 0.15, "data/ecoli.txt": 0.09}

    T = 100  # total time steps
    vmax = [0.0 for i in range(len(datapoints[0]))]
    axis_range = [[0.0, 0.0] for i in range(len(datapoints[0]))]

    c1 = 1.0  # acceleration constant for cognitive learning
    c2 = 0.5  # acceleration constant for social learning

    # obtain the range on each dimension and the maximum velocity on each dimension
    dp = np.array(datapoints)
    for i in range(len(dp[0])):
        tmp = dp[0:len(dp), i:i+1]
        max_val = tmp.max()
        min_val = tmp.min()
        if vmax[i] < (max_val - min_val) * 0.10:
            vmax[i] = (max_val - min_val) * 0.10
        axis_range[i][0] = min_val - 1
        axis_range[i][1] = max_val + 1

    np.random.seed(run)  # seed for random

    X = np.array(datapoints)  # record particles" position
    datapoints = X.tolist()
    n = len(X)                # data set scale
    d = len(X[0])             # dimension

    # calculate the density of particle using KDE
    bandwidth = band_dict[dataname]  # select bandwidth
    kde = KernelDensity(kernel="gaussian", bandwidth=bandwidth).fit(X.copy())
    f = [math.exp(a) for a in kde.score_samples(X)]  # densities of datapoints in KDE

    # train the RBF network
    t = np.array([[var] for var in f])
    net = newrb.designrb(X, t, 0, spread_dict[filename], round(0.1*n), n)
    print("Building RBF network is done!")

    for i in range(n):
        f[i] = net(X[i].reshape((1, d)))

    order = sorted(enumerate(f), key=lambda x: x[1], reverse=True)  # outliers' assignment order
    pbest = np.array(X)  # pbest
    pbest_density = copy.deepcopy(f)    # pbest's density
    # calculate leader for each particle
    neibrs_indices = calculate_neighborhood(pbest, n)  # neighbors for each data point
    lbest_index = [i for i in range(n)]  # the lbest's index
    lbest = np.array(X)  # lbest's current position
    k = 2  # number of leader that each particle almost can follow
    neibrs = []  # store the leader set for each particle
    for i in range(n):
        tmp = []
        cnt = 0
        for j in range(1, n):
            if f[i] < f[neibrs_indices[i][j]]:
                tmp.append(neibrs_indices[i][j])
                cnt += 1
            if cnt == k or j == n - 1:
                if not tmp:
                    tmp.append(neibrs_indices[i][0])
                neibrs.append(tmp)
                lbest_index[i] = tmp[0]  # select the first particle in its leader set as the initial leader
                lbest[i] = np.array(X[lbest_index[i]])  # obtain the position of lbest
                break
    # accquire the mean distance between particle and its leader, and the distance list of each pair
    avg_distance, distance_list = PublicFunctions.getAvgerageDistance(lbest_index, datapoints)
    bound = [0] * n     # use to indicate whether the particle is merged with its leader, '1' means merged, '0' means no

    velocity = np.array([np.array([0.0 for i in range(0, d)]) for j in range(0, n)])  # initialize the velocity to 0.0
    w = [1.0] * n   # initial inertial weight to 1.0

    for t in range(T):  # start iteration
        pbest_Mat = pbest - X
        lbest_Mat = lbest - X
        # update velocity and position
        for i in range(n):
            # if the particle is merged with its leader, it do not need to fly, just change its position to its leader
            if bound[i]:
                continue
            for j in range(d):
                r1 = np.random.random()
                r2 = np.random.random()
                # update velocity
                velocity[i][j] = w[i]*velocity[i][j] + c1 * r1 * (pbest_Mat[i][j]) + c2 * r2 * (lbest_Mat[i][j])
                # velocity clamped
                # v = vmax[j] - vmin[j]
                if velocity[i][j] > vmax[j]:
                    velocity[i][j] = vmax[j]
                elif velocity[i][j] < -vmax[j]:
                    velocity[i][j] = -vmax[j]
                X[i][j] = X[i][j] + velocity[i][j]  # calculate trial position
            # use RBFnn to estimate the density of the trail position
            new_density = net(X[i].reshape((1, d)))
            w[i] = new_density/pbest_density[i]
            # if the trial position is not bad than pbest, update the position to trail position
            f[i] = new_density
            if new_density >= pbest_density[i]:
                continue
            delta = ((pbest_density[i] - new_density)/pbest_density[i])*10   # calculate delta
            # according to the density difference between trail and pbest, adopt N~(0, 1/np.sqrt(2*pi)) to calculate
            # probability
            prob = stats.norm(0, 1/np.sqrt(2*np.pi)).pdf(delta)
            rand = np.random.random()   # generate a random number
            if rand > prob:     # if the random number is higher than the probability, the particle return to pbest
                velocity[i] = 0.0   # velocity reset to 0.0
                X[i] = pbest[i]     # position update to pbest
                f[i] = pbest_density[i]     # current density update to pbest's density
                ind = (neibrs[i].index(lbest_index[i]) + 1) % len(neibrs[i])    # select the next particle as leader
                lbest_index[i] = neibrs[i][ind]
        # end-for

        # update pbest in order
        for i in range(n):
            if bound[order[i][0]]:
                pbest[order[i][0]] = np.array(pbest[lbest_index[order[i][0]]])
            # update pbest
            elif f[order[i][0]] > pbest_density[order[i][0]]:
                pbest_density[order[i][0]] = f[order[i][0]]
                pbest[order[i][0]] = np.array(X[order[i][0]])

        # end-for
        # jude whether the particle should merged to its leader, if yes, update its pbest to its leader
        mark = [0] * n  # mark whether the particle should merge with its leader
        for i in range(n):
            if not bound[i] and PublicFunctions.getDistance(pbest[i], pbest[lbest_index[i]]) <= avg_distance:
                mark[i] = 1
        # end-for
        for i in range(n):
            if mark[order[i][0]] or bound[order[i][0]]:
                pbest[order[i][0]] = np.array(pbest[lbest_index[order[i][0]]])
                X[order[i][0]] = np.array(X[lbest_index[order[i][0]]])
                bound[order[i][0]] = 1
            # update the lbest's position
            lbest[order[i][0]] = np.array(X[lbest_index[order[i][0]]])
        # end-for

        if t == T - 1:
            labels, k = labeling(datapoints, bound, lbest_index, order)

            # Draw the final clustering result
            # PublicFunctions.drawClusteringResultGraph(pl, datapoints, labels, k, axis_range)
            # pl.show()
    # end-for
    return labels, k
Exemple #44
0
import sys
import PublicFunctions as pf
import WPicAdjust
import WUploadData
import os
import GlobalValues as gv
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QFileDialog

SavePathDefualt = pf.GetDesktopPath()


class Ui_WSCWindow(object):
    def setupUi(self, WSCWindow):
        WSCWindow.setObjectName("WSCWindow")
        WSCWindow.resize(397, 343)
        WSCWindow.setMinimumSize(QtCore.QSize(397, 321))
        WSCWindow.setMaximumSize(QtCore.QSize(397, 343))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(os.getcwd() + "/wsc.ico"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        WSCWindow.setWindowIcon(icon)
        WSCWindow.setIconSize(QtCore.QSize(36, 36))

        # 功能标题字体
        TitleFont = QtGui.QFont()
        TitleFont.setFamily("方正姚体")
        TitleFont.setPointSize(11)
        TitleFont.setBold(True)
        TitleFont.setWeight(50)
        # 按钮字体
Exemple #45
0
def SelectFilePath(target,StringValue):
    if target =='dir':
        StringValue.set(tkinter.filedialog.askdirectory(initialdir=pf.GetDesktopPath()))
    else:
        StringValue.set(tkinter.filedialog.askopenfilename(initialdir=pf.GetDesktopPath()))
Exemple #46
0
def LoadView():
    root = tkinter.Tk()
    root.title('微商城工具-v%s' % Version)
    ico = os.getcwd() + r'\wsc.ico'
    root.iconbitmap(ico)
    #root.attributes("-alpha", 0.1)
    screen_width = root.winfo_screenwidth() // 2 - 187
    screen_height = root.winfo_screenheight() // 2 - 260

    windows_params = Check_System_Info(
        root.winfo_screenwidth() // 2 - 187, root.winfo_screenheight() // 2 - 260)
    root.geometry(windows_params["geometry"])
    root.maxsize(windows_params["maxsize-x"], windows_params["maxsize-y"])
    root.minsize(windows_params["maxsize-x"], windows_params["maxsize-y"])
    textwidth = windows_params["textwidth"]
    buttonwidth = windows_params["buttonwidth"]
    height = windows_params["height"]
    # *********************************图像自动处理*****************************************
    # 功能区域-标题
    ImageAdjustForm = Frame(width=windows_params["maxsize-x"], height=windows_params["maxsize-y"]/3,bg='#87CEEB')
    ImageAdjustForm.grid(row=0, column=0,padx=0,pady=0)
    ToolTitle = Label(ImageAdjustForm, text='图片自动处理' ,font='微软雅黑 -15 bold',bg='#87CEEB').grid(
        column=2, row=1, columnspan=2, sticky=E + W)
    # 功能区域-图像处理-文件位置选择
    ImageAdjustLabel = Label(ImageAdjustForm, text='图片路径 :',bg='#87CEEB').grid(
        column=1, row=2, columnspan=1, sticky=W)
    ImageAdjustPathTextValue = StringVar()
    ImageAdjustPathText = Entry(ImageAdjustForm, font='微软雅黑 -11', bg='#87CEEB', width=textwidth, state='readonly', textvariable=ImageAdjustPathTextValue, justify=LEFT).grid(
        column=2, row=2, sticky=N + S + E + W, columnspan=2)
    ImageAdjustPathButton = Button(ImageAdjustForm, text="✚", width=9, bg='#F0FFFF',height=height, command=lambda:SelectFilePath('dir',ImageAdjustPathTextValue)).grid(column=4, row=2, sticky=W+E, rowspan=1)
    # 功能区域-图像处理-文件保存位置选择    
    ImageAdjustLabel = Label(ImageAdjustForm, text='保存路径 :',bg='#87CEEB').grid(
        column=1, row=3, columnspan=1, sticky=W)
    ImageSavePathTextValue = StringVar()
    ImageSavePathTextValue.set(pf.GetDesktopPath()+'/'+'微商城图片')
    ImageSavePathText = Entry(ImageAdjustForm, font='微软雅黑 -11',bg='#87CEEB', width=textwidth, state='readonly', textvariable=ImageSavePathTextValue, justify=LEFT).grid(
        column=2, row=3, sticky=N + S + E + W, columnspan=2)
    ImageSavePathButton = Button(ImageAdjustForm, text="✚", width=9, bg='#F0FFFF',height=height, command=lambda:SelectFilePath('dir',ImageSavePathTextValue)).grid(column=4, row=3, sticky=W+E, rowspan=1)    
    # 功能区域-图像处理-宽度
    ImageWidthLabel = Label(ImageAdjustForm, text='默认宽度 :',bg='#87CEEB').grid(
        column=1, row=4, columnspan=1, sticky=W)
    ImageWidthTextValue = StringVar()
    ImageWidthTextValue.set(640)
    ImageWidthText = Entry(ImageAdjustForm, font='微软雅黑 -18', width=4,bg='#87CEEB', textvariable=ImageWidthTextValue, justify=CENTER).grid(
        column=2, row=4, sticky=N + S + E + W, columnspan=1)    
    # 功能区域-图像处理-执行情况打印
    ImageAdjustProcessTextValue = StringVar()
    gv._global_label = ImageAdjustProcessTextValue
    ImageAdjustProcessTextValue.set('准备开始')
    ImageAdjustProcessLabel= Label(ImageAdjustForm, font='微软雅黑 -9',justify=LEFT, textvariable=ImageAdjustProcessTextValue).grid(column=1, row=5, sticky=N + S + E + W, columnspan=4)    

    # 功能区域-图像处理-执行
    ImageAdjustStartButton =Button(ImageAdjustForm, text="开始处理", font='微软雅黑 -15 bold',width=9, bg='#F0FFFF',height=height, command=lambda:pf.Add_Thread(lambda:WPicAdjust.MultiStart(ImageAdjustPathTextValue.get(),ImageSavePathTextValue.get()),'setDaemon')).grid(column=3, row=4, sticky=W+E, columnspan=4) 

    # *********************************商品信息上传*****************************************
    # 功能区域-信息上传-标题
    ProductInfoUploadForm = Frame(width=windows_params["maxsize-x"], height=windows_params["maxsize-y"]/3,bg='#98FB98')
    ProductInfoUploadForm.grid(row=1, column=0,padx=0,pady=3)

    # 窗口主循环
    root.mainloop()
Exemple #47
0
    def setUp(self):
        self.driver = PublicFunctions.appium_start()

        xy = self.driver.get_window_size()
        self.x = xy['width']
        self.y = xy['height']
Exemple #48
0
               "data/D31.txt": 31, "data/dim512.txt": 16, "data/iris.txt": 3, "data/wdbc.txt": 2, "data/seeds.txt": 3,
               "data/segmentation_all.txt": 4, "data/ecoli.txt": 8, "data/appendicitis.txt": 7}
    optics_radius = {"data/aggregation.txt": 1.40, "data/flame.txt": 1.3, "data/DS850.txt": 0.4, "data/R15.txt": 0.55,
                     "data/D31.txt": 0.95, "data/dim512.txt": 0.36, "data/iris.txt": 0.12, "data/wdbc.txt": 0.49,
                     "data/seeds.txt": 0.24, "data/segmentation_all.txt": 0.15, "data/ecoli.txt": 0.26,
                     "data/appendicitis.txt": 0.3}
    optics_num = {"data/aggregation.txt": 6, "data/flame.txt": 7, "data/DS850.txt": 8, "data/R15.txt": 11,
                  "data/D31.txt": 34, "data/dim512.txt": 22, "data/iris.txt": 4, "data/wdbc.txt": 50, "data/seeds.txt": 15,
                  "data/segmentation_all.txt": 1, "data/ecoli.txt": 40, "data/appendicitis.txt": 10}

    # 画图的图尺寸
    range_dict = {"data/aggregation.txt": [[2, 38], [0, 35]], "data/flame.txt": [[-2, 16], [12, 30]],
                  "data/R15.txt": [[2, 18], [2, 18]], "data/D31.txt": [[0, 35], [0, 35]],
                  "data/DS850.txt": [[-1, 5], [-0.5, 6.5]]}

    filename, data_set_type = PublicFunctions.select_file()
    datapoints, labels_true = PublicFunctions.readRawDataFromFile(filename)  # Read data from file
    if data_set_type == '2' or filename == "data/dim512.txt":
        min_max_scaler = preprocessing.MinMaxScaler()
        datapoints = min_max_scaler.fit_transform(datapoints)
    choice = input("""select algorithm:
        SCA2-------------1
        SCA--------------2
        K means----------3
        HAC--------------4
        DBSCAN-----------5
        OPTICS-----------6
        ....>>>""")
    times = 1 if choice not in ["1", "2", "3"] else 20
    result = []
    mean = []