コード例 #1
0
ファイル: __init__.py プロジェクト: iguanaus/makemit-checkin
def print_user(user):
    printer = os.environ.get('PRINTER_NAME')
    raffle_label = join(dirname(__file__), 'labels', 'xfair-raffle.png')
    label = join(dirname(__file__), 'labels', 'xfair.png')
    image.create_image(user, raffle=True)
    os.system('lpr -P "{:s}" {:s}'.format(printer, raffle_label))
    image.create_image(user)
    os.system('lpr -P "{:s}" {:s}'.format(printer, label))
コード例 #2
0
ファイル: main.py プロジェクト: skiter847/AvatarClock
def main():
    previous_time = ''
    with TelegramClient(SESSION_FILE, API_ID, API_HASH) as client:
        while True:
            if not previous_time == current_time():
                previous_time = current_time()
                create_image(current_time())
                image = client.upload_file('clock.png')
                client(DeletePhotosRequest(client.get_profile_photos('me')))
                client(UploadProfilePhotoRequest(image))
コード例 #3
0
ファイル: bot.py プロジェクト: Sibbons/KanjiEveryday
def schedule_tweet():
    kanji = getKanji()

    tweet = f"""
Kanji of the day:   {kanji['character']}

Meanings: {kanji['meaning']}

Example: {kanji['japanese_example']}
Meaning: {kanji['english_example']}

#japaneselanguage  #nihongo #日本語勉強中 #kanji #learnjapanese #日本語
    """    
    
    create_image(kanji)
    api.update_with_media('Kanji.jpg', tweet)
    os.remove('Kanji.jpg')
コード例 #4
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--xtiles-per-chunk",
                        type=int,
                        required=False,
                        default=256,
                        help="Number of tiles per chunk in width direction")
    parser.add_argument("--ytiles-per-chunk",
                        type=int,
                        required=False,
                        default=256,
                        help="Number of tiles per chunk in height direction")
    parser.add_argument("--heightmap",
                        type=str,
                        required=True,
                        help="Heightmap filename")
    parser.add_argument("--scaling",
                        type=float,
                        required=False,
                        default=1.0,
                        help="Scaling for converting image pixels to tiles")
    parser.add_argument("-o",
                        type=str,
                        required=False,
                        default="./World",
                        help="Directory for root of the world")
    parser.add_argument("-i",
                        "--image",
                        type=str,
                        required=False,
                        help="Generate an image of the tilemap")

    args = parser.parse_args()

    scaling = args.scaling
    img = Image.open(args.heightmap).convert("L")
    if scaling != 1.0:
        img = img.resize(
            (int(img.size[0] * scaling), int(img.size[1] * scaling)),
            Image.BILINEAR)

    width_tiles, height_tiles = img.size
    xtiles_per_chunk = args.xtiles_per_chunk
    ytiles_per_chunk = args.ytiles_per_chunk
    output_directory = args.o

    create_from_heightmap(
        output_directory,
        np.array(img.getdata()).reshape(width_tiles, height_tiles),
        xtiles_per_chunk, ytiles_per_chunk)
    if args.image:
        image.write_image(
            args.image,
            image.create_image(
                WorldReader(output_directory).get_tiles(
                    0, 0, width_tiles, height_tiles)))
コード例 #5
0
def main():
    os.makedirs(HTTP_PATH, exist_ok=True)

    while True:
        date = datetime.now()
        date_str = date.strftime("%m-%d-%Y %P-%M-%S %p")
        print(f"Starting regression test at time {date_str}.")

        # Build
        print("Building latest Megalodon...")
        if not os.path.isdir(REPO_PATH):
            os.system(
                f"git clone https://github.com/megalodon-chess/megalodon.git {REPO_PATH}"
            )
        os.chdir(REPO_PATH)
        os.system("git pull")
        os.system("./build.sh")
        shutil.copy(os.path.join(REPO_PATH, "build", "Megalodon"), TEST_PATH)

        # Test
        print("Playing games...")
        games, result = play_games(BASE_PATH, TEST_PATH)
        elo = 400 * result / games
        if not os.path.isfile(RESULTS_PATH):
            with open(RESULTS_PATH, "w") as file:
                json.dump([], file)
        with open(RESULTS_PATH, "r") as file:
            results = json.load(file)
        results.append([elo, time.time(), [date.year, date.month, date.day]])
        with open(RESULTS_PATH, "w") as file:
            json.dump(results, file)

        # Generate graph
        print("Generating graph...")
        with open(RESULTS_PATH, "r") as file:
            results = json.load(file)
        if len(results) >= 2:
            create_image(results, IMAGE_PATH)

        print("--------------------------------------")
        sys.stdout.flush()
        time.sleep(INC)
コード例 #6
0
ファイル: proform.py プロジェクト: AndyDeany/yesform
def create_and_upload_table(picks, name):
    """Create and upload a PNG with the given name containing a table showing the given picks."""
    upload_file(SYSTEMS_WEBHOOK_URLS[name], create_image(picks, name))
コード例 #7
0
ファイル: voyager.py プロジェクト: Marie-Donnie/voyager
def create_image(name):
    print(img.create_image(name))
コード例 #8
0
ファイル: ui.py プロジェクト: JeremyAube/ezpdf
 def save_file(self):
     pdf_path = self.pdf_save_location + f'/{self.pdf_name_value.get()}'
     create_image(list(self.files), pdf_path)
     messagebox.showinfo('Success', 'PDF was created')
コード例 #9
0
ファイル: __init__.py プロジェクト: Detry322/hackmed-checkin
def print_user(name, major):
    printer = app.config['PRINTER_NAME']
    label = join(dirname(__file__), 'labels', 'xfair.png')
    image.create_image(name, major)
    os.system('lpr -P "{:s}" {:s}'.format(printer, label))
コード例 #10
0
def main(infile, outfile, width, height):

    stocks = stock_info_from(infile)
    im = image.create_image(width, height)
    draw(stocks, im)
    image.save_image(im, outfile)