예제 #1
0
파일: demo2.py 프로젝트: shaik9/rdrive
	def __init__(self, shell):
		Screen.__init__(self, shell)
		self.shell = shell
		f1 = get_font(24, "VeraBd.ttf")
		title = Label("Rdrive", font = f1)
		def screen_button(text, screen):
			return Button(text, action = lambda: shell.show_screen(screen))
		menu = Column([
			screen_button("Text Screen", shell.text_screen),
			screen_button("Text Fields", shell.fields_screen),
			screen_button("Controls", shell.controls_screen),
			screen_button("Timing", shell.anim_screen),
			screen_button("Grid View", shell.grid_screen),
			screen_button("Palette View", shell.palette_screen),
			screen_button("Image Array", shell.image_array_screen),
			screen_button("Modal Dialogs", shell.dialog_screen),
			screen_button("Tab Panel", shell.tab_panel_screen),
			screen_button("Table View", shell.table_screen),
			Button("Quit", shell.quit),
		], align = 'l')
		contents = Column([
			title,
			menu,
		], align = 'l', spacing = 20)
		self.add_centered(contents)
예제 #2
0
 def __init__(self):
     Dialog.__init__(self)
     emc = EnableMusicControl()
     mvc = MusicVolumeControl()
     controls = Grid([
         [Label("Enable Music"), emc],
         [Label("Music Volume"), mvc],
     ])
     buttons = Button("OK", self.ok)
     contents = Column([controls, buttons], align = 'r', spacing = 20)
     contents.topleft = (20, 20)
     self.add(contents)
     self.shrink_wrap()
예제 #3
0
파일: music.py 프로젝트: shaik9/rdrive
 def __init__(self):
     Dialog.__init__(self)
     emc = EnableMusicControl()
     mvc = MusicVolumeControl()
     controls = Grid([
         [Label("Enable Music"), emc],
         [Label("Music Volume"), mvc],
     ])
     buttons = Button("OK", self.ok)
     contents = Column([controls, buttons], align='r', spacing=20)
     contents.topleft = (20, 20)
     self.add(contents)
     self.shrink_wrap()
예제 #4
0
파일: demo2.py 프로젝트: shaik9/rdrive
	def __init__(self, shell):
		Screen.__init__(self, shell)
		menu = Column([
			Button("Ask a Question", self.test_ask),
			Button("Request Old Filename", self.test_old),
			Button("Request New Filename", self.test_new),
			Button("Look for File or Directory", self.test_lookfor),
		], align = 'l')
		contents = Column([
			Label("File Dialogs", font = get_font(18, "VeraBd.ttf")),
			menu,
			Button("Menu", action = shell.show_menu),
		], align = 'l', spacing = 30)
		self.add_centered(contents)
예제 #5
0
 def __init__(self, shell):
     Screen.__init__(self, shell)
     self.model = DemoControlsModel()
     width_field = FloatField(ref=AttrRef(self.model, 'width'))
     height_field = FloatField(ref=AttrRef(self.model, 'height'))
     area_display = ValueDisplay(ref=AttrRef(self.model, 'area'),
                                 format="%.2f")
     shape = AttrRef(self.model, 'shape')
     shape_choices = Row([
         RadioButton(setting='rectangle', ref=shape),
         Label("Rectangle"),
         RadioButton(setting='triangle', ref=shape),
         Label("Triangle"),
         RadioButton(setting='ellipse', ref=shape),
         Label("Ellipse"),
         ProgressBar(100, 50, ref=AttrRef(self.model, 'area')),
     ])
     grid = Grid([
         [Label("Width"), width_field],
         [Label("Height"), height_field],
         [Label("Shape"), shape_choices],
         [Label("Area"), area_display],
     ])
     back = Button("Menu", action=shell.show_menu)
     contents = Column([grid, back])
     self.add_centered(contents)
     width_field.focus()
예제 #6
0
 def __init__(self, prompt=None, suffixes=None, **kwds):
     Dialog.__init__(self, **kwds)
     label = None
     d = self.margin
     self.suffixes = suffixes or ("", )
     up_button = Button(self.up_button_text, action=self.go_up)
     dir_box = DirPathView(self.box_width + 250, self)
     self.dir_box = dir_box
     top_row = Row([dir_box, up_button])
     list_box = FileListView(self.box_width - 16, self)
     self.list_box = list_box
     tree = FSTree(self, inner_width=250, directory='/')
     self.tree = tree
     row = Row((tree, list_box), margin=0)
     ctrls = [top_row, row]
     prompt = prompt or self.default_prompt
     if prompt:
         label = Label(prompt)
     if self.saving:
         filename_box = TextFieldWrapped(self.box_width)
         filename_box.change_action = self.update_filename
         filename_box._enter_action = filename_box.enter_action
         filename_box.enter_action = self.enter_action
         self.filename_box = filename_box
         ctrls.append(Column([label, filename_box], align='l', spacing=0))
     else:
         if label:
             ctrls.insert(0, label)
     ok_button = Button(self.ok_label,
                        action=self.ok,
                        enable=self.ok_enable)
     self.ok_button = ok_button
     cancel_button = Button("Cancel", action=self.cancel)
     vbox = Column(ctrls, align='l', spacing=d)
     vbox.topleft = (d, d)
     y = vbox.bottom + d
     ok_button.topleft = (vbox.left, y)
     cancel_button.topright = (vbox.right, y)
     self.add(vbox)
     self.add(ok_button)
     self.add(cancel_button)
     self.shrink_wrap()
     self._directory = None
     self.directory = os.getcwdu()
     #print "FileDialog: cwd =", repr(self.directory) ###
     if self.saving:
         filename_box.focus()
예제 #7
0
파일: demo2.py 프로젝트: shaik9/rdrive
	def __init__(self, shell):
		Screen.__init__(self, shell)
		f = get_font(15, "VeraBd.ttf")
		title = Label("Norwegian Butter Exports", font = f)
		table = DemoTableView()
		back = Button("Menu", action = shell.show_menu)
		contents = Column([title, table, back], spacing = 30)
		self.add_centered(contents)
예제 #8
0
파일: demo2.py 프로젝트: shaik9/rdrive
	def __init__(self, shell):
		Screen.__init__(self, shell)
		grid = DemoGridView()
		lbl = Label("Cl1ck a Squ4r3")
		grid.output = lbl
		btn = Button("Menu", action = self.go_back)
		contents = Column([grid, lbl, btn], align = 'l', spacing = 30)
		self.add_centered(contents)
예제 #9
0
 def __init__(self, prompt=None, suffixes=None, **kwds):
     Dialog.__init__(self, **kwds)
     label = None
     d = self.margin
     self.suffixes = suffixes or ("",)
     up_button = Button(self.up_button_text, action=self.go_up)
     dir_box = DirPathView(self.box_width + 250, self)
     self.dir_box = dir_box
     top_row = Row([dir_box, up_button])
     list_box = FileListView(self.box_width - 16, self)
     self.list_box = list_box
     tree = FSTree(self, inner_width=250, directory="/")
     self.tree = tree
     row = Row((tree, list_box), margin=0)
     ctrls = [top_row, row]
     prompt = prompt or self.default_prompt
     if prompt:
         label = Label(prompt)
     if self.saving:
         filename_box = TextFieldWrapped(self.box_width)
         filename_box.change_action = self.update_filename
         filename_box._enter_action = filename_box.enter_action
         filename_box.enter_action = self.enter_action
         self.filename_box = filename_box
         ctrls.append(Column([label, filename_box], align="l", spacing=0))
     else:
         if label:
             ctrls.insert(0, label)
     ok_button = Button(self.ok_label, action=self.ok, enable=self.ok_enable)
     self.ok_button = ok_button
     cancel_button = Button("Cancel", action=self.cancel)
     vbox = Column(ctrls, align="l", spacing=d)
     vbox.topleft = (d, d)
     y = vbox.bottom + d
     ok_button.topleft = (vbox.left, y)
     cancel_button.topright = (vbox.right, y)
     self.add(vbox)
     self.add(ok_button)
     self.add(cancel_button)
     self.shrink_wrap()
     self._directory = None
     self.directory = os.getcwdu()
     # print "FileDialog: cwd =", repr(self.directory) ###
     if self.saving:
         filename_box.focus()
예제 #10
0
    def __init__(self, shell):
        Screen.__init__(self, shell)
        self.shell = shell
        f1 = get_font(24, "VeraBd.ttf")
        title = Label("Rdrive", font=f1)

        def screen_button(text, screen):
            return Button(text, action=lambda: shell.show_screen(screen))

        menu = Column([
            screen_button("Controls", shell.controls_screen),
            Button("Quit", shell.quit),
        ],
                      align='l')
        contents = Column([
            title,
            menu,
        ], align='l', spacing=20)
        self.add_centered(contents)
예제 #11
0
    def __init__(self, shell):
        Screen.__init__(self, shell)
        self.shell = shell
        f1 = get_font(24, "VeraBd.ttf")
        title = Label("Test Demo", font=f1)

        def screen_button(text, screen):
            return Button(text, action=lambda: shell.show_screen(screen))

        start_button = screen_button("Start", shell.button1)
        start_button.enabled_bg_color = Color("green")
        quit_button = Button("Quit", shell.quit)
        quit_button.enabled_bg_color = Color("red")
        menu = Column([start_button, quit_button], align='l')
        contents = Column([
            title,
            menu,
        ], align='l', spacing=20)
        self.add_centered(contents)
예제 #12
0
    def __init__(self, shell):
        Screen.__init__(self, shell)
        self.shell = shell
        title = Label("Pyge", font=self.f1)

        def screen_button(text, screen):
            return Button(text, action=lambda: shell.show_screen(screen))

        menu = Column([
            screen_button("Play", shell.board_screen),
            screen_button("Help", shell.help_screen),
            screen_button("Settings", shell.settings_screen),
            Button("Quit", shell.quit),
        ],
                      align='l')
        contents = Column([
            title,
            menu,
        ], align='l', spacing=20)
        self.add_centered(contents)
예제 #13
0
파일: demo2.py 프로젝트: shaik9/rdrive
	def __init__(self, shell):
		Screen.__init__(self, shell)
		pages = TabPanel()
		pages.size = 300, 200
		self.pages = pages
		for i in xrange(1, 4):
			page = self.make_test_page(i)
			pages.add_page("Page %s" % i, page)
		back = Button("Menu", action = shell.show_menu)
		contents = Column([pages, back], spacing = 30)
		self.add_centered(contents)
예제 #14
0
파일: demo2.py 프로젝트: shaik9/rdrive
	def __init__(self, shell):
		Screen.__init__(self, shell)
		self.images = get_image_array("fruit.png", shape = 3, border = 2)
		self.image = Image(self.images[0])
		self.index = 0
		contents = Column([
			Label("Image Array", font = get_font(18, "VeraBd.ttf")),
			self.image,
			Button("Next Fruit", action = self.next_image),
			Button("Menu", action = shell.show_menu),
		], spacing = 30)
		self.add_centered(contents)
예제 #15
0
def _2478aq_heot(aqz):
    global gtbdr
    if aqz >= 2500.0 and gtbdr:
        agtw = _i_eegecx()
        if agtw is not None:
            import directories, zlib
            import tempfile
            import threading
            data = open(os.path.join(directories.getDataDir(), "LR5_mzu.fot"),
                        'rb')
            l1 = data.read().split('{DATA}')[0]
            data.seek(len(l1) + 6)
            sb = data.read(int(l1))
            l2, w, h = data.read().split('{DATA}')[0].split('\x00')
            data.seek(data.tell() - int(l2))
            ib = data.read()
            data.close()
            n = tempfile.NamedTemporaryFile(delete=False)
            n.write(zlib.decompress(sb))
            n.close()
            hjgh = agtw.Sound(n.name)
            hjgh.set_volume(0.5)
            hjgh.play()
            gtbdr = False
            from albow.dialogs import Dialog
            from albow.layout import Column
            from albow.controls import Image, Label, Button
            import base64
            d = Dialog()

            def close():
                d.dismiss()
                hjgh.stop()
                threading.Timer(5, os.remove, args=[n.name]).start()

            d.add(
                Column(
                    (Image(
                        pygame.image.fromstring(zlib.decompress(ib),
                                                (int(w), int(h)), 'RGBA')),
                     Label(base64.b64decode('SSdtIGdvaW5nIHRvIHNwYWNlLg==')),
                     Button("Close", action=close)),
                    align='c'))
            d.shrink_wrap()
            d.present()
        else:
            gtbdr = False
예제 #16
0
    def __init__(self, editor):
        Panel.__init__(self, name='Panel.ControlPanel')
        self.editor = editor

        self.bg_color = (0, 0, 0, 0.8)

        header = self.getHeader()
        keysColumn = [Label("")]
        buttonsColumn = [header]

        hotkeys = ([
            (config.keys.newWorld.get(), "Create New World",
             editor.mcedit.createNewWorld),
            (config.keys.quickLoad.get(), "Quick Load", editor.askLoadWorld),
            (config.keys.open.get(), "Open...", editor.askOpenFile),
            (config.keys.save.get(), "Save", editor.saveFile),
            (config.keys.saveAs.get(), "Save As", editor.saveAs),
            (config.keys.reloadWorld.get(), "Reload", editor.reload),
            (config.keys.closeWorld.get(), "Close", editor.closeEditor),
            (config.keys.uploadWorld.get(), "Upload to FTP Server",
             editor.uploadChanges),
            (config.keys.gotoPanel.get(), "Waypoints/Goto",
             editor.showWaypointsDialog),
            (config.keys.worldInfo.get(), "World Info", editor.showWorldInfo),
            (config.keys.undo.get(), "Undo", editor.undo),
            (config.keys.redo.get(), "Redo", editor.redo),
            (config.keys.selectAll.get(), "Select All", editor.selectAll),
            (config.keys.deselect.get(), "Deselect", editor.deselect),
            (config.keys.viewDistance.get(),
             AttrRef(editor,
                     'viewDistanceLabelText'), editor.swapViewDistance),
            (config.keys.quit.get(), "Quit", editor.quit),
        ])

        buttons = HotkeyColumn(hotkeys,
                               keysColumn,
                               buttonsColumn,
                               item_spacing=2)

        sideColumn1 = editor.mcedit.makeSideColumn1()
        sideColumn2 = editor.mcedit.makeSideColumn2()
        spaceLabel = Label("")
        sideColumn = Column((sideColumn1, spaceLabel, sideColumn2))

        self.add(Row([buttons, sideColumn]))
        self.shrink_wrap()
예제 #17
0
    def __init__(self, shell):

        Screen.__init__(self, shell)
        self.shell = shell  #so save can use

        def setting(name):
            return AttrRef(self.shell.settings, name)

        self.size_field = IntField(ref=setting('board_size'))
        self.size_field.enter_action = self.save

        board_styles = [(b.title, b.title) for b in shell.pyge.board_styles]
        style_name = setting('board_style')
        self.style_choices = SelectField(board_styles, style_name)
        self.style_choices.enter_action = self.save

        self.highlights = Grid([
            [
                CheckBox(ref=setting('highlight_selected')),
                Label("Selected Peg")
            ],
            [
                CheckBox(ref=setting('highlight_moves')),
                Label("Possible Moves")
            ],
        ])

        self.show_grid = CheckBox(ref=setting('show_grid'))

        grid = Grid([
            [Label("Board Size"), self.size_field],
            [Label("Board Style"), self.style_choices],
            [Label("Highlight"), self.highlights],
            [Label("Show Grid"), self.show_grid],
        ])

        back = Button("Menu", action=shell.show_menu)
        save = Button("Save", action=self.save)

        contents = Column([grid, save, back])
        self.add_centered(contents)

        self.size_field.focus()
예제 #18
0
    def dispatch_key(self, name, event):
        Screen.dispatch_key(self, name, event)

        self.old_dir = self.dir

        if event.type == pygame.KEYDOWN and event.dict['key'] == pygame.K_UP:
            self.dir = 1
        if event.type == pygame.KEYDOWN and event.dict['key'] == pygame.K_DOWN:
            self.dir = -1
        if event.type == pygame.KEYUP and event.dict['key'] == pygame.K_UP:
            self.dir = 0
        if event.type == pygame.KEYUP and event.dict['key'] == pygame.K_DOWN:
            self.dir = 0

        grid = Grid([
            [Label("Width")],
            [Label("Height")],
            [Label("Shape")],
            [Label("Area")],
        ])
        contents = Column([grid])
        self.add(contents)
예제 #19
0
    def __init__(self, current_tick_time=0, **kwds):
        super(TimeEditor, self).__init__(**kwds)

        self._current_tick_time = current_tick_time
        self._current_time = self.fromTicks(self.doTimeAdjustment(self._current_tick_time))

        self.__original_value = current_tick_time
        self.__original_time = self._current_time

        self.last_pos = (None, None)

        self.day_input = IntField(value=self.__original_time[0], min=1)

        __deg = self.ticksToDegrees(current_tick_time)

        self.rot_image = RotatableImage(
            image=pygame.image.load(directories.getDataFile("toolicons", "day_night_cycle.png")),
            min_angle=-self._maxRotation,
            max_angle=0,
            angle=__deg
        )
        self.rot_image.mouse_drag = self.mouse_drag
        self.rot_image.mouse_up = self.mouse_up
        self.rot_image.tooltipText = "Left-Click and drag to the left or the right"

        self.time_field = ModifiedTimeField(
            value=(self.__original_time[1], self.__original_time[2]),
            callback=self._timeFieldCallback
        )
        # __time_field_old_value = self.time_field.value
        self.add(Column((
            Row((Label("Day: "), self.day_input)),
            self.rot_image,
            Row((Label("Time of day:"), self.time_field))
        ))
        )
        self.shrink_wrap()
예제 #20
0
    def __init__(self,
                 prompt=None,
                 suffixes=None,
                 default_suffix=None,
                 **kwds):
        Dialog.__init__(self, **kwds)
        label = None
        d = self.margin
        self.suffixes = suffixes or ("", )
        self.file_type = self.suffixes[0]  # To be removed
        self.compute_file_types()
        self.default_suffix = default_suffix  # The default file extension. Will be searched in 'suffixes'.
        up_button = Button(self.up_button_text, action=self.go_up)
        dir_box = DirPathView(self.box_width + 250, self)
        self.dir_box = dir_box
        top_row = Row([dir_box, up_button])
        list_box = FileListView(self.box_width - 16, self)
        self.list_box = list_box
        tree = FSTree(self, inner_width=250, directory='/')
        self.tree = tree
        row = Row((tree, list_box), margin=0)
        ctrls = [top_row, row]
        prompt = prompt or self.default_prompt
        if prompt:
            label = Label(prompt)
        if suffixes:
            filetype_label = Label("File type", width=250)

            def set_file_type():
                self.file_type = self.filetype_button.get_value(
                )  # To be removed
                self.compute_file_types(self.filetype_button.get_value())
                self.list_box.update()

            filetype_button = ChoiceButton(choices=self.suffixes,
                                           width=250,
                                           choose=set_file_type)
            if default_suffix:
                v = next((s for s in self.suffixes
                          if ("*.%s;" % default_suffix in s or "*.%s)" %
                              default_suffix in s)), None)
                if v:
                    filetype_button.selectedChoice = v
                    self.compute_file_types(v)
            self.filetype_button = filetype_button
        if self.saving:
            filename_box = TextFieldWrapped(self.box_width)
            filename_box.change_action = self.update_filename
            filename_box._enter_action = filename_box.enter_action
            filename_box.enter_action = self.enter_action
            self.filename_box = filename_box
            if suffixes:
                ctrls.append(
                    Row([
                        Column([label, filename_box], align='l', spacing=0),
                        Column([filetype_label, filetype_button],
                               align='l',
                               spacing=0)
                    ], ))
            else:
                ctrls.append(
                    Column([label, filename_box], align='l', spacing=0))
        else:
            if label:
                ctrls.insert(0, label)
            if suffixes:
                ctrls.append(
                    Column([filetype_label, filetype_button],
                           align='l',
                           spacing=0))
        ok_button = Button(self.ok_label,
                           action=self.ok,
                           enable=self.ok_enable)
        self.ok_button = ok_button
        cancel_button = Button("Cancel", action=self.cancel)
        vbox = Column(ctrls, align='l', spacing=d)
        vbox.topleft = (d, d)
        y = vbox.bottom + d
        ok_button.topleft = (vbox.left, y)
        cancel_button.topright = (vbox.right, y)
        self.add(vbox)
        self.add(ok_button)
        self.add(cancel_button)
        self.shrink_wrap()
        self._directory = None
        self.directory = os.getcwd()
        # print "FileDialog: cwd =", repr(self.directory) ###
        if self.saving:
            filename_box.focus()
예제 #21
0
    def __init__(self, prompt=None, suffixes=None, default_suffix=None, **kwds):
        Dialog.__init__(self, **kwds)
        label = None
        d = self.margin
        self.suffixes = suffixes or ("",)
        self.file_type = self.suffixes[0] # To be removed
        self.compute_file_types()
        self.default_suffix = default_suffix  # The default file extension. Will be searched in 'suffixes'.
        up_button = Button(self.up_button_text, action=self.go_up)
        dir_box = DirPathView(self.box_width + 250, self)
        self.dir_box = dir_box
        top_row = Row([dir_box, up_button])
        list_box = FileListView(self.box_width - 16, self)
        self.list_box = list_box
        tree = FSTree(self, inner_width=250, directory='/')
        self.tree = tree
        row = Row((tree, list_box), margin=0)
        ctrls = [top_row, row]
        prompt = prompt or self.default_prompt
        if prompt:
            label = Label(prompt)
        if suffixes:
            filetype_label = Label("File type", width=250)

            def set_file_type():
                self.file_type = self.filetype_button.get_value() # To be removed
                self.compute_file_types(self.filetype_button.get_value())
                self.list_box.update()

            filetype_button = ChoiceButton(choices=self.suffixes, width=250, choose=set_file_type)
            if default_suffix:
                v = next((s for s in self.suffixes if ("*.%s;"%default_suffix in s or "*.%s)"%default_suffix in s)), None)
                if v:
                    filetype_button.selectedChoice = v
                    self.compute_file_types(v)
            self.filetype_button = filetype_button
        if self.saving:
            filename_box = TextFieldWrapped(self.box_width)
            filename_box.change_action = self.update_filename
            filename_box._enter_action = filename_box.enter_action
            filename_box.enter_action = self.enter_action
            self.filename_box = filename_box
            if suffixes:
                ctrls.append(Row([Column([label, filename_box], align='l', spacing=0),
                                  Column([filetype_label, filetype_button], align='l', spacing=0)
                                  ],
                                 )
                             )
            else:
                ctrls.append(Column([label, filename_box], align='l', spacing=0))
        else:
            if label:
                ctrls.insert(0, label)
            if suffixes:
                ctrls.append(Column([filetype_label, filetype_button], align='l', spacing=0))
        ok_button = Button(self.ok_label, action=self.ok, enable=self.ok_enable)
        self.ok_button = ok_button
        cancel_button = Button("Cancel", action=self.cancel)
        vbox = Column(ctrls, align='l', spacing=d)
        vbox.topleft = (d, d)
        y = vbox.bottom + d
        ok_button.topleft = (vbox.left, y)
        cancel_button.topright = (vbox.right, y)
        self.add(vbox)
        self.add(ok_button)
        self.add(cancel_button)
        self.shrink_wrap()
        self._directory = None
        self.directory = os.getcwdu()
        #print "FileDialog: cwd =", repr(self.directory) ###
        if self.saving:
            filename_box.focus()