def show_tip_on_first_run(first_run_tip_name,
                          title,
                          tips,
                          loginfo,
                          show_count=1):
    if not is_first_run(f"show_tip_{first_run_tip_name}"):
        logger.debug(f"{first_run_tip_name} 已经提示过,不再展示")
        return

    # 仅在window系统下检查
    if platform.system() != "Windows":
        return

    # 如果在github action环境下,则不弹窗
    if is_run_in_github_action():
        return

    # 若是首次运行,提示相关信息
    logger.info(loginfo)

    for i in range(show_count):
        _title = title
        if show_count != 1:
            _title = f"第{i + 1}/{show_count}次提示 {title}"
        message_box(tips, _title)
Beispiel #2
0
def check_in_black_list(uin):
    qq = uin2qq(uin)
    if qq in black_list:
        message = ("发现你的QQ在本工具的黑名单里,本工具禁止你使用,将在本窗口消失后退出运行。\n"
                   "黑名单相关信息如下:\n"
                   f"{black_list[qq]}")
        message_box(message, "禁止使用")
        exit(0)
Beispiel #3
0
def check_in_black_list(uin):
    qq = uin2qq(uin)
    if qq in black_list:
        message = ("发现你的QQ在本工具的黑名单里,本工具禁止你使用,将在本窗口消失后退出运行。\n"
                   "黑名单相关信息如下:\n"
                   f"{black_list[qq]}\n"
                   "\n"
                   "如果有未使用完的付费时长,请私聊支付宝账号,按实际剩余时长退款。")
        message_box(message, "禁止使用")
        exit(0)
Beispiel #4
0
def get_game_info(name):
    lazy_load()
    if name not in name_2_game_info_map:
        message_box(f"未找到游戏【{name}】相关的配置,可能是空格等不完全匹配,请在稍后打开的文件中查找对应游戏的实际名字",
                    "游戏名不正确")
        async_message_box(
            "请使用网页版vscode或者下载个本地版的vscode打开【utils/reference_data/djc_biz_list.json】文件来自行修改~",
            "提示",
            open_url=vscode_online_url)
        pause_and_exit(-1)

    return name_2_game_info_map[name]
Beispiel #5
0
    def show_notices(self):
        valid_notices = list(
            filter(lambda notice: notice.need_show(), self.notices))

        logger.info(f"发现 {len(valid_notices)} 个新公告")
        for idx, notice in enumerate(valid_notices):
            # 展示公告
            message_box(
                notice.message,
                f"公告({idx + 1}/{len(valid_notices)}) - {notice.title}",
                icon=win32con.MB_ICONINFORMATION,
                open_url=notice.open_url,
                follow_flag_file=False,
            )

        logger.info("所有需要展示的公告均已展示完毕")
Beispiel #6
0
 def do_job(self):
     
         
     dicoms_out_dir = self.export_property.output_dir+ '/' + self.export_property.export_style
     
     ensure_dir(dicoms_out_dir)
     
     if self.export_property.export_style == "EcliseTPS-CTImage":
         self.image_style = 'template'
 
     if self.image_style == 'template':
         self.slice_dataset = self.slice_template
         
      #   self.set_magical_phantom_info( self.slice_dataset) #get the wrong files
         
         
         self.set_magical_phantom_descript_info( self.slice_dataset)
         self.set_magical_phantom_uids( self.slice_dataset)
         
         #the up two functions get the right files
         
         
         
             
     elif self.image_style == 'minimum':
         self.slice_dataset = self.dicom_minimum
     
    
     if len(self.image_sets) == 1:
         
         self.image_3d = self.image_sets[0]
         self.gen_dicom_files(dicoms_out_dir,self.image_3d,self.dicom_image_set_info,self.slice_dataset)
     
         print "**********Dicom CT Exported Successfully*****************************/n"
         
         print self.image_style
         content = self.export_property.export_style + "  Exported Successfully"
         
         message_box(message= content,
                                title="Exported Successfully", severity='information')
     elif len(self.image_sets) > 1:
         #Do multiple image sets export
         print "in the multiple image sets export"
         pass
Beispiel #7
0
    def do_job(self):
        
        self.prepare_extracted_images()       
   
        out_dir = self.export_property.output_dir+ '/' + self.export_property.export_style
        
        ensure_dir(out_dir)
        
        if (len(self.extracted_density_sets) != len(self.extracted_index_sets) ):
            message_box(message= "The number of index is not equal to number of density!",
                                   title="Index not match Density"  , severity='error')
            return 
            
        
        #****************************************************
        #Write out Geant4 geometr files
        
        sets_number = len(self.extracted_density_sets)
        
                
        fn_prefix = self.export_property.file_name_prefix
        fn_sufix =  self.export_property.file_name_suffix
        
        import csv
        for n in range(0,sets_number):
            out_file_name = out_dir + '/'  + fn_prefix \
                            + str(n) + '.' +  fn_sufix 
                            
            #  write out the Data set
            
            index  = self.extracted_index_sets[n]
                
            density = self.extracted_density_sets[n]
            
            image_info = self.g4_image_set_info
            
            out_nvoxels = [image_info.nvoxels_x, image_info.nvoxels_y, image_info.nvoxels_z]
             
       
            out_bound_x = [image_info.bound_x_min, image_info.bound_x_max]
            out_bound_y = [image_info.bound_y_min, image_info.bound_y_max]
            out_bound_z = [image_info.bound_z_min, image_info.bound_z_max]
            
                    
            with open(out_file_name, 'w') as csvfile:
         
                self.write_g4geometry_header(csvfile)

                writer = csv.writer(csvfile,delimiter = ' ', lineterminator='\n')
                
                writer.writerow(out_nvoxels)
                writer.writerow(out_bound_x)  
                writer.writerow(out_bound_y) 
                writer.writerow(out_bound_z)
                
                import numpy as np        
                np_index = np.frombuffer(index.point_data.scalars.to_array(), dtype=np.int16)          
                
                np_density = np.frombuffer(density.point_data.scalars.to_array(), dtype=np.float32) 
                
                np_index.tofile(csvfile, sep=" ", format="%i") 
                writer.writerow([])
                
                np_density.tofile(csvfile, sep=" ", format="%f") 
              
            csvfile.close()


             
            print "**********Geant4 Geometry Exported Successfully*****************************/n"
            
            
            content = self.export_property.export_style + "  Exported Successfully"
            
            message_box(message= content,
                                   title="Exported Successfully", severity='information')
Beispiel #8
0
def cui():
    # 读取配置信息
    load_config("config.toml", "config.toml.local")
    cfg = config()

    from main_def import check_proxy

    check_proxy(cfg)

    # note: 以下内容修改为自己的配置
    # 大号的账号序号(从1开始)
    dahao_indexes = [1]
    # 三个小号的序号
    xiaohao_indexes = [6, 7, 8]
    # 三个小号的QQ号
    xiaohao_qq_list = ["3036079506", "1470237902", "1276170371"]

    # re: 流程:
    #   1. send_to_xiaohao设为True,大号发送宝箱链接给三个小号
    #   2. 电脑上,大号QQ里点开三个小号对话的宝箱链接,替换Scode到scode_list里面
    #   3. send_to_xiaohao设为False,让小号开启各个宝箱

    # --------------- 每次只需要按流程修改下面几行 ---------------------

    send_to_xiaohao = True
    # send_to_xiaohao = False

    scode_list = [
        "MDJKQ0t5dDJYazlMVmMrc2ZXV0tVT0xsZitZMi9YOXZUUFgxMW1PcnQ2Yz0=",
        "UFgxa1lQZ3RBZERCMTU0N3dSWmcwZUxsZitZMi9YOXZUUFgxMW1PcnQ2Yz0=",
        "cXNpZTIrY2dRYk1GL2E4UjlGQzBkdUxsZitZMi9YOXZUUFgxMW1PcnQ2Yz0=",
    ]

    if len(xiaohao_qq_list) != scode_list:
        message_box("配置的小号数目与scode数目不一致,请确保两者一致", "出错了")
        sys.exit()

    # --------------- 每次只需要按流程修改上面几行 ---------------------

    # 登录相应账号
    if send_to_xiaohao:
        indexes = dahao_indexes
    else:
        indexes = xiaohao_indexes

    for idx in indexes:  # 从1开始,第i个
        account_config = cfg.account_configs[idx - 1]

        show_head_line(f"预先获取第{idx}个账户[{account_config.name}]的skey",
                       color("fg_bold_yellow"))

        if not account_config.is_enabled():
            logger.warning("账号被禁用,将跳过")
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.fetch_pskey()
        djcHelper.check_skey_expired()

    # 执行对应逻辑
    for order_index, account_index in enumerate(indexes):  # 从1开始,第i个
        account_config = cfg.account_configs[account_index - 1]

        show_head_line(f"开始处理第{account_index}个账户[{account_config.name}]",
                       color("fg_bold_yellow"))

        if not account_config.is_enabled():
            logger.warning("账号被禁用,将跳过")
            continue

        djcHelper = DjcHelper(account_config, cfg.common)

        djcHelper.fetch_pskey()
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list()

        if send_to_xiaohao:
            logger.info(
                color("bold_green") + f"发送宝箱链接给小号QQ: {xiaohao_qq_list}")

            djcHelper.majieluo_send_to_xiaohao(xiaohao_qq_list)

            msg = (
                "1. 请在电脑登录大号QQ,依次点击各个小号的对话框里刚刚发送的宝箱链接,在浏览器中复制其链接中sCode的值到scode_list对应位置\n"
                "2. 请修改send_to_xiaohao为False后再次运行")
            message_box(msg, "后续流程")
        else:
            scode = scode_list[order_index]
            logger.info(
                f"第{order_index + 1}个小号领取刚刚运行后填写的Scode列表中第{order_index + 1}个scode - {scode}"
            )

            res = djcHelper.majieluo_open_box(scode)
            if res.sOutValue1 == 0:
                logger.info(color("bold_green") + "领取成功")
            else:
                code_to_message = {
                    "1": "无效的赠送链接",
                    "2": "不能打开自己的礼盒~",
                    "3": "该礼盒已经被开启",
                    "4": "好友今天的礼盒已经被全部打开了哦~",
                    "5": "一天只可以打开3次礼盒哦~",
                    "6": "该礼盒已经被开启",
                    "7": "该礼盒已经被开启",
                }
                message = "系统繁忙,请稍后再试~"
                if res.sOutValue1 in code_to_message:
                    message = code_to_message[res.sOutValue1]

                logger.error(message)

            time.sleep(1)

    # 第二次执行完毕提示修改send_to_xiaohao
    if not send_to_xiaohao:
        message_box("已领取完毕,请修改send_to_xiaohao为True,方便明天继续从头用", "提示")