Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import random
- from nxcg.plugin import NXCGPlugin
- crawl_default = "USD 1.12 | EUR/IDR 15927.71 | EUR/BGN 1.96 | EUR/ISK 133.60 | EUR/ILS 4.03 | EUR/GBP 0.86 | EUR/DKK 7.47 | EUR/CAD 1.50 | EUR/MX"
- class Plugin(NXCGPlugin):
- def on_init(self):
- self.cg.colors.update({
- "ticker-bkg" : "#ecececcc",
- "ticker-fg" : "#0f0f0fff",
- "crawl-bkg" : "#1a1a1acc",
- "crawl-fg" : "#c0c0c0ff",
- })
- def ticker_mask(self):
- self.cg.set_color("#000000")
- self.cg.rect(0, 0, 1920, 1080)
- self.cg.set_color("#ffffff")
- self.cg.rect(192, 990, 1390, 36)
- def ticker_bkg(self):
- self.cg.set_color("ticker-bkg")
- self.cg.rect(192, 990, 1390, 36)
- def ticker(self, **kwargs):
- text = kwargs.get("text", "Lorem ipsum you should providum textum attributum")
- text = text.upper()
- self.cg.text(
- text,
- font="TeX Gyre Heros Cn Bold 18",
- pos=(210, 990),
- color="ticker-fg"
- )
- def crawl_mask(self):
- self.cg.set_color("#000000")
- self.cg.rect(0, 0, 1920, 1080)
- self.cg.set_color("#ffffff")
- self.cg.rect(192, 954, 1390, 36)
- def crawl_bkg(self):
- self.cg.set_color("crawl-bkg")
- self.cg.rect(192, 954, 1390, 36)
- def crawl(self, **kwargs):
- text = kwargs.get("text", crawl_default)
- text = text.upper()
- w, h = self.cg.text(
- text,
- font="TeX Gyre Heros Cn Bold 18",
- render=False
- )
- self.cg.new(w, 1080)
- self.cg.text(
- text,
- font="TeX Gyre Heros Cn Bold 18",
- color="crawl-fg",
- pos=(0, 954)
- )
- def music_label(self, **kwargs):
- font_title = "Roboto Light 38"
- font_artist = "Roboto Light 30"
- title=kwargs.get("title", "")
- artist=kwargs.get("artist", "")
- title_w, h = self.cg.text(
- title,
- font=font_title,
- render=False
- )
- artist_w, h = self.cg.text(
- artist,
- font=font_artist,
- render=False
- )
- mwidth = max(title_w, artist_w) + self.cg.safe.l + 40
- points = [
- [192 , self.cg.safe.b - 95],
- [mwidth - 10, self.cg.safe.b - 100],
- [mwidth + 15, self.cg.safe.b - 245],
- [170, self.cg.safe.b - 260]
- ]
- self.cg.set_color("black glass 75")
- self.cg.polygon(*points)
- title_w, h = self.cg.text(
- title,
- font=font_title,
- color="gold",
- pos=(210, self.cg.safe.b - 230)
- )
- artist_w, h = self.cg.text(
- artist,
- font=font_artist,
- color="#b0c7e8",
- pos=(210, self.cg.safe.b - 165)
- )
- def rotator(self, source_path, **kwargs):
- source = open(os.path.join(self.cg.app_dir, source_path)).read()
- source = source.split("\n")
- source = [f.strip() for f in source if f.strip()]
- text = random.choice(source)
- w, h = self.cg.text(
- kwargs.get("header").upper(),
- font="Roboto Light 72",
- color="gold",
- pos=(190, 190),
- width=1000,
- render=False
- )
- self.cg.set_color("black glass 65")
- self.cg.rect(192, 170, w+40, h+40)
- self.cg.text_render(212, 190)
- w, h = self.cg.text(
- text,
- font="Roboto Light 58",
- color="#b0c7e8",
- width=1400,
- render=False
- )
- self.cg.set_color("black glass 65")
- self.cg.rect(192, 360, w+40, h+40)
- self.cg.text_render(212, 380)
- ~
- ~
Advertisement
Add Comment
Please, Sign In to add comment