コード例 #1
0
ファイル: progressbar.py プロジェクト: TrevorLowing/PyGames
 def __init__(self, app, parent, title=None, images=None, color="blue",
              width=300, height=25, show_text=1, norm=1):
     self.parent = parent
     self.percent = 0
     self.top = makeToplevel(parent, title=title)
     self.top.wm_protocol("WM_DELETE_WINDOW", self.wmDeleteWindow)
     self.top.wm_group(parent)
     self.top.wm_resizable(False, False)
     self.top.config(cursor="watch")
     #
     self.frame = ttk.Frame(self.top, relief='flat', borderwidth=0)
     self.progress = ttk.Progressbar(self.frame, maximum=100, length=250)
     ##style = ttk.Style(self.progress)
     ##style.configure('TProgressbar', background=color)
     if images:
         self.f1 = ttk.Label(self.frame, image=images[0])
         self.f1.pack(side='left', ipadx=8, ipady=4)
         self.progress.pack(side='left', expand=True, fill='x')
         self.f2 = ttk.Label(self.frame, image=images[1])
         self.f2.pack(side='left', ipadx=8, ipady=4)
     else:
         self.progress.pack(expand=True, fill='x')
     self.frame.pack(expand=True, fill='both')
     if 1:
         setTransient(self.top, None, relx=0.5, rely=0.5)
     else:
         self.update(percent=0)
     self.norm = norm
     self.steps_sum = 0
コード例 #2
0
ファイル: progressbar.py プロジェクト: TrevorLowing/PyGames
 def __init__(self, app, parent, title=None, images=None, color="blue",
              width=300, height=25, show_text=1, norm=1):
     self.parent = parent
     self.percent = 0
     self.top = makeToplevel(parent, title=title)
     self.top.wm_protocol("WM_DELETE_WINDOW", self.wmDeleteWindow)
     self.top.wm_group(parent)
     self.top.wm_resizable(False, False)
     self.frame = Tkinter.Frame(self.top, relief='flat', bd=0,
                                takefocus=0)
     self.cframe = Tkinter.Frame(self.frame, relief='sunken', bd=1,
                                takefocus=0)
     self.canvas = Tkinter.Canvas(self.cframe, width=width, height=height,
                                  takefocus=0, bd=0, highlightthickness=0)
     self.scale = self.canvas.create_rectangle(-10, -10, 0, height,
                                               outline=color, fill=color)
     self.text = -1
     if show_text:
         self.text = self.canvas.create_text(0, 0, anchor=Tkinter.CENTER)
     self.cframe.grid_configure(column=0, row=0, sticky="ew")
     if images:
         self.f1 = Tkinter.Label(self.frame, image=images[0])
         self.f1.grid_configure(column=0, row=0, sticky="ew", ipadx=8, ipady=4)
         self.cframe.grid_configure(column=1, row=0, sticky="ew", padx=8)
         self.f2 = Tkinter.Label(self.frame, image=images[1])
         self.f2.grid_configure(column=2, row=0, sticky="ew", ipadx=8, ipady=4)
     self.top.config(cursor="watch")
     self.pack()
     if 1:
         setTransient(self.top, None, relx=0.5, rely=0.5)
     else:
         self.update(percent=0)
     self.norm = norm
     self.steps_sum = 0
コード例 #3
0
ファイル: progressbar.py プロジェクト: proteanblank/PySolFC
    def __init__(self,
                 app,
                 parent,
                 title=None,
                 images=None,
                 color='blue',
                 bg='#c0c0c0',
                 height=25,
                 show_text=1,
                 norm=1):
        self.parent = parent
        self.percent = 0
        self.steps_sum = 0
        self.norm = norm
        self.top = makeToplevel(parent, title=title)
        self.top.set_position(gtk.WIN_POS_CENTER)
        self.top.set_resizable(False)
        self.top.connect("delete_event", self.wmDeleteWindow)

        # hbox
        hbox = gtk.HBox(spacing=5)
        hbox.set_border_width(10)
        hbox.show()
        self.top.table.attach(hbox, 0, 1, 0, 1, 0, 0, 0, 0)
        # hbox-1: image
        if images and images[0]:
            im = gtk.Image()
            im.set_from_pixbuf(images[0].pixbuf)
            hbox.pack_start(im, expand=False, fill=False)
            im.show()
            im.set_property('xpad', 10)
            im.set_property('ypad', 5)
        # hbox-2:vbox
        vbox = gtk.VBox()
        vbox.show()
        hbox.pack_start(vbox, False, False)
        # hbox-2:vbox:pbar
        self.pbar = gtk.ProgressBar()
        self.pbar.show()
        vbox.pack_start(self.pbar, True, False)
        self.pbar.realize()
        # ~ self.pbar.set_show_text(show_text)
        self.pbar.set_text(str(show_text) + '%')
        w, h = self.pbar.size_request()
        self.pbar.set_size_request(max(w, 300), max(h, height))
        # hbox-3:image
        if images and images[1]:
            im = gtk.Image()
            im.set_from_pixbuf(images[1].pixbuf)
            hbox.pack_end(im, expand=False)
            im.show()
            im.set_property('xpad', 10)
            im.set_property('ypad', 5)

        setTransient(self.top, parent)
        self.top.show()
        self.top.window.set_cursor(gdk.Cursor(gdk.WATCH))
        self.update(percent=0)
コード例 #4
0
ファイル: tkwidget.py プロジェクト: TrevorLowing/PyGames
 def __init__(self, parent, title="", resizable=False, default=-1):
     self.parent = parent
     self.status = 0
     self.button = default
     self.timer = None
     self.buttons = []
     self.accel_keys = {}
     self.top = makeToplevel(parent, title=title)
     self.top.wm_resizable(resizable, resizable)
     ##w, h = self.top.winfo_screenwidth(), self.top.winfo_screenheight()
     ##self.top.wm_maxsize(w-4, h-32)
     bind(self.top, "WM_DELETE_WINDOW", self.wmDeleteWindow)
コード例 #5
0
    def __init__(self, parent, title="", resizable=0, default=-1):
        self.parent = parent
        self.status = 0
        self.button = default
        self.timer = None
        self.top = makeToplevel(parent, title=title)
        self.top.wm_resizable(resizable, resizable)
        bind(self.top, "WM_DELETE_WINDOW", self.wmDeleteWindow)
        if self.img is None:
            _ToplevelDialog.img = (makeImage(dither=0,
                                             data="""
R0lGODlhIAAgAPICAH8AAH9/f7+/v/8AAP///wAAAAAAAAAAACH5BAEAAAIALAAAAAAgACAAAAPZ
KLos8PC1SRccOGNYO9AgCHTNE57ZQwoA6mZAB7z0AFRA/QLBBISEFyEECDAAIYISpSSEAAwAqKkM
UQkgQGABCF011xAgEBAAUFfMFQUICACu69UFCAgAL7nyBSADaHI0AGQANHI0AGQAL3oELwBkAC6N
Si4AZAAoVxhXKABkAgAhVxpXIQBkAQIAIFchVyAAqQIAIU0oTSEAZAsAIQQvBCEAqQwAOi4AqQEM
AMgoAKkTAM8gAKkVD9UPyx0BAMgAywErARAoEOMrC2QREeMB6w3w9AHyFfUrCQA7"""),
                                   makeImage(dither=0,
                                             data="""
R0lGODlhIAAgAPIDAAAAAAAA/39/f7+/v////wAAAAAAAAAAACH5BAEAAAMALAAAAAAgACAAAAPU
OLo88vC1SRccJOsBa32DJo7D4zHCMK7jIJyDwA5BHQws4AksYds9AEXQI/xqRUBDMCgOfoPiAMAQ
FK8sgEAhGGC/mgFAMBBcjzUsQDAQfI9YAOR7xAIg3yMWAPkesQAQA1hHVwMADwMCWEdXABADAgNX
R0UDABAKAj1oNiwAEAwAYEUAEQ0ApCsAERQAA6oEAwARHgAAA18DtxEwArcAAysDwBECMAoQwAMa
AMYPyAwRABoAxtEVAgAaAA/YyAAZAA/fyAAEAA/lyLcP68gQ78gPMAkAOw=="""),
                                   makeImage(dither=0,
                                             data="""
R0lGODlhIAAgAPIDAAAAAAAA/39/f7+/v////wAAAAAAAAAAACH5BAEAAAMALAAAAAAgACAAAAPp
OLo88vC1SRccJOsBa32DJo7D4zHCMK7jIJyDwM4j4AnsEOz8wAIUAWsQGGR4gQEL0BAMWDsRkjUA
MAQzZAY5AwgUgsEMSRggZwOAYCCgDXYDApJGAAgGArpmwNMDIHoZPIEAEIEEOwOBABCHO4cAEAOH
hwMADwMCegM7A3oAEAMCA3RIdAMAEAoCdEh0ABAMADQDOwM0ABENAJQrABEUAAO9BAMAER4AAAOB
A8oRMALKAAMrA9MRAjAKENMDGgDZD9sMEQAaANnkFQIAGgAP69sAGQAP8tsABAAP+NvKD/xtgyBw
2wMYCQAAOw=="""),
                                   makeImage(dither=0,
                                             data="""
R0lGODlhIAAgAPIDAAAAAH9/AH9/f7+/v///AAAAAAAAAAAAACH5BAEAAAMALAAAAAAgACAAAAPu
OLq88S3KqQIhA9Atw70DIHDkEHwXIAglFaDXAKytFMAXsNZNgF8DwIq3CPwugBVxEDheBoAVMfAZ
AK6DD2DFC6Cu4M8AsKoFUOArCrBqBWBpAGoAWJUCsDgMsCIFcHEwAwArHAE4AWABOAArGwE/A2AD
OAMAKxQBR2BHACsTAU4BAAFHAwArEgFOAwADTgArEQFOFwC1AwArDQG1vhcAKwwBvgNXA04DACsL
Ab5ptQArCgG/abUDACsDAb8DVwO+ACsDAb/nFwArAgHovwMA6wMB7k4DAOsCCgFx/f79+QQwCEiw
oEEBEQ4qJKggAQA7"""))
コード例 #6
0
def make_help_toplevel(parent, title=None, class_=None):
    return makeToplevel(parent,
                        title=title,
                        class_=class_,
                        gtkclass=_MfxToplevel)
コード例 #7
0
ファイル: progressbar.py プロジェクト: jimsize/PySolFC
    def __init__(self, app, parent, title=None, images=None,
                 color='blue', bg='#c0c0c0',
                 height=25, show_text=1, norm=1):
        self.parent = parent
        self.percent = 0
        self.steps_sum = 0
        self.norm = norm
        self.top = makeToplevel(parent, title=title)
        self.top.set_position(gtk.WIN_POS_CENTER)
        self.top.set_resizable(False)
        self.top.connect("delete_event", self.wmDeleteWindow)

        # hbox
        hbox = gtk.HBox(spacing=5)
        hbox.set_border_width(10)
        hbox.show()
        self.top.table.attach(hbox,
                              0, 1, 0, 1,
                              0,    0,
                              0,    0)
        # hbox-1: image
        if images and images[0]:
            im = gtk.Image()
            im.set_from_pixbuf(images[0].pixbuf)
            hbox.pack_start(im, expand=False, fill=False)
            im.show()
            im.set_property('xpad', 10)
            im.set_property('ypad', 5)
        # hbox-2:vbox
        vbox = gtk.VBox()
        vbox.show()
        hbox.pack_start(vbox, False, False)
        # hbox-2:vbox:pbar
        self.pbar = gtk.ProgressBar()
        self.pbar.show()
        vbox.pack_start(self.pbar, True, False)
        self.pbar.realize()
        # ~ self.pbar.set_show_text(show_text)
        self.pbar.set_text(str(show_text)+'%')
        w, h = self.pbar.size_request()
        self.pbar.set_size_request(max(w, 300), max(h, height))
        # hbox-3:image
        if images and images[1]:
            im = gtk.Image()
            im.set_from_pixbuf(images[1].pixbuf)
            hbox.pack_end(im, expand=False)
            im.show()
            im.set_property('xpad', 10)
            im.set_property('ypad', 5)
        # set icon
        #  if app:
        #      try:
        #          name = app.dataloader.findFile('pysol.xpm')
        #          bg = self.top.get_style().bg[gtk.STATE_NORMAL]
        #          pixmap, mask = create_pixmap_from_xpm(self.top, bg, name)
        #          self.top.set_icon(pixmap, mask)
        #      except: pass
        setTransient(self.top, parent)
        self.top.show()
        self.top.window.set_cursor(gdk.Cursor(gdk.WATCH))
        self.update(percent=0)
コード例 #8
0
ファイル: tkwrap.py プロジェクト: TrevorLowing/PyGames
def make_help_toplevel(parent, title=None, class_=None):
    return makeToplevel(parent, title=title, class_=class_, gtkclass=_MfxToplevel)