def __init__(self, parentobj): super(InvAboutDialog, self).__init__() global about_name, about_version, about_url, about_authors self.set_transient_for(parentobj) self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.set_name(about_name) self.set_version(about_version) self.set_website(about_url) self.set_authors(about_authors) self.set_comments('A Minecraft Inventory Editor written in Python') licensepath = util.get_datafile_path('COPYING.txt') if os.path.isfile(licensepath): try: with open(licensepath, 'r') as df: self.set_license(df.read()) except Exception: pass iconpath = util.get_datafile_path('logo.png', 'gfx') if os.path.isfile(iconpath): try: self.set_logo(gtk.gdk.pixbuf_new_from_file(iconpath)) except Exception, e: pass
def __init__(self, yamlobj): """ Initializes given a yaml dict. """ self.texfile = yamlobj['texfile'] self.filename = util.get_datafile_path(self.texfile, 'gfx') self.x = yamlobj['dimensions'][0] self.y = yamlobj['dimensions'][1] self.grid_large = [] self.grid_small = [] self.grid_pixbuf = [] for x in range(0, self.x): self.grid_large.append([]) self.grid_small.append([]) self.grid_pixbuf.append([]) for y in range(0, self.y): self.grid_large[x].append(None) self.grid_small[x].append(None) self.grid_pixbuf[x].append(None) # Make sure the file is present if not os.path.exists(self.filename): raise Exception('texfile %s not found' % (self.texfile)) # And while we're at it, load and process it mainsurface = None try: mainsurface = cairo.ImageSurface.create_from_png(self.filename) except Exception, e: raise Exception('Unable to load texture file %s: %s' % (self.texfile, str(e)))