Beispiel #1
0
    def __init__(self, view):
        self.clock = pg.time.Clock()
        self.view = view
        glEnable(GL_DEPTH_TEST)

        self.ADDENEMY = pg.USEREVENT + 1  # pylint: disable=no-member
        pg.time.set_timer(self.ADDENEMY, randint(500, 750))
        self.NEWTORNADO = pg.USEREVENT + 2  # pylint: disable=no-member
        pg.time.set_timer(self.NEWTORNADO, randint(5000, 20000))

        self.enemies = []
        self.splats = []
        self.splats_collect = []
        self.bullets = []
        self.tornados = []
        self.all_sprites = []
        self.player = Player()
        self.splat_count = [0]

        self.background = Background(desert_road_png)
        self.loot_button = Hud_Button(treasure_png, (-.85, -.8))
        self.loot = ui.Window('Loot', self.splat_count, self.view, self.player)
        self.loot.paint_select[0].active = True
        self.loot.paint_select[0].owned = True

        self.isRunning = True
Beispiel #2
0
    def create_bar(self):
        """ create and configure gtk.Window (bar) """
        core.logINFO('create bar ..', 'BarManager')

        self.win = ui.Window()
        self.win.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DOCK)
        self.win.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.ENTER_NOTIFY
                            | gtk.gdk.LEAVE_NOTIFY)
        self.win.set_title("ADeskBar")
        self.win.set_name("ADeskBar")
        self.is_composited = self.win.is_composited()
Beispiel #3
0
def main():
    app = Application()
    renderer = Renderer()
    renderer.register_with_app(app)
    #app.request_update_on_draw(Test(renderer).update)

    mainWindow = ui.Window(renderer, 50, 50, 300, 400)
    mainWindow.addWidget(ui.Button,
                         x=20,
                         y=20,
                         width=50,
                         height=60,
                         color=(1, 0, 1, 1),
                         text="Example Text")

    app.run()
Beispiel #4
0
    def LoadWindow(self):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "UIScript/AtlasWindow.py")
        except:
            import exception
            exception.Abort("AtlasWindow.LoadWindow.LoadScript")

        try:
            self.board = self.GetChild("board")
            self.titleBar = self.GetChild("TitleBar")
            # self.toolTipPos = self.GetChild("positionToolTip")
            self.enableGMJumpButton = self.GetChild("enableWarpWindowButton")
            self.enableGMJumpButton.SetEvent(self.ToggleGMJump)
        except:
            import exception
            exception.Abort("AtlasWindow.LoadWindow.BindObject")

        self.AtlasMainWindow = self.AtlasRenderer()

        self.toolTipPos = ui.TextLine()
        self.toolTipPos.SetParent(self.AtlasMainWindow)
        self.toolTipPos.SetOutline()
        self.toolTipPos.Hide()
        self.toolTipPos.SetTop()
        self.titleBar.SetCloseEvent(self.Hide)
        self.AtlasMainWindow.SetParent(self.board)
        self.AtlasMainWindow.SetPosition(12 + 13, 34 - 10 - 8)
        self.tooltipInfo.SetParent(self.board)
        self.infoGuildMark.SetParent(self.board)
        self.SetPosition(wndMgr.GetScreenWidth() - 136 - 256 - 10, 0)
        self.Hide()
        self.ClearBossIcons()
        self.MakeBossIcons()
        miniMap.RegisterAtlasWindow(self)

        self.warpWindow = ui.Window()
        self.warpWindow.SetParent(self.board)
        self.warpWindow.SetPosition(12 + 13, 34 - 10 - 8)
        self.warpWindow.Hide()
        self.warpWindow.SetMouseLeftButtonDownEvent(self.OnGMJump)
    def __init__(self):
        # window: without a window with size = 0 x 0 you won't be able to click there if it's shown
        bgWindow = ui.Window()
        bgWindow.Hide()
        self.bgWindow = bgWindow
        showingImage = ui.ImageBox()
        showingImage.SetParent(self.bgWindow)
        showingImage.LoadImage(
            "locale/%s/ui/game/achievement/reward_shower.tga" %
            (app.GetLocaleName()))
        showingImage.SetPosition(
            wndMgr.GetScreenWidth() / 2 - showingImage.GetWidth() / 2,
            wndMgr.GetScreenHeight() / 8 - showingImage.GetHeight() / 2)
        showingImage.Show()
        self.image = showingImage
        showingImageName = ui.ImageBox()
        showingImageName.SetParent(self.bgWindow)
        showingImageName.SetPosition(
            showingImage.GetLeft(),
            showingImage.GetTop() + showingImage.GetHeight() + 3)
        showingImageName.Show()
        self.imageName = showingImageName

        self.indexLeft = []
Beispiel #6
0

class MyView(ui.View):
    def __init__(self, frame=ui.Rect()):
        super().__init__(frame)

        scroll = ui.ScrollView(ui.Rect(100, 100, 300, 300))
        scroll.content_size = ui.Vec(300, 10000)
        scroll._content_view.background_color = ui.Color.scheme.back().with_alpha(0.5)
        self.add_subview(scroll)
        self._scroll = scroll

        button = ui.Button(title="Push")
        button.action = lambda x: self._controller.push(x)
        scroll.add_subview(button)
        self.push = button

        button = ui.Button(title="Pop")
        button.action = lambda x: self._controller.pop(x)
        scroll.add_subview(button)
        self.pop = button

    def layout(self):
        self.pop.frame = ui.Rect(origin=ui.Vec(50, 100), size=self.pop.preferred_size())
        self.push.frame = ui.Rect(origin=ui.Vec(150, 100), size=self.push.preferred_size())


window = ui.Window()
window.root_controller = ui.NavigationController(MainController())
pyglet.app.run()
Beispiel #7
0
    #z_interpolated = z_func  # delete this later
    #s_interpolated = s_func  # delete this later
    p_interpolated = interpolated_function.InterpolatedFunction("p_func_tabulated")
    z_interpolated = interpolated_function.InterpolatedFunction("z_func_tabulated")
    s_interpolated = interpolated_function.InterpolatedFunction("s_func_tabulated")

    p_interpolated.tabulate(numpy.arange(0, T + T/(N * 100), T/(N * 100)), "p_func_interp_tabulated")
    z_interpolated.tabulate(numpy.arange(0, T + T/(N * 100), T/(N * 100)), "z_func_interp_tabulated")
    s_interpolated.tabulate(numpy.arange(0, T + T/(N * 100), T/(N * 100)), "s_func_interp_tabulated")
    
    integral = integral_p.IntegralP(p_interpolated)

    # Calculate interpolation coefficients and make corresponding functions (uncomment for real interpolation)
    #u_interpolated = InterpolatedFunction(integral.calculate_interpolation_coeffs())
    
    #u_interpolated = integral  # delete this later

    # Initialize f function
    f_func = f_function.FFunction([beta, s_interpolated, z_interpolated, N])

    return cauchi_problem.solve(x_0, y_0, beta, T,  N,
                         p_interpolated, z_interpolated,
                         s_interpolated, integral, f_func)
    


if __name__ == '__main__':
    app = QApp5(sys.argv)
    window = ui.Window(main)
    sys.exit(app.exec_())
Beispiel #8
0
                else:
                    print('dislike')
                    api.like(music['id'], False, cookies)
                like_flag = window.like.like_flag

            text = mpg123.mpg123.stdout.readline()
            try:
                text = text.decode()
                if '@P 0' in text:
                    break
            except UnicodeDecodeError:
                pass


# if __name__ == '__main__':

# p = threading.Thread(target=fm163,args=(mpg123,window,director,))
if not os.path.exists('cookie'):
    login()

mpg123 = Mpg123()
director = ui.director
director.director.init(width=420, height=180, caption='bj163')
window = ui.Window(mpg123)
main_scene = ui.cocos.scene.Scene(window)

t = threading.Thread(target=fm163)
t.setDaemon(True)
t.start()
director.director.run(main_scene)
Beispiel #9
0
 def __init__(self):
     self.window = ui.Window(self)
     self.mode = Interactive(self.window)
     self.window.update()
     self.window.protocol('WM_DELETE_WINDOW', self.exit)
Beispiel #10
0
import os

import ui
import users
import inventory

WIN = ui.Window()
ITEMS = inventory.make_all_items(os.path.join(".", "data", "items.json"))
USER = None

def main():
    WIN.add_text("Enter your username")
    name = WIN.get_input()
    USER = users.User(name)
    if not users.is_user_present(name):
        USER.create_user()
    worlds = USER.return_worlds()

    def world():
        WIN.add_text("Do you want to (s)elect/(c)reate/(d)elete/(r)ename world?")
        chose = WIN.get_input()
        if chose.startswith('c'):
            WIN.add_text("Name your world")
            world = WIN.get_input()
            USER.create_world(world)
        elif chose.startswith('d'):
            for n, i in worlds:
                WIN.add_text(f"{n}\t{i}")
            WIN.add_text("Enter the number before the world name to delete it")
            world = WIN.get_input()
            USER.remove_world(worlds[world])