Advertisement
JachyHm

Klient Superstroje

Apr 19th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.61 KB | None | 0 0
  1. import socket
  2. from threading import Thread
  3. from gi.repository import Gtk, GObject
  4. from msvcrt import getch
  5. import time
  6. import datetime
  7. dict = {"leden": '<big><big>ledna</big></big>', 'únor': "<big><big>února</big></big>", 'březen': '<big><big>března</big></big>', "duben": "<big><big>dubna</big></big>", "květen": "<big><big>května</big></big>", "červen": "<big><big>června</big></big>", "červenec": "<big><big>července</big></big>", "srpen": "<big><big>srpna</big></big>", "září": "<big><big>září</big></big>", "říjen": "<big><big>října</big></big>", "listopad": "<big><big>listopadu</big></big>", "prosinec": "<big><big>prosince</big></big>", "pondělí": "<big><big>Pondělí</big></big>", "úterý": "<big><big>Úterý</big></big>", "středa": "<big><big>Středa</big></big>", "čtvrtek": "<big><big>Čtvrtek</big></big>", "pátek": "<big><big>Pátek</big></big>", "sobota": "<big><big>Sobota</big></big>", "neděle": "<big><big>Neděle</big></big>"};
  8. class Okno(Gtk.Window):
  9.  
  10.     def __init__(self):
  11.         Gtk.Window.__init__(self, title="Fronťák - Zobrazovač 0.1a")
  12.  
  13.  
  14.         cbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
  15.         dbox = Gtk.Box(spacing=1)
  16.         hbox = Gtk.Box(spacing=3)
  17.         vbox_left = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
  18.         vbox_center = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
  19.         vbox_right = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
  20.  
  21.  
  22.         ucitele=open("seznam.uci", "r")
  23.         jmeno=""
  24.         i=0
  25.         jmuc = []
  26.         while(True):
  27.             x = ucitele.read(1)
  28.             if (x=='\n'):
  29.                 jmuc.append(jmeno)
  30.                 i=i+1
  31.                 jmeno=''
  32.             if (x==''):
  33.                 break
  34.             jmeno = jmeno+x
  35.            
  36.            
  37.  
  38.         cbox.pack_start(hbox, True, True, 0)
  39.         cbox.pack_start(dbox, True, True, 0)
  40.         hbox.pack_start(vbox_left, True, True, 0)
  41.         hbox.pack_start(vbox_center, True, True, 0)
  42.         hbox.pack_start(vbox_right, True, True, 0)
  43.  
  44.         i=0
  45.         try:
  46.             while(True):
  47.                 label = Gtk.Label()
  48.                 label.set_markup("<big><big><big><big><big><big><big>"+(jmuc[i])+"\n </big></big></big></big></big></big></big>")
  49.                 label.set_line_wrap(True)
  50.                 if (0<=i<3):
  51.                     vbox_left.pack_start(label, True, True, 0)
  52.                 if (3<=i<6):
  53.                     vbox_center.pack_start(label, True, True, 0)
  54.                 if (6<=i<9):
  55.                     vbox_right.pack_start(label, True, True, 0)
  56.                 i=i+1
  57.  
  58.         except :
  59.             print("Dosáhl jsem konce seznamu, ukončuji funkci čti učitele!")
  60.  
  61.         self.label1 = Gtk.Label()
  62.         self.label1.set_line_wrap(True)
  63.         dbox.pack_start(self.label1, True, True, 0)
  64.  
  65.         self.add(cbox)
  66.  
  67.     def datum(self):
  68.         while(True):
  69.             mesic = dict[time.strftime(str("%B"))]
  70.             den = dict[time.strftime(str("%A"))]
  71.             zacatek = time.strftime(str("<big><big>Dnes je </big></big>"))
  72.             prostredek = time.strftime(str("<big><big> %d. </big></big>"))
  73.             konec = time.strftime(str("<big><big> %Y %H:%M:%S. Dnešek je %j. den v roce.</big></big>"))
  74.             zobraz = str("<big><big><big><big>"+zacatek + den + prostredek + mesic + konec+"</big></big></big></big>")
  75.             self.label1.set_markup(zobraz)
  76.             time.sleep(1)
  77.  
  78.    
  79. win = Okno()
  80. win.connect("delete-event", Gtk.main_quit)
  81. win.show_all()
  82. win.fullscreen()
  83. c=Thread(target=win.datum)
  84. c.start()
  85. Gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement