Ejemplo n.º 1
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self,
                          parent=parent,
                          id=-1,
                          title=title,
                          size=(800, 600))
        self.CenterOnScreen()

        images.initialize()

        _icon = wx.EmptyIcon()
        _icon.CopyFromBitmap(images.GetBitmap("AppIcon"))
        self.SetIcon(_icon)

        tbicon = wx.TaskBarIcon()
        tbicon.SetIcon(_icon)

        self.sp = wx.SplitterWindow(self)

        self.tree = workspaceview.WorkspaceView(self.sp)
        if DEBUG:
            w_path = os.path.abspath(workspace_path)
            self.SetLabel(workspace_path)
            self.tree.SetModel(workspacemodel.WorkspaceModel(w_path))
        self.nb = TabsView(self.sp)
        tmodel = tabsmodel.TabsModel(self.tree.GetModel())
        # TODO:
        tmodel._path = w_path  # !!!
        self.nb.SetModel(tmodel)
        self.tree.SetTabsModel(tmodel)

        self.sp.SetMinimumPaneSize(10)
        self.sp.SplitVertically(self.tree, self.nb, 200)
Ejemplo n.º 2
0
Archivo: main.py Proyecto: jupp/meud-wx
 def __init__(self, parent, title):   
     wx.Frame.__init__(self, parent=parent, id=-1, title=title, size=(800, 600))
     self.CenterOnScreen()
     
     images.initialize()
     
     _icon = wx.EmptyIcon()
     _icon.CopyFromBitmap(images.GetBitmap("AppIcon"))
     self.SetIcon(_icon)
     
     tbicon = wx.TaskBarIcon()
     tbicon.SetIcon(_icon)
     
     self.sp = wx.SplitterWindow(self)
     
     self.tree = workspaceview.WorkspaceView(self.sp)
     if DEBUG:
         w_path = os.path.abspath(workspace_path)
         self.SetLabel(workspace_path)
         self.tree.SetModel(workspacemodel.WorkspaceModel(w_path))
     self.nb = TabsView(self.sp)
     tmodel = tabsmodel.TabsModel(self.tree.GetModel())
     # TODO:
     tmodel._path = w_path # !!!
     self.nb.SetModel(tmodel)
     self.tree.SetTabsModel(tmodel)
     
     self.sp.SetMinimumPaneSize(10)
     self.sp.SplitVertically(self.tree, self.nb, 200)
Ejemplo n.º 3
0
from flask import (Flask, render_template, request, jsonify)
from peewee import IntegrityError
import bootstrap
from models.house import House
import images
app_start_config = {'debug': True, 'port': 8080, 'host': '0.0.0.0'}
app = Flask(__name__)

bootstrap.initialize()

images.initialize()


@app.route('/')
def index():
    # avail_houses = House.select()
    # return render_template('list_houses.html', houses=avail_houses)
    list_image = images.Images.select()
    results = []
    for image in list_image:
        image_item = {
            'description': image.description,
            # 'plot_no': image.plot_no,
            # 'no_rooms':image.no_rooms,
            # 'rent':image.rent,
            # 'no_bathrooms':image.no_bathrooms,
            # 'location':image.location,
            # 'nearby_amenities':image.nearby_amenities,
            # 'rating':image.rating,
            'thumbnail_link': image.thumbnail_link,
            'fullimage_link': image.fullimage_link
Ejemplo n.º 4
0
    def load_from_file(self, map_name, map_dir = 'maps/'):
        # Check to make sure the file exists
        if not os.path.exists(map_dir + map_name):
            config.log_e('Map not found: ' + map_name)
            return 
        
        # Actually load the file
        map_file = open(map_dir + map_name, 'r')

        line = map_file.readline()
        while not line.startswith('tileset'):
            line = map_file.readline()
        line = line.replace('\n', '')
        tileset = line.split()[-1]

        images.initialize(tileset)

        # Try reading the first line of map for width
        self.read_to_map_start(map_file)

        line = map_file.readline()
        self.width = len(line.replace('\n', '').split())
        config.log_d('Map width: ' + str(self.width))

        self.read_to_map_start(map_file)

        # Try reading number of lines for height
        for i, l in enumerate(map_file):
            pass
        self.height = i + 1
        config.log_d('Map height: ' + str(self.height))

        self.read_to_map_start(map_file)

        # TODO: Check to make sure all tiles actually exist?

        # Initalize tile dictionary
        x, y = 1, 1
        for i in range(self.width):
            for e in range(self.height):
                self.tiles[(x,y)] = {}
                self.tiles[(x,y)]['coords'] = (((x-1) * TILE_SIZE), ((y-1) * TILE_SIZE)) # NOTE: May need to change this, so that the maps scroll properly. In other words, starting location needs to be determined based on the player's location within the map.
                y += 1
            y = 1
            x += 1
        
        # Read in map data and fill self.tiles with image references, one layer for now
        x, y = 1, 1
        for line in map_file.readlines():
            line = line.replace('\n', '')
            for tile in line.split():
                layers = tile.split(',')
                self.tiles[(x,y)][1] = int(layers[0])
                self.tiles[(x,y)][2] = int(layers[1])
                self.tiles[(x,y)][3] = int(layers[2])
                self.tiles[(x,y)]['can_walk'] = True if int(layers[3]) is 1 else False
                x += 1
            x = 1
            y += 1

        # This grid is now loaded!
        self.loaded = True