コード例 #1
0
ファイル: wave.py プロジェクト: smallbomb/kirafan-bot
 def adb_mode_switch(self):
     self.objects = Load_Objects("wave")
     self.icon = Icon(f'{self.name}.png', uData.setting['confidence'])
     if not self.auto:
         for c in self.__chara_list:
             self.characters[c].adb_mode_switch()
         for orb in self.orbs:
             orb.adb_mode_switch()
コード例 #2
0
def wait(icon: Icon, area=None, timeout=20):  # timeout counts in seconds
    start_time = time.time()
    while (time.time() - start_time) < timeout:
        if area is None:
            if icon.visible():
                break
        elif icon.visible_in(area):
            break
    else:
        raise TimeoutError('Can not find icon: {}'.format(icon))
コード例 #3
0
 def __init__(self, parent, title, content, icon, timeout):
     SugarNotify.__init__(self, timeout)
     self._parent = parent
     self.props.title = title
     self.props.msg = content
     if icon is not None:
         icon = Icon(icon_name=icon)
         icon.show()
         self.props.icon = icon
         icon.props.pixel_size = style.SMALL_ICON_SIZE * 2
     self.connect('response', self.remove_myself)
コード例 #4
0
    def __init__(self, ability, ability_id, coord, color='white'):

        self.ability = ability
        self.ready = True

        image = TileSet.get_icon_tiles().get_tile_image(ability_id)
        w = image.rect.w
        h = image.rect.h

        Icon.__init__(self, coord, w, h, image, color)

        self.tick = 0
コード例 #5
0
    def __init__(self, panel, coord, color):

        image = TileSet.get_icon_tiles().get_tile_image(''.join(
            (color, '_crystal')))
        w = image.rect.w
        h = image.rect.h
        self.color_name = color
        Icon.__init__(self, coord, w, h, image, color=color)

        self.panel = panel

        self.tick = 0
        self.count = 0

        self.state = 0
コード例 #6
0
ファイル: hud.py プロジェクト: gshopov/Pyruto
    def __init__(self, player, character):
        """Initialize the health, mana bar, frame and icon.

        player -- should an integer value: 1 or 2
        character -- defines which icon will be shown

        If player == 2: all the components apart from the icon are flipped.

        """
        SpriteGroup.__init__(self)

        self.health = Bar("health", 1000, player)
        self.health.position = (self.measures[player]['position'] +
                                self.measures[player]['health'])

        self.mana = Bar("mana", 1000, player)
        self.mana.position = (self.measures[player]['position'] +
                              self.measures[player]['mana'])

        self.icon = Icon(character)
        self.icon.rotozoom(self.measures[player]['rotation'], 0.7)
        self.icon.position = (self.measures[player]['position'] +
                              self.measures[player]['icon'])

        self.frame = Sprite()
        self.frame.image, self.frame.rect = load_image("assets/hud/frame.png")
        self.frame.rect.topleft = self.measures[player]['position']

        self.add(self.health, self.mana, self.frame, self.icon)

        if player == 2:
            for sprite in self.sprites():
                if sprite != self.icon:
                    sprite.flip(1, 0)
コード例 #7
0
ファイル: pulsingicon.py プロジェクト: godiard/many-tests
    def __init__(self, **kwargs):
        self._pulser = Pulser(self)
        self._base_color = None
        self._pulse_color = None
        self._paused = False
        self._pulsing = False

        self._start_size = 100
        self._end_size = 100
        self._zoom_steps = 1
        self._icon_size = max(self._start_size, self._end_size)

        Icon.__init__(self, **kwargs)

        self._palette = None
        self.connect('destroy', self.__destroy_cb)
コード例 #8
0
ファイル: view.py プロジェクト: stolenzc/cost_app
    def window_init(self):
        self.root.title('消费明细记录')
        with open('tmp.ico', 'wb') as tmp:
            tmp.write(base64.b64decode(Icon().img))
        self.root.iconbitmap('tmp.ico')
        os.remove('tmp.ico')
        # self.root.iconbitmap(r'.\\icon.ico')
        self.root.geometry('800x530+260+60')
        self.root.resizable(0, 0)

        self.cost_time = tkinter.Variable()
        self.cost_num = tkinter.Variable()
        self.balance_num = tkinter.Variable()
        self.remarks = tkinter.Variable()
        self.first_time = tkinter.Variable()
        self.last_time = tkinter.Variable()
        self.select_infor = tkinter.Variable()

        self.frame_window = tkinter.Frame(self.root)
        self.window_insert()
        self.window_select()
        self.meun_bar()
        self.frame_window.pack(fill=tkinter.BOTH, anchor='center')
        self.myfunction = my_function(self.top_information, self.cost_time,
                                      self.cost_num, self.bala_entry,
                                      self.remarks, self.first_time,
                                      self.last_time, self.select_infor,
                                      self.tree)
        # print(self.cost_time)
        # print(self.cost_num)
        # print(self.remarks)
        self.myfunction.init(db)
コード例 #9
0
def version_check():
    try:
        hdk_id=9
        wb = load_workbook("\\\\tpfs05\\DATA\\RD2\\30_Personal Data\\Steven.Jian\\HDK_VER.xlsx")
        ws = wb.active  # Must make it active for the rest of operations
        row_count = ws.max_row
        latest_hdk =ws.cell(row_count, 2).value
        hdk_idnew=int(ws.cell(row_count,1).value)
        wb.close()
        if hdk_idnew != hdk_id:
            #print(hdk_idnew)
            #print(hdk_id)
            root = Tk()
            with open('tmp.ico', 'wb') as tmp:
                tmp.write(base64.b64decode(Icon().img))
            root.iconbitmap('tmp.ico')
            os.remove('tmp.ico')
            root.withdraw()
            tkinter.messagebox.showinfo("Info","New HDK available! \n Please download it and use the latest bom_tool")
            try:
                dirname = filedialog.asksaveasfilename(filetypes=[("HDK","*.zip")],title="Save the new HDK as...",initialfile=latest_hdk)
                shutil.copy('\\\\tpfs05\\DATA\\RD2\\30_Personal Data\\Steven.Jian\\'+latest_hdk,str(dirname))
                print("HDK download success")
            except OSError:

                root = Tk()
                with open('tmp.ico', 'wb') as tmp:
                    tmp.write(base64.b64decode(Icon().img))
                root.iconbitmap('tmp.ico')
                os.remove('tmp.ico')
                root.withdraw()
                tkinter.messagebox.showinfo("Info", "Download Canceled")
            #win32api.ShellExecute(0, 'open', '\\\\tpfs05\\DATA\\RD2\\30_Personal Data\\Steven.Jian\\'+latest_hdk, '', '', 1)

    except OSError:

        root = Tk()
        with open('tmp.ico', 'wb') as tmp:
            tmp.write(base64.b64decode(Icon().img))
        root.iconbitmap('tmp.ico')
        os.remove('tmp.ico')
        root.withdraw()
        tkinter.messagebox.showinfo("Offline Mode","Please login to azwave.com for HDK version check")
コード例 #10
0
def project_sync(ws,Path,row_count,username_formating):

    dest_path1="\\\\tpfs05\\DATA\\RD2\\02_Design Document"
    dest_path2 ="\\\\tpfs05\\DATA\\RD2\\04_FAE Document"

    i = 2
    while i<=row_count:
        project_rd = ws.cell(i, 12).value
        project_rd_formating = str.upper(project_rd).replace(".", "").replace(" ", "")

        if (project_rd_formating) != (username_formating):
            root = Tk()
            with open('tmp.ico', 'wb') as tmp:
                tmp.write(base64.b64decode(Icon().img))
            root.iconbitmap('tmp.ico')
            os.remove('tmp.ico')
            root.withdraw()
            tkinter.messagebox.showinfo("ID Verification Error","Only '" + ws.cell(i,1).value + "' project owners are allowed for this operation")
        elif (project_rd_formating) == (username_formating):
         try:    ############## For 02_Design Document
                 distutils.dir_util.copy_tree(Path + "\\" + ws.cell(i, 1).value + "\\Schematic",dest_path1+"\\" + ws.cell(i, 1).value + "\\Schematic",update=1)
                 distutils.dir_util.copy_tree(Path + "\\" + ws.cell(i, 1).value + "\\Layout", dest_path1+ "\\" + ws.cell(i, 1).value + "\\Layout", update=1)
                 distutils.dir_util.copy_tree(Path +  "\\" + ws.cell(i, 1).value + "\\Test Report", dest_path1+ "\\" + ws.cell(i, 1).value + "\\Test Report", update=1)
                 distutils.dir_util.copy_tree(Path + "\\" + ws.cell(i, 1).value +  "\\For Customers"+"\\Design Package",dest_path1 + "\\" + ws.cell(i, 1).value + "\\Design Package", update=1)
                 distutils.dir_util.copy_tree(Path + "\\" + ws.cell(i, 1).value +  "\\Software"+"\\nvram",dest_path1 + "\\" + ws.cell(i, 1).value + "\\nvram", update=1)
                 ############## For 04_FAE Document
                 distutils.dir_util.copy_tree(Path +  "\\" + ws.cell(i, 1).value + "\\Test Report", dest_path2+ "\\" + ws.cell(i, 1).value + "\\Test Report", update=1)
                 distutils.dir_util.copy_tree(Path + "\\" + ws.cell(i, 1).value +  "\\For Customers"+"\\Design Package",dest_path2 + "\\" + ws.cell(i, 1).value + "\\Design Package", update=1)
                 distutils.dir_util.copy_tree(Path + "\\" + ws.cell(i, 1).value +  "\\Software"+"\\nvram",dest_path2 + "\\" + ws.cell(i, 1).value + "\\nvram", update=1)
                 print("Project '" + ws.cell(i,1).value + "' Sync Success!")

         except distutils.errors.DistutilsFileError:
                root = Tk()
                with open('tmp.ico', 'wb') as tmp:
                   tmp.write(base64.b64decode(Icon().img))
                root.iconbitmap('tmp.ico')
                os.remove('tmp.ico')
                root.withdraw()
                tkinter.messagebox.showinfo("No Such Folder","Folder missing in project '" + ws.cell(i,1).value + "'")

        i = i + 1
コード例 #11
0
    def __init__(self, url, orig_url):
        self.orig_url = orig_url
        self.url_to_search = url
        self.found = False

        icons = self.find_icons_at_url()
        icon = self.get_largest_icon_from_list(icons)

        if self.found:
            icon = Icon(icon, orig_url)
            self.found = icon.valid
            self.icon = icon
コード例 #12
0
    def __init__(self, url, node=None, parent=None, dump=''):
        self.__parent = parent
        self.__services = {}
        self.__devices = {}
        self.__icons = {}

        icons = node.find('iconList')
        if icons is None:
            icons = []
        services = node.find('serviceList')
        if services is None:
            services = []
        devices = node.find('deviceList')
        if devices is None:
            devices = []

        self.__node = node

        for icon in icons:
            icon = Icon(self, url, icon)
            self.__icons[icon.__name__] = icon

        for service in services:
            scpdurl = service.find('SCPDURL').text.replace(url, '')
            control_url = service.find('controlURL').text.replace(url, '')
            service_id = service.find('serviceId').text
            service_type = service.find('serviceType').text

            service = Service(
                self,
                url,
                scpdurl,
                service_type,
                control_url,
                dump=dump
            )

            name = service_id.split(':')[-1]
            service.__name__ = name
            self.__services[name] = service

        for device in devices:
            device = EmbeddedDevice(
                url,
                node=device,
                parent=self,
                dump=dump
            )

            self.__devices[device.__name__] = device

        self.url = url
        self.__name__ = self.friendly_name.replace(' ', '_').replace('-', '')
コード例 #13
0
 def __init__(self, parent, title, content, mtype):
     SugarAlert.__init__(self)
     self._parent = parent
     if mtype == gtk.MESSAGE_INFO:
         icon = Icon(icon_name='emblem-notification')
         icon.show()
         self.props.icon = icon
         icon.props.pixel_size = style.SMALL_ICON_SIZE * 2
     self.props.title = title
     self.props.msg = content
     ok_icon = Icon(icon_name='dialog-ok')
     self.add_button(gtk.RESPONSE_OK, _('Ok'), ok_icon)
     ok_icon.show()
     self.connect('response', self.remove_myself)
コード例 #14
0
def load_coordinates(size):
    with open('coordinate.yml', 'r') as stream:
        coordinate = yaml.safe_load(stream)

    coordinate = coordinate[size]

    # areas
    coords.top_window = coordinate['top_window']
    coords.mid_window = coordinate['mid_window']
    coords.bot_window = coordinate['bot_window']
    coords.troop_info_area = coordinate['troop_info_area']
    coords.super_mine_coord_locations = coordinate[
        'super_mine_coord_locations']
    coords.tribute_countdown_box = coordinate['tribute_countdown_box']
    # icons
    coords.back = Icon(coordinate['back'][0], img_path(coordinate['back'][1]))
    coords.castle = Icon(coordinate['castle'][0],
                         img_path(coordinate['castle'][1]))
    coords.kingdom = Icon(coordinate['kingdom'][0],
                          img_path(coordinate['kingdom'][1]))
    coords.ally_help = Icon(coordinate['ally_help'][0],
                            img_path(coordinate['ally_help'][1]))
    coords.gather = Icon(coordinate['gather'][0],
                         img_path(coordinate['gather'][1]))
    coords.train = Icon(coordinate['train'][0],
                        img_path(coordinate['train'][1]))
    # coordinate
    coords.screen_center = coordinate['screen_center']
    coords.msg_confirm = coordinate['msg_confirm']
    coords.empty_space = coordinate['empty_space']
    coords.alliance = coordinate['alliance']
    coords.donation = coordinate['donation']
    coords.alliance_gift = coordinate['alliance_gift']
    coords.gift_collect = coordinate['gift_collect']
    coords.donation_res = coordinate['donation_res']
    coords.donation_dev = coordinate['donation_dev']
    coords.donation_war = coordinate['donation_war']
    coords.donation_item = coordinate['donation_item']
    coords.donation_1click = coordinate['donation_1click']
    coords.donation_confirm = coordinate['donation_confirm']
    coords.territory = coordinate['territory']
    coords.super_mine = coordinate['super_mine']
    coords.half_troop = coordinate['half_troop']
    coords.slot_preferred = coordinate['slot_preferred']
    coords.ordinary_slot = coordinate['ordinary_slot']
    coords.superior_slot = coordinate['superior_slot']
    coords.march = coordinate['march']
    coords.magnifier = coordinate['magnifier']
    coords.search = coordinate['search']
    coords.farm = coordinate['farm']
    coords.sawmill = coordinate['sawmill']
    coords.iron_mine = coordinate['iron_mine']
    coords.silver_mine = coordinate['silver_mine']
    coords.res_lvl_up = coordinate['res_lvl_up']
    coords.res_lvl_dn = coordinate['res_lvl_dn']
    # islands
    coords.resource_islands = coordinate['resource_islands']
    coords.tribute_islands = coordinate['tribute_islands']
    coords.wall_repair_islands = coordinate['wall_repair_islands']
コード例 #15
0
ファイル: views.py プロジェクト: fedorax/bundler-icon-server
def get_icon(font, colour, character, size=None):
    """Redirect to static icon path, creating it first if necessary.

    :param font: ID of the font, e.g. ``fontawesome``
    :param colour: CSS colour without preceding ``#``, e.g. ``000``
        or ``eeeeee``
    :param character: Name of the character, e.g. ``youtube``
    :param size: Size of the icon in pixels
    """

    # Normalise arguments to minimise number of cached images
    colour = colour.lower()
    font = font.lower()
    character = character.lower()

    # Set size to default if size is disabled in API
    if size is None or not config.API_ALLOW_SIZE:
        size = config.SIZE
    else:
        if size.lower().endswith('.png'):
            size = size[:-4]
        try:
            size = int(size)
        except ValueError as err:
            return error_text('invalid size : {}'.format(size), 400)

    if not css_colour(colour):
        return error_text('invalid colour: {}'.format(colour), 400)

    if len(colour) == 3:  # Expand to full 6 characters
        r, g, b = colour
        colour = '{r}{r}{g}{g}{b}{b}'.format(r=r, g=g, b=b)

    if font not in fonts.FONTS:
        return error_text('unknown font: {}'.format(font), 404)

    if character.lower().endswith('.png'):
        character = character[:-4]

    if character not in fonts.FONTS[font]['characters']:
        return error_text('unknown character: {}'.format(character), 404)

    try:
        icon = Icon(font, colour, character, size)
        return redirect(icon.url)
    except ValueError as err:
        if 'color' in err.message:
            return error_text('invalid colour: {}'.format(colour), 400)
        # Re-raise error
        raise err
コード例 #16
0
ファイル: wave.py プロジェクト: smallbomb/kirafan-bot
 def __init__(self, id_: int, total: int):
     _wave = uData.setting['wave']
     self.id = id_
     self.ch_id = 'right'
     self.__chara_list = ['left', 'middle', 'right']
     self.total = total
     self.__myTurn_count = 0
     self.auto = _wave[str(self.id)]['auto']
     self.name = f'wave_{self.id}-{self.total}'
     self.objects = Load_Objects("wave")
     self.icon = Icon(f'{self.name}.png', uData.setting['confidence'])
     if not self.auto:
         self.characters = {
             c: Character(c, self.id)
             for c in self.__chara_list
         }
         self.chars_sp_order = self.__sp_order_init(
         ) if 'sp_weight_enable' in _wave[str(self.id)] and _wave[str(
             self.id)]['sp_weight_enable'] else []  # noqa: E501
         self.orbs = self.__orb_init()
         self.__friend = uData.setting['friend_support'] if uData.setting[
             'friend_support'] and uData.setting['friend_support'][
                 'wave_N'] == self.id else None  # noqa: E501
     self.__auto_button_multi_check = 0
コード例 #17
0
ファイル: bot.py プロジェクト: smallbomb/kirafan-bot
 def __load_icons(self) -> Dict:
     images = [
         'kirara_face.png', 'kuromon.png', 'ok.png', 'hai.png',
         'tojiru.png', 'friend_icon.png', 'visit_room.png', 'cork_face.png',
         'crea_comm_done.png'
     ]
     if self.stamina['use']:
         images += ['stamina_title.png']
     if self.loop_count > 0:
         images += ['again.png']
     if self.crea_craft_stop:
         images += ['crea_craft_occur.png']
     if self.data['crash_detection'] and not self.data['adb']['use']:
         images += ['kirafan_app_icon.png', 'start_screen.png']
     icons = [Icon(image, self.data['confidence']) for image in images]
     return {icon.name: icon for icon in icons}
コード例 #18
0
    def __init__(self, root):

        self.plyNoLst = []
        self.download_path = os.path.join(os.path.expanduser('~'), 'Desktop', '电子保单-{}'.format(datetime.now().strftime('%Y%m%d'))).replace('\\', '/')
        root.title('电子保单下载')
        # 读取 icon.py 中的图标文件
        with open('tmp.ico', 'wb') as tmp:
            tmp.write(base64.b64decode(Icon().img))
        root.iconbitmap('tmp.ico')
        os.remove('tmp.ico')
        screenWidth = root.winfo_screenwidth()  # 获取显示区域的宽度
        screenHeight = root.winfo_screenheight()  # 获取显示区域的高度
        width, height = 381, 592
        left = int((screenWidth - width) / 2)
        top = int((screenHeight - height) / 2) - 50
        root.geometry('{width}x{height}+{left}+{top}'.format(width=width, height=height, left=left, top=top))
        root.resizable(0, 0)  # 设置窗口宽高固定
        self.input_plyNo(root)
        self.set_download_path(root)
        self.download_config(root)
        self.log_frame(root)
コード例 #19
0
ファイル: view.py プロジェクト: stolenzc/cost_app
 def fix_ip_window(self):
     fix_ip = tkinter.Toplevel()
     fix_ip.title('数据库IP修改')
     fix_ip.geometry('300x200+400+200')
     with open('tmp.ico', 'wb') as tmp:
         tmp.write(base64.b64decode(Icon().img))
     fix_ip.iconbitmap('tmp.ico')
     os.remove('tmp.ico')
     # fix_ip.iconbitmap(r'.\\icon.ico')
     fix_ip.resizable(0, 0)
     new_ip = tkinter.Variable()
     label1 = tkinter.Label(
         fix_ip,
         text='  ',
         height=2,
     )
     label1.pack()
     balance = ttk.Entry(
         fix_ip,
         font=('黑体', 15),
         width=20,
         textvariable=new_ip,
     )
     balance.pack()
     label2 = tkinter.Label(
         fix_ip,
         text='  ',
         height=2,
     )
     label2.pack()
     button = ttk.Button(
         fix_ip,
         text='确认修改',
         command=lambda: self.my_function.fix_ip(new_ip.get()),
         # font=('黑体', 15),
         # justify='center',
     )
     button.pack()
     fix_ip.mainloop()
コード例 #20
0
ファイル: pydpage_tool.py プロジェクト: 2209832868/pydpage
	def __init__(self):

		self.dirpath = ''		# 文件夹路径
		self.savepath = '' 		# 转换后的文件保存路径

		self.showinfo = False 	# 是否打开信息显示窗口
		
		# 获得当前文件绝对路径
		# 使用os.getcwd() 创建快捷方式时 位置会发生变动
		# self.curworkpath = os.getcwd()
		self.curworkpath = os.path.dirname(os.path.abspath(sys.argv[0]))

		self.win = Tk()
		self.win.title('pyd打包助手')
		self.win.resizable(False, False)

		with open('tmp.ico','wb') as tmp:
			tmp.write(base64.b64decode(Icon().img))
		self.win.iconbitmap('tmp.ico')
		os.remove('tmp.ico')

		self.win.attributes('-topmost', True)

		# 偏移坐标值
		self.xpos = self.win.winfo_x()	# 软件距离窗口X坐标
		self.ypos = self.win.winfo_y()	# 软件距离窗口Y坐标
		self.winwidth = self.win.winfo_reqwidth()	# 当前软件宽
		self.winheight = self.win.winfo_reqheight()	# 当前软件高
		# 绑定窗口移动事件 每次移动更新偏移坐标值
		self.win.bind('<Configure>', self._movewindow)
		
		# 页面初始化
		self.create_widget()

		# 创建信息显示面板
		self.create_infoplan()
コード例 #21
0
ファイル: wave.py プロジェクト: smallbomb/kirafan-bot
class Wave:
    def __init__(self, id_: int, total: int):
        _wave = uData.setting['wave']
        self.id = id_
        self.ch_id = 'right'
        self.__chara_list = ['left', 'middle', 'right']
        self.total = total
        self.__myTurn_count = 0
        self.auto = _wave[str(self.id)]['auto']
        self.name = f'wave_{self.id}-{self.total}'
        self.objects = Load_Objects("wave")
        self.icon = Icon(f'{self.name}.png', uData.setting['confidence'])
        if not self.auto:
            self.characters = {
                c: Character(c, self.id)
                for c in self.__chara_list
            }
            self.chars_sp_order = self.__sp_order_init(
            ) if 'sp_weight_enable' in _wave[str(self.id)] and _wave[str(
                self.id)]['sp_weight_enable'] else []  # noqa: E501
            self.orbs = self.__orb_init()
            self.__friend = uData.setting['friend_support'] if uData.setting[
                'friend_support'] and uData.setting['friend_support'][
                    'wave_N'] == self.id else None  # noqa: E501
        self.__auto_button_multi_check = 0

    def __str__(self):
        string = str(self.__class__) + ":\n"
        for item in self.__dict__:
            if item in ['objects', 'characters', 'icon', 'orbs']:
                if type(self.__dict__[item]) == dict:
                    for value in self.__dict__[item].values():
                        string += item + str(value) + "\n\n"
                elif type(self.__dict__[item]) == list:
                    for value in self.__dict__[item]:
                        string += item + str(value) + "\n\n"
            else:
                string += "{item} = {self.__dict__[item]}\n\n"
        return string

    def __sp_order_init(self) -> List[CharaID]:
        order = list()
        for c in self.__chara_list:
            order = riffle(order, [c] * int(self.characters[c].sp_use) *
                           self.characters[c].sp_weight)
        return order

    def __orb_init(self) -> List:
        if not uData.setting['orb']:
            return []

        lst = list()
        for i in range(1, 4):
            if str(i) in uData.setting['orb'] and self.id == uData.setting[
                    'orb'][str(i)]['wave_N']:
                lst.append(Orb(str(i)))
        return lst

    def current(self, adb_update_cache: bool) -> bool:
        return True if self.icon.found(adb_update_cache) else False

    def character_found(self) -> bool:
        for c in gen_circle_list(
                self.__chara_list.index(self.ch_id) + 1,
                len(self.__chara_list), self.__chara_list):
            if self.characters[c].ready(False):
                self.ch_id = c  # update current character ID
                return True
        return False

    def orb_action(self) -> bool:
        for orb in self.orbs:
            if orb.turn == self.__myTurn_count and orb.action():
                return True
        return False

    def friend_action(self) -> bool:
        if self.__friend is None or (
                'use' in self.__friend and not self.__friend['use']
        ) or self.__myTurn_count != self.__friend['myturn']:  # noqa: E501
            return False
        elif not self.objects['friend'].found(False):
            return False

        self.objects['friend'].click(3, 0.3)
        if self.objects['friend_ok'].found(
                True
        ):  # found it because player's character maybe less than 3.
            target = self.__friend['replace'].lower().replace(
                'character', 'friend_replace')
            self.objects[target].click(3)
        self.objects['friend_ok'].click(2, 2.3)  # for sleep 2*2.3 = 4.6s
        return True

    def charater_action(self):
        sk = self.characters[self.ch_id].action(self.chars_sp_order)
        if sk == 'sp' and self.chars_sp_order:
            self.chars_sp_order.append(self.chars_sp_order.pop(0))
        self.__myTurn_count += 1

    def auto_click(self):
        if self.objects['auto_button'].found(False):  # auto_button is blue
            self.__auto_button_multi_check = 0
            sleep(1)
        else:
            self.__auto_button_multi_check += 1

        if self.__auto_button_multi_check > 2:
            self.objects['auto_button'].click()
            self.__auto_button_multi_check = 0

    def is_myTurn(self) -> bool:
        if self.auto:
            return self.objects['setting_button'].found(False)
        return (self.objects['setting_button'].found(False)
                and self.characters[self.ch_id].objects['atk'].found(False))

    def icon_coord(self, adb_update_cache: bool) -> Optional[Coord]:
        return self.icon.get_center(adb_update_cache)

    def reset(self):
        _wave = uData.setting['wave']
        self.ch_id = 'right'
        self.__myTurn_count = 0
        if not self.auto:
            self.chars_sp_order = self.__sp_order_init(
            ) if 'sp_weight_enable' in _wave[str(self.id)] and _wave[str(
                self.id)]['sp_weight_enable'] else []  # noqa: E501
            self.orbs = self.__orb_init()
        self.__auto_button_multi_check = 0

    def adb_mode_switch(self):
        self.objects = Load_Objects("wave")
        self.icon = Icon(f'{self.name}.png', uData.setting['confidence'])
        if not self.auto:
            for c in self.__chara_list:
                self.characters[c].adb_mode_switch()
            for orb in self.orbs:
                orb.adb_mode_switch()
コード例 #22
0
ファイル: test_icon.py プロジェクト: gshopov/Pyruto
    def test_maintain_topleft_position(self):
        icon = Icon("orochimaru")
        position = icon.position

        icon.p1_flag = True
        icon.p2_falg = True
        icon.update()
        self.assertEqual(icon.rect.topleft, position)

        icon.p1_flag = True
        icon.p2_flag = False
        icon.update()
        self.assertEqual(icon.rect.topleft, position)

        icon.p1_flag = False
        icon.p2_flag = True
        icon.update()
        self.assertEqual(icon.rect.topleft, position)

        icon.p1_flag = False
        icon.p2_flag = False
        icon.update()
        self.assertEqual(icon.rect.topleft, position)
コード例 #23
0
    def __init__(self, player, coord):

        Icon.__init__(self, coord, 16, 24, None)
        self.player = player
コード例 #24
0
ファイル: test_icon.py プロジェクト: gshopov/Pyruto
    def test_highlighting(self):
        icon = Icon("orochimaru")

        icon.p1_flag = True
        icon.p2_flag = True
        icon.update()
        scaled_image = pygame.transform.smoothscale(icon.images[3][0],
                                                    (int(icon.images[3][1].w *
                                                         ICON_HIGHLIGHT),
                                                    int(icon.images[3][1].h *
                                                        ICON_HIGHLIGHT)))
        pixel_array_base = pygame.PixelArray(scaled_image)
        pixel_array_scale = pygame.PixelArray(icon.image)
        width, height = icon.image.get_size()
        for column in range(width):
            for row in range(height):
                self.assertAlmostEqual(pixel_array_base[column, row],
                                       pixel_array_scale[column, row])

        icon.p1_flag = True
        icon.p2_flag = False
        icon.update()
        scaled_image = pygame.transform.smoothscale(icon.images[1][0],
                                                    (int(icon.images[1][1].w *
                                                         ICON_HIGHLIGHT),
                                                    int(icon.images[1][1].h *
                                                        ICON_HIGHLIGHT)))
        pixel_array_base = pygame.PixelArray(scaled_image)
        pixel_array_scale = pygame.PixelArray(icon.image)
        width, height = icon.image.get_size()
        for column in range(width):
            for row in range(height):
                self.assertAlmostEqual(pixel_array_base[column, row],
                                       pixel_array_scale[column, row])

        icon.p1_flag = False
        icon.p2_flag = True
        icon.update()
        scaled_image = pygame.transform.smoothscale(icon.images[2][0],
                                                    (int(icon.images[2][1].w *
                                                         ICON_HIGHLIGHT),
                                                    int(icon.images[2][1].h *
                                                        ICON_HIGHLIGHT)))
        pixel_array_base = pygame.PixelArray(scaled_image)
        pixel_array_scale = pygame.PixelArray(icon.image)
        width, height = icon.image.get_size()
        for column in range(width):
            for row in range(height):
                self.assertAlmostEqual(pixel_array_base[column, row],
                                       pixel_array_scale[column, row])

        icon.p1_flag = False
        icon.p2_flag = False
        icon.update()
        pixel_array_base = pygame.PixelArray(icon.images[0][0])
        pixel_array_scale = pygame.PixelArray(icon.image)
        width, height = icon.image.get_size()
        for column in range(width):
            for row in range(height):
                self.assertAlmostEqual(pixel_array_base[column, row],
                                       pixel_array_scale[column, row])
コード例 #25
0
ファイル: mucopy_v2.1.py プロジェクト: qusseei/EasyCopy
    def __init__(self):
        self.mu_params, self.mu_cfg = None, None

        self.app = Tk()
        #隐藏窗口,防止窗口左上角闪烁一下
        self.app.withdraw()
        self.app.update()
        #label 文本:textvariable
        global TX
        TX = StringVar()
        #标题
        self.app.title('mucopy')
        #图标直接加载
        # self.app.iconbitmap('icon.ico')
        #图标转为base64
        with open('tmp.ico', 'wb') as tmp:
            tmp.write(base64.b64decode(Icon().img))
        self.app.iconbitmap('tmp.ico')
        os.remove('tmp.ico')
        #透明度,不透明
        self.app.attributes('-alpha', 1)
        #去除标题栏
        self.app.overrideredirect(True)
        # self.app.overrideredirect(False)
        #初始化坐标
        self.app.geometry('+200+100')
        #界面不可缩放
        self.app.resizable(0, 0)
        #置顶
        self.app.attributes('-topmost', True)
        #label self.label
        self.label = Label(self.app,
                           textvariable=TX,
                           fg='blue',
                           bg='white',
                           relief='flat',
                           wraplength=360,
                           justify='left',
                           anchor='w',
                           height=4,
                           width=48,
                           borderwidth=0,
                           font=('simsun', 12, 'bold'))
        self.label.grid(row=1, column=0, sticky=N + S + E + W)
        #text self.text
        self.text = Text(self.app,
                         fg='red',
                         bg='white',
                         relief='flat',
                         highlightthickness=0,
                         height=24,
                         width=49,
                         borderwidth=0,
                         font=('simsun', 12, 'bold'))
        self.text.grid(row=2, column=0, sticky=N + S + E + W)
        #透光设置,自动识别posix、nt
        if os.name == 'posix':
            self.app.wm_attributes('-transparent', True)
            self.app['bg'] = 'systemTransparent'
            self.label['bg'] = 'systemTransparent'
            self.text['bg'] = 'systemTransparent'
        else:
            self.app.wm_attributes('-transparentcolor', 'white')
            self.app['bg'] = 'white'
        #还原窗口
        self.app.deiconify()
        #执行check,返回布尔值,if True,执行主函数,完成后关闭程序
        if self.check():
            self.start()
            self.close()
        self.app.mainloop()
コード例 #26
0
ファイル: service.py プロジェクト: tmonck/samsungctl
    def __init__(
        self,
        parent,
        url,
        location,
        service,
        control_url,
        node=None,
        dump=''
    ):

        self.__parent = parent
        self.state_variables = {}
        self.__actions = {}
        self.__node = node
        self.url = url
        self.__icons = {}

        if node is not None:
            icons = node.find('iconList')

            if icons is None:
                icons = []

            for icon in icons:
                icon = Icon(self, url, icon)
                self.__icons[icon.__name__] = icon

        self.service = service

        location = location.replace(url, '')
        location = location.replace('//', '/')

        if not location.startswith('/'):
            location = '/' + location

        response = requests.get(url + location)
        if dump:
            path = location
            if path.startswith('/'):
                path = path[1:]
            if '/' in path:
                path, file_name = path.rsplit('/', 1)
                path = os.path.join(dump, path)
            else:
                file_name = path
                path = dump

            if not os.path.exists(path):
                os.makedirs(path)

            if not file_name.endswith('.xml'):
                file_name += '.xml'

            if isinstance(response.content, bytes):
                content = response.content.decode('utf-8')
            else:
                content = response.content

            with open(os.path.join(path, file_name), 'w') as f:
                f.write(content)

        try:
            root = etree.fromstring(response.content)
        except:
            import traceback

            print(repr(response.content))

            traceback.print_exc()
            return

        root = strip_xmlns(root)
        actions = root.find('actionList')
        if actions is None:
            actions = []

        state_variables = root.find('serviceStateTable')
        if state_variables is None:
            state_variables = []

        for state_variable in state_variables:
            state_variable = StateVariable(state_variable)
            self.state_variables[state_variable.name] = state_variable

        for action in actions:
            action = Action(
                self,
                action,
                self.state_variables,
                service,
                url + control_url
            )

            self.__actions[action.__name__] = action
コード例 #27
0
	def icon_browse(self):
		icon = Icon.browse(self.master)
		self.icon_entry.delete(0,'end')
		self.icon_entry.insert(0,icon)
コード例 #28
0
            self.Line3,
            text="文件输出路径",
            command=lambda: browse_output_button(self.FileOutputVar))
        self.buttonfileOutput.pack(side=LEFT,
                                   fill=X,
                                   expand=YES,
                                   anchor=W,
                                   padx=1,
                                   pady=1)

        self.buttonfileMerge = Button(
            self.Line4,
            text="合并",
            command=lambda: file_merge(self.File1Var.get(), self.File2Var.get(
            ), self.FileOutputVar.get()))
        self.buttonfileMerge.pack(side=LEFT,
                                  fill=X,
                                  expand=YES,
                                  anchor=W,
                                  padx=1,
                                  pady=1)


if __name__ == '__main__':
    mainwindow = window()
    with open('tmp.ico', 'wb') as tmp:
        tmp.write(base64.b64decode(Icon().img))
        tmp.close()
    mainwindow.iconbitmap('tmp.ico')
    os.remove('tmp.ico')
    mainwindow.mainloop()
コード例 #29
0
ファイル: app.py プロジェクト: all-in-one-of/lsapipeline
    def __init__(self, app):
        """
		main UI for STATIC ENV handling

		I always build my UI in __init__ so suck it up..

		"""
        QtGui.QWidget.__init__(self)
        self.app = app
        context = self.app.context
        self.fileBoxes = []
        ## Instance the api for talking directly to shotgun.
        base_url = "http://bubblebathbay.shotgunstudio.com"
        script_name = 'audioUploader'
        api_key = 'bbfc5a7f42364edd915656d7a48d436dc864ae7b48caeb69423a912b930bc76a'
        self.sgsrv = Shotgun(base_url=base_url,
                             script_name=script_name,
                             api_key=api_key,
                             ensure_ascii=True,
                             connect=True)

        self.shotNum = self._getShotNum()[0]
        self.currentENV = self._getShotNum()[1]

        debug(self.app,
              method='MainUI',
              message='self.shotNum: %s' % self.shotNum,
              verbose=False)
        debug(self.app,
              method='MainUI',
              message='self.currentENV: %s' % self.currentENV,
              verbose=False)
        self.lightAlembicFolder = 'I:/lsapipeline/episodes/ep000/%s/Light/publish/alembic_anim' % self.shotNum

        ## Now build the UI
        self.mainLayout = QtGui.QHBoxLayout(self)
        self.leftSideLayout = QtGui.QVBoxLayout(self)
        debug(self.app,
              method='MainUI',
              message='self.mainLayout built...',
              verbose=False)

        ##########################
        ### ENV SELECTION PULLDOWN
        self.envLayout = QtGui.QVBoxLayout(self)
        self.envPulldown = QtGui.QComboBox()

        getENVS = self.sgsrv.find(
            'Asset',
            filters=[["code", "contains", 'ENV_'],
                     ["code", "not_contains", '_ENV_'],
                     ["code", "not_contains", 'WORLDMAP'],
                     ["code", "not_contains", 'TSETbuild']],
            fields=['code'])
        debug(self.app,
              method='MainUI',
              message='getENVS: %s' % getENVS,
              verbose=False)

        if self.shotNum:
            for each in getENVS:
                if each['code'] == self.currentENV:
                    self.envPulldown.addItem(each['code'])
                    self.lightAlembicFolder = 'I:/lsapipeline/episodes/ep000/%s/Light/publish/alembic_anim' % self.shotNum

            self.envPulldown.setCurrentIndex(
                self.envPulldown.findText(self.currentENV))
            debug(self.app,
                  method='MainUI',
                  message='self.envPulldown setCurrentIndex...',
                  verbose=False)
        else:
            for each in getENVS:
                if 'ANIM' in each['code']:
                    self.envPulldown.addItem(each['code'])

        self.fetchAssetListButton = QtGui.QPushButton(Icon('refresh.png'),
                                                      'Fetch Asset List')
        self.fetchAssetListButton.setStyleSheet(
            "QPushButton {text-align : left}")
        self.fetchAssetListButton.released.connect(self._fetchAssetList)
        debug(self.app,
              method='MainUI',
              message='self.fetchAssetListButton built...',
              verbose=False)

        self.importAssetButton = QtGui.QPushButton(Icon('alembic.png'),
                                                   'Import latest Pub ABC')
        self.importAssetButton.setStyleSheet("QPushButton {text-align : left}")
        self.importAssetButton.released.connect(self._fetchMDLAlembicPublish)
        debug(self.app,
              method='MainUI',
              message='self.importAssetButton built...',
              verbose=False)

        self.checkMDLButton = QtGui.QPushButton(Icon('refresh.png'),
                                                'Check For RIG Publishes')
        self.checkMDLButton.setStyleSheet("QPushButton {text-align : left}")
        self.checkMDLButton.released.connect(
            self._checkVersionsAgainstPublishes)
        debug(self.app,
              method='MainUI',
              message='self.checkMDLButton built...',
              verbose=False)

        self.checkSRFXMLButton = QtGui.QPushButton(Icon('refresh.png'),
                                                   'Check For SRF Publishes')
        self.checkSRFXMLButton.setStyleSheet("QPushButton {text-align : left}")
        self.checkSRFXMLButton.released.connect(
            self._checkSRFVersionsAgainstPublishes)

        self.lambert1Button = QtGui.QPushButton(Icon('refresh.png'),
                                                'Check lambert1 objects')
        self.lambert1Button.setStyleSheet("QPushButton {text-align : left}")
        self.lambert1Button.released.connect(self._lambert1Object)

        self.checkFileInPathButton = QtGui.QPushButton(
            Icon('refresh.png'), 'Check Invalid FileIn Path')
        self.checkFileInPathButton.setStyleSheet(
            "QPushButton {text-align : left}")
        self.checkFileInPathButton.released.connect(self.checkFileInPath)

        self.checkNonManifoldButton = QtGui.QPushButton(
            Icon('refresh.png'), 'Check Non-Manifold Geometry')
        self.checkNonManifoldButton.setStyleSheet(
            "QPushButton {text-align : left}")
        self.checkNonManifoldButton.released.connect(
            self.cleanupNonManifoldGeometry)

        if context.step['name'] == 'Anm':
            self.creaseXMLButton = QtGui.QPushButton('Create crease XML')
            self.creaseXMLButton.released.connect(self._writeCreaseToXML)
            self.creaseXMLButton.setEnabled(True)

        if context.step['name'] == 'Light':
            self.fetchCreaseXMLButton = QtGui.QPushButton(
                'Fetch latest published crease XML')
            self.fetchCreaseXMLButton.released.connect(
                partial(self._getCreaseFromXML,
                        rootPrefix='ENV_DOCKS_STATICANIM_ABC_ANIM_CACHES_hrc'))
            self.fetchCreaseXMLButton.setEnabled(True)

        self.republishALL = QtGui.QPushButton('Publish ABC from ANM')
        self.republishALL.released.connect(self._republishAllAlembicsForENV)
        self.republishALL.setEnabled(True)

        ## Add stuff to the env layout
        self.envLayout.addWidget(self.envPulldown)
        self.envLayout.addWidget(self.fetchAssetListButton)
        self.envLayout.addWidget(self.importAssetButton)
        self.envLayout.addWidget(self.checkMDLButton)
        self.envLayout.addWidget(self.checkSRFXMLButton)
        self.envLayout.addWidget(self.lambert1Button)
        self.envLayout.addWidget(self.checkFileInPathButton)
        self.envLayout.addWidget(self.checkNonManifoldButton)
        self.envLayout.addWidget(self.republishALL)
        if context.step['name'] == 'Anm':
            self.envLayout.addWidget(self.creaseXMLButton)
        if context.step['name'] == 'Light':
            self.envLayout.addWidget(self.fetchCreaseXMLButton)

        ######################
        ### ENV RELATED ASSETS
        self.assetLayout = QtGui.QVBoxLayout(self)

        ### Now do the check boxes for files....
        self.scrollLayout = QtGui.QScrollArea(self)
        self.scrollLayout.setMinimumHeight(300)

        self.envAssetsGroupBox = QtGui.QGroupBox(self.scrollLayout)
        self.envAssetsGroupBox.setFlat(True)

        self.scrollLayout.setWidget(self.envAssetsGroupBox)
        self.scrollLayout.setWidgetResizable(True)

        self.envAssetsLayout = QtGui.QGridLayout(self.envAssetsGroupBox)

        self.assetLayout.addWidget(self.scrollLayout)

        self.mainLayout.addLayout(self.leftSideLayout)
        ## Add stuff to leftSideLayout
        self.leftSideLayout.addLayout(self.envLayout)
        self.leftSideLayout.addStretch(1)

        ## Add anything else to the HBox
        self.mainLayout.addLayout(self.assetLayout)
        self.resize(1000, 500)
        debug(self.app,
              method='MainUI',
              message='ui built successfully fetching assets now...',
              verbose=False)
        debug(self.app,
              method='MainUI',
              message='self.envPulldown.currentText(): %s' %
              self.envPulldown.currentText(),
              verbose=False)

        self._fetchAssetList()
        self.envPulldown.currentIndexChanged.connect(
            partial(self._getShotNumFromMenuName))
        self.envPulldown.currentIndexChanged.connect(
            partial(self._fetchAssetList))
コード例 #30
0
ファイル: app.py プロジェクト: all-in-one-of/lsapipeline
    def __init__(self, app):
        """
        main UI for DuplicateShotAssets
        """
        QtGui.QWidget.__init__(self)
        self.app = app
        self.charMaxChars = 0
        self.propMaxChars = 0
        ## To get the step
        context = self.app.context
        debug(self.app,
              method='MainUI',
              message='Context Step: %s' % context.step['name'],
              verbose=False)

        self.chars = []
        self.props = []

        ## Now build the UI
        self.mainLayout = QtGui.QHBoxLayout(self)
        debug(self.app,
              method='MainUI',
              message='self.mainLayout built...',
              verbose=False)

        ###############
        ## CHARS LAYOUT
        self.charParent = QtGui.QGroupBox(self)
        self.charParent.setTitle('CHARS:')
        #self.charParent.setMinimumWidth(600)
        self.charParentLayout = QtGui.QVBoxLayout(self.charParent)

        self.charScrollLayout = QtGui.QScrollArea(self)
        debug(self.app,
              method='MainUI',
              message='self.charScrollLayout built...',
              verbose=False)

        self.charGroupBox = QtGui.QGroupBox(self.charScrollLayout)
        self.charGroupBox.setFlat(True)

        self.charScrollLayout.setWidget(self.charGroupBox)
        self.charScrollLayout.setWidgetResizable(True)
        debug(self.app,
              method='MainUI',
              message='self.charGroupBox built...',
              verbose=False)

        self.charLayout = QtGui.QVBoxLayout(self.charGroupBox)
        debug(self.app,
              method='MainUI',
              message='self.charLayout built...',
              verbose=False)

        ###############
        ## PROPS LAYOUT
        self.propParent = QtGui.QGroupBox(self)
        self.propParent.setTitle('PROPS:')
        #self.propParent.setMinimumWidth(600)
        self.propParentLayout = QtGui.QVBoxLayout(self.propParent)

        self.propScrollLayout = QtGui.QScrollArea(self)
        debug(self.app,
              method='MainUI',
              message='self.propScrollLayout built...',
              verbose=False)

        self.propsGroupBox = QtGui.QGroupBox(self.propScrollLayout)
        self.propsGroupBox.setFlat(True)

        self.propScrollLayout.setWidget(self.propsGroupBox)
        self.propScrollLayout.setWidgetResizable(True)
        debug(self.app,
              method='MainUI',
              message='self.propsGroupBox built...',
              verbose=False)

        self.propsLayout = QtGui.QVBoxLayout(self.propsGroupBox)
        debug(self.app,
              method='MainUI',
              message='self.propsLayout built...',
              verbose=False)

        ####################
        ## The Button layout
        self.buttonLayout = QtGui.QVBoxLayout(self)
        ## The buttons
        ## The duplicate button
        self.duplicateButton = QtGui.QPushButton(Icon('plus.png'),
                                                 'Duplicate Assets', self)
        self.duplicateButton.clicked.connect(self._duplicateAssets)

        ## Add buttons to layout
        self.buttonLayout.addWidget(self.duplicateButton)
        self.buttonLayout.addStretch(1)

        self.charParentLayout.addWidget(self.charScrollLayout)
        self.propParentLayout.addWidget(self.propScrollLayout)
        ## Now do the final layout bits
        self.mainLayout.addWidget(self.charParent)
        self.mainLayout.addWidget(self.propParent)
        self.mainLayout.addLayout(self.buttonLayout)

        debug(self.app,
              method='MainUI',
              message='self.mainLayout addWidgets success...',
              verbose=False)

        self._popChars()
        debug(self.app,
              method='MainUI',
              message='self._popChars()...',
              verbose=False)
        self._popProps()
        debug(self.app,
              method='MainUI',
              message='self._popProps()...',
              verbose=False)

        if not self.props:
            self.propScrollLayout.hide()
        if not self.chars:
            self.charScrollLayout.hide()

        self.charGroupBox.resize(self.charGroupBox.sizeHint())
        self.propsGroupBox.resize(self.propsGroupBox.sizeHint())

        debug(self.app,
              method='MainUI',
              message='self.charMaxChars: %s' % self.charMaxChars,
              verbose=False)
        self.charParent.setMinimumWidth(self.charMaxChars + 500)
        self.propParent.setMinimumWidth(self.propMaxChars + 500)
        self.resize(self.sizeHint())
コード例 #31
0
ファイル: Ico_repair.py プロジェクト: mwp0930/BookStudy
def ico_repair(root):
    with open('tmp.ico', 'wb') as tmp:
        tmp.write(base64.b64decode(Icon().img))
        root.iconbitmap('tmp.ico')
        return 'tmp.ico'
コード例 #32
0
	def __init__(self, app):
		"""
		main UI for STATIC ENV handling

		I always build my UI in __init__ so suck it up..

		"""
		QtGui.QWidget.__init__(self)
		self.app = app
		self.fileBoxes  = []
		## Instance the api for talking directly to shotgun.
		base_url    = "http://bubblebathbay.shotgunstudio.com"
		script_name = 'audioUploader'
		api_key     = 'bbfc5a7f42364edd915656d7a48d436dc864ae7b48caeb69423a912b930bc76a'
		self.sgsrv  = Shotgun(base_url = base_url , script_name = script_name, api_key = api_key, ensure_ascii=True, connect=True)

		self.shotNum    = self._getShotNum()[0]
		self.currentENV = self._getShotNum()[1]
		debug(self.app, method = 'MainUI', message = 'self.shotNum: %s' % self.shotNum, verbose = False)
		debug(self.app, method = 'MainUI', message = 'self.currentENV: %s' % self.currentENV, verbose = False)
		self.lightAlembicFolder = 'I:/lsapipeline/episodes/ep000/%s/Light/publish/alembic_static' % self.shotNum

		## Now build the UI
		self.mainLayout     = QtGui.QHBoxLayout(self)
		self.leftSideLayout = QtGui.QVBoxLayout(self)
		debug(self.app, method = 'MainUI', message = 'self.mainLayout built...', verbose = False)

		##########################
		### ENV SELECTION PULLDOWN
		self.envLayout      = QtGui.QVBoxLayout(self)
		self.envPulldown    = QtGui.QComboBox()

		getENVS             = self.sgsrv.find('Asset',  filters = [["code", "contains", 'ENV_'], ["code", "not_contains", '_ENV_'], ["code", "not_contains", 'WORLDMAP'], ["code", "not_contains", 'TSETbuild']], fields=['code'])
		debug(self.app, method = 'MainUI', message = 'getENVS: %s' % getENVS, verbose = False)

		if self.shotNum:
			for each in getENVS:
				if each['code'] == self.currentENV:
					self.envPulldown.addItem(each['code'])
					self.lightAlembicFolder = 'I:/lsapipeline/episodes/ep000/%s/Light/publish/alembic_static' % self.shotNum
			self.envPulldown.setCurrentIndex(self.envPulldown.findText(self.currentENV))
			debug(self.app, method = 'MainUI', message = 'self.envPulldown setCurrentIndex...', verbose = False)
		else:
			for each in getENVS:
				if 'STATIC' in each['code']:
					self.envPulldown.addItem(each['code'])


		self.fetchAssetListButton = QtGui.QPushButton(Icon('refresh.png'), 'Fetch Asset List')
		self.fetchAssetListButton.setStyleSheet("QPushButton {text-align : left}")
		self.fetchAssetListButton.released.connect(self._fetchAssetList)
		debug(self.app, method = 'MainUI', message = 'self.fetchAssetListButton built...', verbose = False)

		self.importAssetButton = QtGui.QPushButton(Icon('alembic.png'), 'Import latest Pub ABC for Sel')
		self.importAssetButton.setStyleSheet("QPushButton {text-align : left}")
		self.importAssetButton.released.connect(self._fetchMDLAlembicPublish)
		debug(self.app, method = 'MainUI', message = 'self.importAssetButton built...', verbose = False)

		self.checkMDLButton = QtGui.QPushButton(Icon('refresh.png'), 'Check For MDL ABC Publishes')
		self.checkMDLButton.setStyleSheet("QPushButton {text-align : left}")
		self.checkMDLButton.released.connect(self._checkVersionsAgainstPublishes)
		debug(self.app, method = 'MainUI', message = 'self.checkMDLButton built...', verbose = False)

		self.redoSetsButton = QtGui.QPushButton(Icon('plus.png'), 'ReDo Set Assignments')
		self.redoSetsButton.setStyleSheet("QPushButton {text-align : left}")
		self.redoSetsButton.released.connect(self._createSets)
		debug(self.app, method = 'MainUI', message = 'self.redoSetsButton built...', verbose = False)

		self.checkSRFXMLButton = QtGui.QPushButton(Icon('refresh.png'), 'Check For SRF Publishes')
		self.checkSRFXMLButton.setStyleSheet("QPushButton {text-align : left}")
		self.checkSRFXMLButton.released.connect(self._checkSRFVersionsAgainstPublishes)

		self.cleanDuplicateCoresButton = QtGui.QPushButton(Icon('AssignedFileIt.png'), 'Clean Duplicate Cores')
		self.cleanDuplicateCoresButton.setStyleSheet("QPushButton {text-align : left}")
		self.cleanDuplicateCoresButton.released.connect(self._fixTheFuckingCores)
		self.cleanDuplicateCoresButton.setToolTip('This is performed on every import of an static env via the multiloader.\n Exposed just in case you need to run this manually.\n This will go through a scene with multiple static ENVs in it \nand try to make sure duplicate cores are renering correctly.')

		self.removeCoreGrpsButton = QtGui.QPushButton(Icon('skull.png'), 'Remove old Core Grps under geo_hrc')
		self.removeCoreGrpsButton.setStyleSheet("QPushButton {text-align : left}")
		self.removeCoreGrpsButton.released.connect(self._removeCoreGrps)
		self.removeCoreGrpsButton.setToolTip('You can use this to clean up any old core grps under the geo_hrc grps in a scene\nafer you have done a core archive rebuild from xml...')
		## THIS IS UP TO YOU TO ENABLE. IT SHOULDNT BE REQUIRED AS THE MDL PUBLISH SHOULD NOW BE EXPORTING THE CORRECT ATTRS FOR ALEMBIC
		self.republishALL = QtGui.QPushButton('Republish ALL MDL Alembics for %s' % self.currentENV)
		self.republishALL.released.connect(self._republishAllAlembicsForENV)
		self.republishALL.setEnabled(True)

		self.lambert1Button = QtGui.QPushButton(Icon('refresh.png'), 'Check lambert1 objects')
		self.lambert1Button.setStyleSheet("QPushButton {text-align : left}")
		self.lambert1Button.released.connect(self._lambert1Object)

		self.caNSclashCheckButton = QtGui.QPushButton(Icon('refresh.png'), 'Check Core Archive Namespace')
		self.caNSclashCheckButton.setStyleSheet("QPushButton {text-align : left}")
		self.caNSclashCheckButton.released.connect(self.coreArchiveNSclashCheck)

		self.checkFileInPathButton = QtGui.QPushButton(Icon('refresh.png'), 'Check Invalid FileIn Path')
		self.checkFileInPathButton.setStyleSheet("QPushButton {text-align : left}")
		self.checkFileInPathButton.released.connect(self.checkFileInPath)

		self.checkNonManifoldButton = QtGui.QPushButton(Icon('refresh.png'), 'Check Non-Manifold Geometry')
		self.checkNonManifoldButton.setStyleSheet("QPushButton {text-align : left}")
		self.checkNonManifoldButton.released.connect(self.cleanupNonManifoldGeometry)

		## Add stuff to the env layout
		self.envLayout.addWidget(self.envPulldown)
		self.envLayout.addWidget(self.fetchAssetListButton)
		self.envLayout.addWidget(self.importAssetButton)
		self.envLayout.addWidget(self.checkMDLButton)
		self.envLayout.addWidget(self.checkSRFXMLButton)
		self.envLayout.addWidget(self.redoSetsButton)
		self.envLayout.addWidget(self.cleanDuplicateCoresButton)
		self.envLayout.addWidget(self.removeCoreGrpsButton)
		self.envLayout.addWidget(self.republishALL)
		self.envLayout.addWidget(self.lambert1Button)
		self.envLayout.addWidget(self.caNSclashCheckButton)
		self.envLayout.addWidget(self.checkFileInPathButton)
		self.envLayout.addWidget(self.checkNonManifoldButton)

		######################
		### ENV RELATED ASSETS
		self.assetLayout  = QtGui.QVBoxLayout(self)

		### Now do the check boxes for files....
		self.scrollLayout = QtGui.QScrollArea(self)
		self.scrollLayout.setMinimumHeight(300)

		self.envAssetsGroupBox = QtGui.QGroupBox(self.scrollLayout)
		self.envAssetsGroupBox.setFlat(True)

		self.scrollLayout.setWidget(self.envAssetsGroupBox)
		self.scrollLayout.setWidgetResizable(True)

		self.envAssetsLayout = QtGui.QGridLayout(self.envAssetsGroupBox)

		self.assetLayout.addWidget(self.scrollLayout)

		self.mainLayout.addLayout(self.leftSideLayout)
		## Add stuff to leftSideLayout
		self.leftSideLayout.addLayout(self.envLayout)
		self.leftSideLayout.addStretch(1)

		## Add anything else to the HBox
		self.mainLayout.addLayout(self.assetLayout)
		self.resize(1000, 500)
		debug(self.app, method = 'MainUI', message = 'ui built successfully fetching assets now...', verbose = False)
		debug(self.app, method = 'MainUI', message = 'self.envPulldown.currentText(): %s' % self.envPulldown.currentText(), verbose = False)

		self._fetchAssetList()
		self.envPulldown.currentIndexChanged.connect(partial(self._getShotNumFromMenuName))
		self.envPulldown.currentIndexChanged.connect(partial(self._fetchAssetList))
コード例 #33
0
from base64 import b64encode
with open("icon.py","w") as f:
    f.write('class Icon(object):\n')
    f.write('\tdef __init__(self):\n')
    f.write("\t\tself.img='")
with open("icon.ico","rb") as i:
    b64str = b64encode(i.read())
    with open("icon.py","ab+") as f:
        f.write(b64str)
with open("icon.py","a") as f:
    f.write("'")
    
#Then in main.py
from base64 import b64decode
from os import remove
from icon import Icon
with open('tmp.ico', 'wb') as tmp:
    tmp.write(b64decode(Icon().img))
app.setWindowIcon(QIcon('tmp.ico'))
remove('tmp.ico')
コード例 #34
0
ファイル: hud.py プロジェクト: gshopov/Pyruto
class Hud(SpriteGroup):

    """Group of health, mana bar, frame and a character icon.

    measures -- holds the offsets of every Hud component for each player
    and the rotation that should be applied to the icon

    """

    measures = {1: {'health': Vec2D(62, 29), 'mana': Vec2D(70, 51),
                    'icon': Vec2D(-10, 10), 'position': Vec2D(5, 0),
                    'rotation': 10},
                2: {'health': Vec2D(22, 29), 'mana': Vec2D(35, 51),
                    'icon': Vec2D(139, 10),
                    'position': Vec2D(DEFAULT_SCREEN_SIZE[0] - 230, 0),
                    'rotation': -10}}

    def __init__(self, player, character):
        """Initialize the health, mana bar, frame and icon.

        player -- should an integer value: 1 or 2
        character -- defines which icon will be shown

        If player == 2: all the components apart from the icon are flipped.

        """
        SpriteGroup.__init__(self)

        self.health = Bar("health", 1000, player)
        self.health.position = (self.measures[player]['position'] +
                                self.measures[player]['health'])

        self.mana = Bar("mana", 1000, player)
        self.mana.position = (self.measures[player]['position'] +
                              self.measures[player]['mana'])

        self.icon = Icon(character)
        self.icon.rotozoom(self.measures[player]['rotation'], 0.7)
        self.icon.position = (self.measures[player]['position'] +
                              self.measures[player]['icon'])

        self.frame = Sprite()
        self.frame.image, self.frame.rect = load_image("assets/hud/frame.png")
        self.frame.rect.topleft = self.measures[player]['position']

        self.add(self.health, self.mana, self.frame, self.icon)

        if player == 2:
            for sprite in self.sprites():
                if sprite != self.icon:
                    sprite.flip(1, 0)

    def get_health(self):
        """Get the current value of the health bar.

        Hud.get_health(): return double

        """
        return self.health.value

    def get_mana(self):
        """Get the current value of the mana bar.

        Hud.get_mana(): return double

        """
        return self.mana.value
コード例 #35
0
 def attachIcon(self, settings):
     icon = Icon(settings)
     self.icons.append(icon)
     return icon