コード例 #1
0
    def __init__(self):
        Window.__init__(self)

        from tts_interface import (word_voice_model, words_voice_model,
                                   tts_interface)
        from dict_interface import (source_lang_model, dest_lang_model,
                                    word_translate_model,
                                    words_translate_model, dict_interface)

        self.qml_context.setContextProperty("dictInterface", dict_interface)
        self.qml_context.setContextProperty("ttsIntreface", tts_interface)
        self.qml_context.setContextProperty("sourceLangModel",
                                            source_lang_model)
        self.qml_context.setContextProperty("destLangModel", dest_lang_model)
        self.qml_context.setContextProperty("wordTranslateModel",
                                            word_translate_model)
        self.qml_context.setContextProperty("wordsTranslateModel",
                                            words_translate_model)
        self.qml_context.setContextProperty("wordVoiceModel", word_voice_model)
        self.qml_context.setContextProperty("wordsVoiceModel",
                                            words_voice_model)
        self.qml_context.setContextProperty("screenWidth", screen_width)
        self.qml_context.setContextProperty("screenHeight", screen_height)
        self.qml_context.setContextProperty("windowView", self)
        self.qml_context.setContextProperty("settingConfig", setting_config)
        self.setSource(
            QtCore.QUrl.fromLocalFile(
                os.path.join(get_parent_dir(__file__), 'SettingView.qml')))
コード例 #2
0
ファイル: slider.py プロジェクト: masums/deepin-ui
    def __init__(
        self,
        slider_files,
        pointer_files,
        button_files,
        show_button=True,
        finish_callback=None,
        slide_delay=8000,
    ):
        '''
        Initialize Wizard class.

        @param slider_files: The slider image files.
        @param pointer_files: The pointer image files.
        @param button_files: The button image files.
        @param show_button: if True will at last page show start button.
        @param finish_callback: The callback call when slider finish, this callback don't need input argument, default is None.
        @param slide_delay: The delay between slider images, default is 8000ms.
        '''
        Window.__init__(self)
        self.finish_callback = finish_callback

        self.set_position(gtk.WIN_POS_CENTER)
        self.set_resizable(False)
        self.wizard_box = WizardBox(slider_files, pointer_files, button_files,
                                    show_button, slide_delay)
        self.wizard_box.connect("close", lambda widget: self.destroy())
        self.connect("destroy", self.destroy_wizard)
        self.window_frame.add(self.wizard_box)
        self.add_move_event(self.wizard_box)
コード例 #3
0
ファイル: slider.py プロジェクト: Jiarui315/deepin-ui
 def __init__(self, 
              slider_files, 
              pointer_files, 
              button_files,
              show_button=True,
              finish_callback=None, 
              slide_delay=8000,
              ):
     '''
     Initialize Wizard class.
     
     @param slider_files: The slider image files.
     @param pointer_files: The pointer image files.
     @param button_files: The button image files.
     @param show_button: if True will at last page show start button.
     @param finish_callback: The callback call when slider finish, this callback don't need input argument, default is None.
     @param slide_delay: The delay between slider images, default is 8000ms.
     '''
     Window.__init__(self)
     self.finish_callback = finish_callback
     
     self.set_position(gtk.WIN_POS_CENTER)
     self.set_resizable(False)
     self.wizard_box = WizardBox(slider_files, pointer_files, button_files, show_button, slide_delay)
     self.wizard_box.connect("close", lambda widget: self.destroy())
     self.connect("destroy", self.destroy_wizard)
     self.window_frame.add(self.wizard_box)
     self.add_move_event(self.wizard_box)
コード例 #4
0
ファイル: mapgenerate.py プロジェクト: jefdaj/wikidust
 def __init__(self):
     global MAPGENERATOR_ACTIVE
     if MAPGENERATOR_ACTIVE:
         raise Exception("Can't run more than one MapGenerator instance at a time")
     else: #this is the only instance
         MAPGENERATOR_ACTIVE = True
         try:
             Window.__init__(self)
             #create Tkinter Variables
             self.name        = StringVar(self, value=IMAGEMAP_NAME)
             self.size        = (DoubleVar(self, value=IMAGEMAP_SIZE[0]),
                                 DoubleVar(self, value=IMAGEMAP_SIZE[1]))
             self.destination = StringVar(self, value=IMAGEMAP_DESTINATION)
             self.codeType    = StringVar(self, value=IMAGEMAP_CODETYPE)
             #create controls
             imageControls = self.ImageControls(self, self.name, self.size)
             codeControls = self.CodeControls(self, self.destination, self.codeType)
             buttons = self.MapButtons(self)
             buttons.closeButton.config(command=self.destroy)
             buttons.generateButton.config(command=self.generate)
             imageControls.pack(pady=2, side=TOP)
             codeControls.pack(pady=2, side=TOP)
             buttons.pack(side=BOTTOM, padx=2, pady=2)
             #tweak window
             self.title("Create Map")
             self.geometry(MAPGENERATOR_GEOMETRY)
             self.resizable(False, False)
             # display everything
             self.update_idletasks()
             self.focus_force()
             self.mainloop()
         except:
             raise
         finally:
             MAPGENERATOR_ACTIVE = False
コード例 #5
0
ファイル: main.py プロジェクト: hugoruscitti/pybox
 def __init__(self):
     Window.__init__(self, 'main.glade')
     self._create_canvas()
     self._create_status_bar()
     self._create_history()
     self.view.main.set_size_request(450, 300)
     self.view.main.show()
コード例 #6
0
 def __init__(self, x, y, width, height ):
     Window.__init__(self, x, y, width, height )
     
     Visettings.BoardX = (width-2)/2
     Visettings.BoardY = (height-2)/2
     
     self.setupPieces()
コード例 #7
0
    def __init__(self, size, caption=None, win=None):
        Window.__init__(self, size, caption, win)
        self.background = GameData.image(GET_NAME_BGD_IMG)

        button_image = GameData.image(BUTTON_IMG)
        self.ok_button = Button(GN_OK_BTN_POS, button_image, self.buttons)

        self.return_data = "NO NAME"
コード例 #8
0
 def __init__(self, parent, title, top_left, w, h):
     #assert(parent is not None)
     #assert(isinstance(parent, (AppWindow)))
     #assert(isinstance(top_left, Point))
     if parent is None or not isinstance(parent, Container):
     	raise BadArgumentError("Expecting a valid parent window")
     
     Window.__init__(self, parent, title, top_left, w, h)
コード例 #9
0
ファイル: shape_window.py プロジェクト: Bredgren/Fractals
    def __init__(self, main, x, y, width, height=0):
        Window.__init__(self, main, x, y, width, height)
        self.grid_size = 10
        self.grid_visible = True
        self.selected_point = None
        self.snap_to_grid = False

        self.shape = Shape()
コード例 #10
0
ファイル: dialog.py プロジェクト: netphi/deepin-ui
    def __init__(self, title, default_width=None, default_height=None, mask_type=None, 
                 close_callback=None,
                 modal=True,
                 window_hint=gtk.gdk.WINDOW_TYPE_HINT_DIALOG,
                 window_pos=None,
                 skip_taskbar_hint=True,
                 resizable=False):
        '''Dialog box.'''
        Window.__init__(self, resizable)
        self.default_width = default_width
        self.default_height = default_height
        self.mask_type = mask_type
        
        if window_pos:
            self.set_position(window_pos)
        self.set_modal(modal)                                # grab focus to avoid build too many skin window
        if window_hint:
            self.set_type_hint(window_hint)
        self.set_skip_taskbar_hint(skip_taskbar_hint) # skip taskbar
        if self.default_width != None and self.default_height != None:
            self.set_default_size(self.default_width, self.default_height)
            
            if not resizable:
                self.set_geometry_hints(None, self.default_width, self.default_height, -1, -1, -1, -1, -1, -1, -1, -1)
            
        self.padding_left = 2
        self.padding_right = 2

        self.titlebar = Titlebar(
            ["close"],
            None,
            title)
        self.add_move_event(self.titlebar)
        self.body_box = gtk.VBox()
        self.body_align = gtk.Alignment()
        self.body_align.set(0.5, 0.5, 1, 1)
        self.body_align.set_padding(0, 0, self.padding_left, self.padding_right)
        self.body_align.add(self.body_box)
        self.button_box = gtk.HBox()
        self.left_button_box = DialogLeftButtonBox()
        self.right_button_box = DialogRightButtonBox()

        self.button_box.pack_start(self.left_button_box, True, True)
        self.button_box.pack_start(self.right_button_box, True, True)
        
        self.window_frame.pack_start(self.titlebar, False, False)
        self.window_frame.pack_start(self.body_align, True, True)
        self.window_frame.pack_start(self.button_box, False, False)

        if close_callback:
            self.titlebar.close_button.connect("clicked", lambda w: close_callback())
            self.connect("destroy", lambda w: close_callback())
        else:
            self.titlebar.close_button.connect("clicked", lambda w: self.destroy())
            self.connect("destroy", lambda w: self.destroy())
        
        self.draw_mask = self.get_mask_func(self, 1, 1, 0, 1)
コード例 #11
0
ファイル: classlist.py プロジェクト: hugoruscitti/pybox
 def __init__(self, classes, selected_classes):
     """
     Params:
         `classes`: list of strings with all class names.
         `selected_classes`: list of strings with selected classes.
     """
     Window.__init__(self, 'classlist.glade')
     self._create_list()
     self._populate_model(classes, selected_classes)
     self.view.classlist.set_default_size(300, 300)
コード例 #12
0
 def __init__(self, parent, maze, moves, width):
     Window.__init__(self, parent)
     Frame.__init__(self, parent, background = "white")
     self.maze = maze
     self.canvas = Canvas(self)
     self.queue = moves
     self.delay = DELAY
     self.size = get_size(self.maze, width)
     #self.photo = PhotoImage(file = "mouse.gif")
     self.init_ui()
コード例 #13
0
ファイル: combat.py プロジェクト: keltoff/Eratica
    def __init__(self, hero, monster):
        Window.__init__(self, pygame.Rect((200, 200), (400, 300)))

        close_bt = gui.Button(pygame.Rect(360, 10, 30, 30), pygame.Color('red'))
        close_bt.click = lambda a, b: self.close()
        self.add(close_bt)

        self.add(gui.Label((100, 50), 'Round 1: Fight!', pygame.Color('green')))
        self.add(gui.Label((50, 100), hero.character_class, pygame.Color('azure')))
        self.add(gui.Label((250, 100), monster.type, pygame.Color('red')))
コード例 #14
0
ファイル: classview.py プロジェクト: hugoruscitti/pybox
    def __init__(self, model, classes):
        Window.__init__(self, 'class.glade')
        self.model = model
        self.classes = classes
        self._populate_ui()

        self._change_selection_mode()

        self._create_superclass_list(classes)
        self._select_model_superclass()
        self.load_attributes()
コード例 #15
0
ファイル: layout_window.py プロジェクト: Bredgren/Fractals
    def __init__(self, main, x, y, width, height=0):
        Window.__init__(self, main, x, y, width, height)
        self.grid_size = 10
        self.grid_visible = True
        self.selected_stamp = None
        self.snap_to_grid = False
        self.keep_current_ratio = False
        self.keep_original_ratio = False

        self.layout = Layout(self.main.shape_window.shape)
        self.colors = [pygame.Color('white')] * 10
コード例 #16
0
    def __init__(self,
                 other,
                 id=wx.ID_ANY,
                 title=None,
                 pos=None,
                 size=None,
                 name=None):
        Window.__init__(self, other, id, pos, size, name)

        if title:
            self.SetTitle(title)
コード例 #17
0
    def __init__(self, res):

        Window.__init__(self, [0, 30], res[0], 40)
        self.bg = VerticalGradient([0, 0], self.width, self.height,
                                   (200, 200, 200), (120, 120, 120))
        self.addObject(self.bg)
        self.buttonNewRule = ButtonNewRule([3, 3])
        self.addObject(self.buttonNewRule)
        self.buttonNewCondition = ButtonNewCondition([100, 3])
        self.addObject(self.buttonNewCondition)
        self.buttonExport = ButtonExport([250, 3])
        self.addObject(self.buttonExport)
コード例 #18
0
ファイル: fractal_window.py プロジェクト: Bredgren/Fractals
 def __init__(self, main, x, y, width, height=0):
     Window.__init__(self, main, x, y, width, height)
     self.shape = self.main.shape_window.shape
     self.layout = self.main.layout_window.layout
     self.check_point = None
     # This is the maximum number of milliseconds that this window has
     # to draw during each frame. If the time is exceeded it remembers
     # where it was and resumes in the next frame.
     self.time_limit = 50
     self.end_time = 0
     self.min_line_size = 0.05
     self.colors = self.main.layout_window.colors
コード例 #19
0
ファイル: main.py プロジェクト: dreadpiratepj/Sabel
 def __init__(self, parent=None):
     Window.__init__(self, parent)
     # Important must be empty this is a reference
     self.files = []
     self.projects = None
     self.recent = None
     self.dirty = None
     self.isFull = False
     self.adb = Adb(self)
     self.parser = Parser(self)
     self.command = Command(self)
     self.init()
コード例 #20
0
ファイル: textbox.py プロジェクト: amoghbl1/itws2
 def __init__(self, parent, title, top_left, w, h):
     assert(parent is not None)
     """
     try:
         assert(isinstance(parent, (AppWindow)))
     except AssertionError:
         raise BadArgumentError("Expecting an AppWindow as parent")
     """
     assert(isinstance(top_left, Point))
     if parent is None or not isinstance(parent, Container):
     	raise BadArgumentError("Expecting a valid parent window")
     self.text=""
     Window.__init__(self, parent, title, top_left, w, h)
コード例 #21
0
    def __init__(self):
        Window.__init__(self)
        mixer.music.load(music["song1"])
        mixer.music.play(-1)

        self.collision_list = []

        self.ship = SpaceShip(self)
        self.camera.set_target(self.ship)
        self.camera.offset = (-value["init.half_width"],
                              -value["init.half_height"])
        self.create(StarrySky(self))

        self.system = system = load_system(_systems_path + "sol.sys")
        box = Box(system.system, self)
        box.update()
        #self.add_gui(box)
        #None will be replaced with self after fully implemented.
        self.add_gui(InfoBlock(None))
        self.weapon_bar = WeaponBar(self.ship)
        self.add_gui(self.weapon_bar)

        self.weapon_bar.weapon_slot[0] = weapon.BasicKineticWeapon()
        self.weapon_bar.weapon_slot[1] = weapon.TripleBasicKineticWeapon()
        self.weapon_bar.select(0)
        self.weapon_bar.update()

        self.health_bar = HealthBar(self.ship)
        self.health_bar.update()
        self.add_gui(self.health_bar)

        self.minimap = MiniMap(self.ship, self.system)
        self.add_gui(self.minimap)

        self.item_bar = ItemBar(self.ship)
        self.item_bar.update()
        self.add_gui(self.item_bar)

        self.update_gui()

        for p in system.system_dict.values():
            self.create(p)

        belt = planets.AsteroidBelt(system.get_planet("sol"),
                                    "data/systems/asteroid_belt.txt")
        self.create(belt)

        self.ship.position = 22000 * cos(0), 17000

        # self.update_list.append(Enemy_Spawner.Spawner())
        self.create(self.ship)
コード例 #22
0
ファイル: mainwindow.py プロジェクト: pyros2097/SabelIDE
    def __init__(self, parent = None):
        Window.__init__(self,parent)
	#Important must be empty this is a reference
        self.files = []
        self.recent = None
        self.dirty = None
        self.isFull = False
        self.adb = Adb(self)
        self.parser = Parser(self)
        self.command = Command(self)
        self.ant = Ant(self)
        config.setAscii() #Added to reprimand Unicode
        self.updater = update.Updater(self)
        self.update()
コード例 #23
0
    def __init__(self, size, caption=None):
        Window.__init__(self, size, 'OmniTank Menu')
        self.background = GameData.image(MAIN_BGD_IMG)

        button_image = GameData.image(BUTTON_IMG)
        self.start_button = Button(MM_START_BTN_POS, button_image, self.buttons)
        self.instructions_button = Button(MM_INSTUC_BTN_POS, button_image, self.buttons)
        self.highscores_button = Button(MM_SCORES_BTN_POS, button_image, self.buttons)
        self.quit_button = Button(MM_QUIT_BTN_POS, button_image, self.buttons)

        self.instructions_window = InstructionsWindow(size, 'OmniTank Instructions', self)
        self.high_scores_window = HighScoresWindow(size, 'OmniTank High Scores', self)
        #self.color_choice_window = ColorChoiceWindow(size, 'OmniTank Color Choice', self)

        GameData.setMusicVolume(MUSIC_VOLUME)
        GameData.startMusic(BGD_MUSIC)
コード例 #24
0
    def __init__(self):
        Window.__init__(self,"Exit",(36, 107, 97),(52, 52, 119),0,0,400,100,(255,255,255),200)
        text = Text(fonts.BebasNeue.c20,"do you want to quit?",(255,255,255))
        text.x = self.width/2-text.surface.get_size()[0]/2
        text.y = 30
        self.AddElement(text,"Text")

        buttonExit = AcceptButton("Yes",100)
        buttonExit.y = 60
        buttonExit.x = self.width/4*3 - buttonExit.imageA.get_size()[0]/2
        self.AddElement(buttonExit,"Exit")

        buttonContinue = RejectButton("No",100)
        buttonContinue.y = 60
        buttonContinue.x = self.width/4 - buttonContinue.imageA.get_size()[0]/2
        self.AddElement(buttonContinue,"NoQuit")
コード例 #25
0
    def __init__(self, res):

        Window.__init__(self, [0, 0], res[0], 30)
        self.bg = VerticalGradient([0, 0], self.width, self.height,
                                   (255, 255, 255), (120, 120, 120))
        self.addObject(self.bg)

        self.icon = Image([3, 3], pygame.image.load("res/icon.png"))
        self.addObject(self.icon)
        self.title = Text([34, 3],
                          "Overwatch Visual Scripting Editor - Untitled",
                          size=28,
                          color=(0, 0, 0))
        self.addObject(self.title)

        self.buttonClose = ButtonClose([self.width - 65, 4], 50, 20)
        self.addObject(self.buttonClose)
コード例 #26
0
 def __init__(self, parent, network):
     Window.__init__(self, None)
     self.network=network
     self.artist= self._edit("Digite o artista")
     self.title= self._edit("Digite o nome da música")
     self.album= self._edit("Digite o álbum(opcional)")
     self.tmlist= self._combobox("", timescrobble)
     self.tmlist.Bind(wx.EVT_COMBOBOX, self.OnCombobox)
     self.now=datetime.datetime.now()
     self.tmlist.SetSelection(1)
     self.day=self._edit("Dia")
     self.day.Hide()
     self.hour=self._edit("Hora")
     self.hour.Hide()
     self.minute=self._edit("Minuto")
     self.minute.Hide()
     self._button("&Scrobble", self._do_scrobble)
     self._button("&Fechar", self.OnExit)
コード例 #27
0
    def __init__(self):
        Window.__init__(self, "Exit", (36, 107, 97), (52, 52, 119), 0, 0, 400,
                        100, (255, 255, 255), 200)
        text = Text(fonts.BebasNeue.c20, "do you want to quit?",
                    (255, 255, 255))
        text.x = self.width / 2 - text.surface.get_size()[0] / 2
        text.y = 30
        self.AddElement(text, "Text")

        buttonExit = AcceptButton("Yes", 100)
        buttonExit.y = 60
        buttonExit.x = self.width / 4 * 3 - buttonExit.imageA.get_size()[0] / 2
        self.AddElement(buttonExit, "Exit")

        buttonContinue = RejectButton("No", 100)
        buttonContinue.y = 60
        buttonContinue.x = self.width / 4 - buttonContinue.imageA.get_size(
        )[0] / 2
        self.AddElement(buttonContinue, "NoQuit")
コード例 #28
0
 def __init__(self):
     Window.__init__(self, None)
     self.username= self._edit("Digite seu nome de usuário")
     self.password_shown= False
     self.text_password= self._edit("Digite sua senha", tpassword=True)
     if os.path.isfile("login.cfg"):
         with open("login.cfg", 'r') as arq:
             try:
                 line=arq.readline().split()
                 self.username.SetValue(line[0])
                 self.text_password.SetValue(line[1])
             except:
                 pass
     self.text_no_password=self._edit("Digite sua senha")
     self.text_no_password.Hide()
     self.checkbox= self._checkbox("Mostrar senha")
     self.checkbox.Bind(wx.EVT_CHECKBOX,self.OnCheckbox)
     self.login=self._button("&Login", self._login)
     self._button("&Fechar", self.OnExit)
コード例 #29
0
ファイル: popup_window.py プロジェクト: netphi/deepin-ui
 def __init__(self, parent_widget=None, widget=None, x=None, y=None):
     '''Init PopupWindow.'''        
     Window.__init__(self)
     
     # Init Window.
     self.set_position(gtk.WIN_POS_MOUSE)
     self.set_modal(True)
     self.set_size_request(200,300)
     
     self.main_box = gtk.VBox()
     self.titlebar = Titlebar(["close"])
     self.titlebar.close_button.connect("clicked", lambda w: self.destroy())
     self.scrolled_align  = gtk.Alignment()
     self.scrolled_align.set(0.0, 0.0, 1.0, 1.0)
     self.scrolled_window = ScrolledWindow(gtk.POLICY_NEVER)
     self.scrolled_align.add(self.scrolled_window)
     self.scrolled_align.set_padding(10, 10, 10, 10)
     
     if widget:
         self.scrolled_window.add_child(widget)
     else:
         self.buffer = gtk.TextBuffer()
         self.text_view = gtk.TextView(self.buffer)
         self.buffer.set_text("Linux Deepin")
         self.scrolled_window.add_child(self.text_view)
         
     if x and y:
         self.move(x, y)
         
     self.titlebar.drag_box.connect('button-press-event', lambda w, e: move_window(w, e, self))
         
     if parent_widget:
         self.connect("show", lambda w:self.show_window(w, parent_widget))
         
     self.main_box = gtk.VBox()
     self.main_box.pack_start(self.titlebar, False, False)
     self.main_box.pack_start(self.scrolled_align, True, True)
     
     self.window_frame.add(self.main_box)
     
     self.show_all()
コード例 #30
0
    def __init__(self):
        Window.__init__(self)
    
        from tts_interface import (word_voice_model, words_voice_model, tts_interface)
        from dict_interface import (source_lang_model, dest_lang_model, 
                                    word_translate_model, words_translate_model,
                                    dict_interface)

        self.qml_context.setContextProperty("dictInterface", dict_interface)
        self.qml_context.setContextProperty("ttsIntreface", tts_interface)
        self.qml_context.setContextProperty("sourceLangModel", source_lang_model)
        self.qml_context.setContextProperty("destLangModel", dest_lang_model)
        self.qml_context.setContextProperty("wordTranslateModel", word_translate_model)
        self.qml_context.setContextProperty("wordsTranslateModel", words_translate_model)
        self.qml_context.setContextProperty("wordVoiceModel", word_voice_model)
        self.qml_context.setContextProperty("wordsVoiceModel", words_voice_model)
        self.qml_context.setContextProperty("screenWidth", screen_width)
        self.qml_context.setContextProperty("screenHeight", screen_height)
        self.qml_context.setContextProperty("windowView", self)
        self.qml_context.setContextProperty("settingConfig", setting_config)
        self.setSource(QtCore.QUrl.fromLocalFile(os.path.join(get_parent_dir(__file__), 'SettingView.qml')))
コード例 #31
0
 def __init__(self):
     global MAPGENERATOR_ACTIVE
     if MAPGENERATOR_ACTIVE:
         raise Exception(
             "Can't run more than one MapGenerator instance at a time")
     else:  #this is the only instance
         MAPGENERATOR_ACTIVE = True
         try:
             Window.__init__(self)
             #create Tkinter Variables
             self.name = StringVar(self, value=IMAGEMAP_NAME)
             self.size = (DoubleVar(self, value=IMAGEMAP_SIZE[0]),
                          DoubleVar(self, value=IMAGEMAP_SIZE[1]))
             self.destination = StringVar(self, value=IMAGEMAP_DESTINATION)
             self.codeType = StringVar(self, value=IMAGEMAP_CODETYPE)
             #create controls
             imageControls = self.ImageControls(self, self.name, self.size)
             codeControls = self.CodeControls(self, self.destination,
                                              self.codeType)
             buttons = self.MapButtons(self)
             buttons.closeButton.config(command=self.destroy)
             buttons.generateButton.config(command=self.generate)
             imageControls.pack(pady=2, side=TOP)
             codeControls.pack(pady=2, side=TOP)
             buttons.pack(side=BOTTOM, padx=2, pady=2)
             #tweak window
             self.title("Create Map")
             self.geometry(MAPGENERATOR_GEOMETRY)
             self.resizable(False, False)
             # display everything
             self.update_idletasks()
             self.focus_force()
             self.mainloop()
         except:
             raise
         finally:
             MAPGENERATOR_ACTIVE = False
コード例 #32
0
 def __init__(self, x, y, game):
     Window.__init__( self, x, y, 200, 2) 
     
     Visettings.Speed = -1
     
     if Visettings.AutoEnd :
         Visettings.CurrentMode = VISMODE.PLAY
     else:
         Visettings.CurrentMode = VISMODE.PAUSE
     
     Visettings.MaxX = game.states[0].boardX-1
     Visettings.MaxY = game.states[0].boardY-1
     
     Visettings.Player1Name = game.getName(0)
     Visettings.Player2Name = game.getName(0)
     
     Visettings.Game = game
     
     self.Window.erase()
     self.Window.refresh()
     
     self.moveWindow( x, Visettings.MaxY*2+4 )
     
     self.score = Scoreboard( x+Visettings.MaxX*2+5, y, 31, Visettings.MaxY*2+4 )
     self.gameboard = Gameboard( x, y, Visettings.MaxX*2+4, Visettings.MaxY*2+4 )
     self.plantInfo = Plantinfo( x+Visettings.MaxX*2+5+31, y, 32, Visettings.MaxY+1 )
     self.minimap = Minimap( \
     x+Visettings.MaxX*2+5+31+30/2 - Visettings.MaxX/2, \
     Visettings.MaxY+1, \
     Visettings.MaxX+3, \
     Visettings.MaxY+3 )
     
     Visettings.CurX = 0
     Visettings.CurY = 0
     
     self.Window.erase()
コード例 #33
0
ファイル: menu.py プロジェクト: netphi/deepin-ui
 def __init__(self, items, 
              is_root_menu=False,
              select_scale=False,
              x_align=ALIGN_START,
              y_align=ALIGN_START,
              font_size=DEFAULT_FONT_SIZE, 
              padding_x=3, 
              padding_y=3, 
              item_padding_x=6, 
              item_padding_y=3,
              shadow_visible=True,
              menu_min_width=130):
     '''Init menu, item format: (item_icon, itemName, item_node).'''
     global root_menus
     
     # Init.
     Window.__init__(self, shadow_visible=shadow_visible, window_type=gtk.WINDOW_POPUP)
     self.set_can_focus(True) # can focus to response key-press signal
     self.draw_mask = self.draw_menu_mask
     self.is_root_menu = is_root_menu
     self.select_scale = select_scale
     self.x_align = x_align
     self.y_align = y_align
     self.submenu = None
     self.root_menu = None
     self.offset_x = 0       # use for handle extreme situaiton, such as, menu show at side of screen
     self.offset_y = 0
     self.padding_x = padding_x
     self.padding_y = padding_y
     self.item_padding_x = item_padding_x
     self.item_padding_y = item_padding_y
     self.menu_min_width = menu_min_width
     
     # Init menu window.
     self.set_skip_pager_hint(True)
     self.set_skip_taskbar_hint(True)
     self.set_keep_above(True)
     
     # Add menu item.
     self.item_box = gtk.VBox()
     self.item_align = gtk.Alignment()
     self.item_align.set_padding(padding_y, padding_y, padding_x, padding_x)
     self.item_align.add(self.item_box)
     self.window_frame.add(self.item_align)
     self.menu_items = []
     
     if items:
         (icon_width, icon_height, have_submenu, submenu_width, submenu_height) = self.get_menu_icon_info(items)
         
         for item in items:
             menu_item = MenuItem(
                 item, font_size, self.select_scale, self.show_submenu, self.hide_submenu, 
                 self.get_root_menu, self.get_menu_items,
                 icon_width, icon_height,
                 have_submenu, submenu_width, submenu_height,
                 padding_x, padding_y,
                 item_padding_x, item_padding_y, self.menu_min_width)
             self.menu_items.append(menu_item)
             self.item_box.pack_start(menu_item.item_box, False, False)
             
     self.connect("show", self.init_menu)
     self.connect("hide", self.hide_menu)
     self.connect("realize", self.realize_menu)
コード例 #34
0
    def __init__(self, size, caption=None, win=None):
        Window.__init__(self, size, caption, win)
        self.background = GameData.image(INSTRUCTIONS_BGD_IMG)

        button_image = GameData.image(BUTTON_IMG)
        self.main_menu_button = Button(I_RETURN_BTN_POS, button_image, self.buttons)
コード例 #35
0
ファイル: poplist.py プロジェクト: chenzhiwei/deepin-ui
    def __init__(self,
                 items,
                 min_width=80,
                 max_width=None,
                 fixed_width=None,
                 min_height=100,
                 max_height=None,
                 shadow_visible=True,
                 shape_frame_function=None,
                 expose_frame_function=None,
                 x_align=ALIGN_START,
                 y_align=ALIGN_START,
                 align_size=0,
                 grab_window=None,
                 window_type=gtk.WINDOW_TOPLEVEL,
                 ):
        '''
        Initialize Poplist class.

        @param items: The item list to initialize.
        @param min_width: The minimum width of poplist, default is 80 pixels.
        @param max_width: The maximum width of poplist, default is None.
        @param fixed_width: The fixed width of poplist, default is None.
        @param min_height: The minimum height of poplist, default is 100 pixels.
        @param max_height: The maximum height of poplist, default is None.
        @param shadow_visible: Set it with True to make shadow visible.
        @param shape_frame_function: The function to shape frame.
        @param expose_frame_function: The function to draw frame.
        @param x_align: The horizontal alignment value, default is ALIGN_START.
        @param y_align: The vertical alignment value, default is ALIGN_START.
        @param align_size: The alignment size, default is 0.
        @param grab_window: Window to handle grab event, default is None that use poplist_grab_window.
        @param window_type: The type of window, default is gtk.WINDOW_TOPLEVEL.
        '''
        # Init.
        Window.__init__(self,
                        shadow_visible=shadow_visible,
                        window_type=window_type,
                        shape_frame_function=shape_frame_function,
                        expose_frame_function=expose_frame_function)
        self.max_height = max_height
        self.min_height = min_height
        self.x_align = x_align
        self.y_align = y_align
        self.min_width = min_width
        self.max_width = max_width
        self.fixed_width = fixed_width
        self.align_size = align_size
        self.window_width = self.window_height = 0
        self.treeview_align = gtk.Alignment()
        self.treeview_align.set(1, 1, 1, 1)
        self.treeview_align.set_padding(self.align_size, self.align_size, self.align_size, self.align_size)
        self.treeview = TreeView(items,
                                 enable_highlight=False,
                                 enable_multiple_select=False,
                                 enable_drag_drop=False)

        # Connect widgets.
        self.treeview_align.add(self.treeview)
        self.window_frame.pack_start(self.treeview_align, True, True)

        self.connect("realize", self.realize_poplist)

        # Wrap self in poup grab window.
        if grab_window:
            wrap_grab_window(grab_window, self)
        else:
            wrap_grab_window(poplist_grab_window, self)
コード例 #36
0
ファイル: panel.py プロジェクト: tamires-consulting/medipy
 def __init__(self, other, id=wx.ID_ANY, pos=None, size=None, name=None):
     Window.__init__(self, other, id, pos, size, name)
コード例 #37
0
    def __init__(
        self,
        items,
        min_width=80,
        max_width=None,
        fixed_width=None,
        min_height=100,
        max_height=None,
        shadow_visible=True,
        shape_frame_function=None,
        expose_frame_function=None,
        x_align=ALIGN_START,
        y_align=ALIGN_START,
        align_size=0,
        grab_window=None,
        window_type=gtk.WINDOW_TOPLEVEL,
    ):
        '''
        Initialize Poplist class.

        @param items: The item list to initialize.
        @param min_width: The minimum width of poplist, default is 80 pixels.
        @param max_width: The maximum width of poplist, default is None.
        @param fixed_width: The fixed width of poplist, default is None.
        @param min_height: The minimum height of poplist, default is 100 pixels.
        @param max_height: The maximum height of poplist, default is None.
        @param shadow_visible: Set it with True to make shadow visible.
        @param shape_frame_function: The function to shape frame.
        @param expose_frame_function: The function to draw frame.
        @param x_align: The horizontal alignment value, default is ALIGN_START.
        @param y_align: The vertical alignment value, default is ALIGN_START.
        @param align_size: The alignment size, default is 0.
        @param grab_window: Window to handle grab event, default is None that use poplist_grab_window.
        @param window_type: The type of window, default is gtk.WINDOW_TOPLEVEL.
        '''
        # Init.
        Window.__init__(self,
                        shadow_visible=shadow_visible,
                        window_type=window_type,
                        shape_frame_function=shape_frame_function,
                        expose_frame_function=expose_frame_function)
        self.max_height = max_height
        self.min_height = min_height
        self.x_align = x_align
        self.y_align = y_align
        self.min_width = min_width
        self.max_width = max_width
        self.fixed_width = fixed_width
        self.align_size = align_size
        self.window_width = self.window_height = 0
        self.treeview_align = gtk.Alignment()
        self.treeview_align.set(1, 1, 1, 1)
        self.treeview_align.set_padding(self.align_size, self.align_size,
                                        self.align_size, self.align_size)
        self.treeview = TreeView(items,
                                 enable_highlight=False,
                                 enable_multiple_select=False,
                                 enable_drag_drop=False)

        # Connect widgets.
        self.treeview_align.add(self.treeview)
        self.window_frame.pack_start(self.treeview_align, True, True)

        self.connect("realize", self.realize_poplist)

        # Wrap self in poup grab window.
        if grab_window:
            wrap_grab_window(grab_window, self)
        else:
            wrap_grab_window(poplist_grab_window, self)
コード例 #38
0
ファイル: settings.py プロジェクト: hugoruscitti/pybox
 def __init__(self):
     Window.__init__(self, 'settings.glade')
     self.view.image2.set_from_file('../pixmaps/classic.png')
     self.view.image3.set_from_file('../pixmaps/round.png')
コード例 #39
0
    def __init__(self,
                 title,
                 default_width=None,
                 default_height=None,
                 mask_type=None,
                 close_callback=None,
                 modal=True,
                 window_hint=gtk.gdk.WINDOW_TYPE_HINT_DIALOG,
                 window_pos=None,
                 skip_taskbar_hint=True,
                 resizable=False,
                 window_type=gtk.WINDOW_TOPLEVEL,
                 ):
        '''
        Initialize DialogBox class.

        @param title: Dialog title.
        @param default_width: Width of dialog, default is None.
        @param default_height: Height of dialog, default is None.
        @param mask_type: Background mask type, it allow use below type:
         - DIALOG_MASK_SINGLE_PAGE      single mask style, use in single page that background mask include dialog button area.
         - DIALOG_MASK_GLASS_PAGE       glass mask style, similar DIALOG_MASK_SINGLE_PAGE but with different color.
         - DIALOG_MASK_MULTIPLE_PAGE    multiple mask style, use in multiple page that background mask not include dialog button area.
         - DIALOG_MASK_TAB_PAGE         tab mask style, use in preference page that background mask not include button area.
        @param close_callback: The callback that will call when close dialog box, callback don't need input argument.
        @param modal: If modal is True the window becomes modal. Modal windows prevent interaction with other windows in the same application.
        @param window_hint: Sets the window type hint, default is gtk.gdk.WINDOW_TYPE_HINT_DIALOG, it allow use below value:
         - gtk.gdk.WINDOW_TYPE_HINT_NORMAL                          A normal toplevel window.
         - gtk.gdk.WINDOW_TYPE_HINT_DIALOG                          A dialog window.
         - gtk.gdk.WINDOW_TYPE_HINT_MENU                            A window used to implement a menu.
         - gtk.gdk.WINDOW_TYPE_HINT_TOOLBAR                         A window used to implement a toolbar.
         - gtk.gdk.WINDOW_TYPE_HINT_SPLASHSCREEN                    A window used to implement a splash screen
         - gtk.gdk.WINDOW_TYPE_HINT_UTILITY
         - gtk.gdk.WINDOW_TYPE_HINT_DOCK                            A window used to implement a docking bar.
         - gtk.gdk.WINDOW_TYPE_HINT_DESKTOP                         A window used to implement a desktop.
         - gtk.gdk.WINDOW_TYPE_HINT_DROPDOWN_MENU                   A menu that belongs to a menubar.
         - gtk.gdk.WINDOW_TYPE_HINT_POPUP_MENU                      A menu that does not belong to a menubar, e.g. a context menu.
         - gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP                         A tooltip.
         - gtk.gdk.WINDOW_TYPE_HINT_NOTIFICATION                    A notification - typically a "bubble" that belongs to a status icon.
         - gtk.gdk.WINDOW_TYPE_HINT_COMBO                           A popup from a combo box.
         - gtk.gdk.WINDOW_TYPE_HINT_DND                             A window that is used to implement a DND cursor.
        @param window_pos: The window position of window, it can use below value:
         - gtk.WIN_POS_NONE                      No influence is made on placement.
         - gtk.WIN_POS_CENTER                    Windows should be placed in the center of the screen.
         - gtk.WIN_POS_MOUSE                     Windows should be placed at the current mouse position.
         - gtk.WIN_POS_CENTER_ALWAYS             Keep window centered as it changes size, etc.
         - gtk.WIN_POS_CENTER_ON_PARENT          Center the window on its transient parent (see the gtk.Window.set_transient_for()) method.
        @param skip_taskbar_hint: Set True to make desktop environment not to display the window in the task bar, default is True.
        @param resizable: Whether allowed user resizable dialog, default is False.
        '''
        Window.__init__(
            self,
            enable_resize=resizable,
            window_type=window_type,
            )
        self.default_width = default_width
        self.default_height = default_height
        self.mask_type = mask_type
        self.close_callback = close_callback

        if window_pos:
            self.set_position(window_pos)
        self.set_modal(modal)                                # grab focus to avoid build too many skin window
        if window_hint:
            self.set_type_hint(window_hint)
        self.set_skip_taskbar_hint(skip_taskbar_hint) # skip taskbar
        if self.default_width != None and self.default_height != None:
            self.set_default_size(self.default_width, self.default_height)

            if not resizable:
                self.set_geometry_hints(None, self.default_width, self.default_height, -1, -1, -1, -1, -1, -1, -1, -1)

        self.padding_left = 2
        self.padding_right = 2

        self.titlebar = Titlebar(
            ["close"],
            None,
            title)
        self.add_move_event(self.titlebar)
        self.body_box = gtk.VBox()
        self.body_align = gtk.Alignment()
        self.body_align.set(0.5, 0.5, 1, 1)
        self.body_align.set_padding(0, 0, self.padding_left, self.padding_right)
        self.body_align.add(self.body_box)
        self.button_box = gtk.HBox()
        self.left_button_box = DialogLeftButtonBox()
        self.right_button_box = DialogRightButtonBox()

        self.button_box.pack_start(self.left_button_box, True, True)
        self.button_box.pack_start(self.right_button_box, True, True)

        self.window_frame.pack_start(self.titlebar, False, False)
        self.window_frame.pack_start(self.body_align, True, True)
        self.window_frame.pack_start(self.button_box, False, False)

        if self.close_callback:
            self.titlebar.close_button.connect("clicked", lambda w: self.close_callback())
            self.connect("destroy", lambda w: self.close_callback())
            self.connect("delete-event", lambda w, e: self.close_callback())
        else:
            self.titlebar.close_button.connect("clicked", lambda w: self.destroy())
            self.connect("destroy", lambda w: self.destroy())
            self.connect("delete-event", lambda w, e: self.destroy())

        self.draw_mask = self.get_mask_func(self, 1, 1, 0, 1)

        self.keymap = {
            "Escape" : self.close,
            }

        self.connect("key-press-event", self.key_press_dialog_box)
コード例 #40
0
 def __init__(self):
     Window.__init__(self)
     self.qml_context.setContextProperty("screenWidth", screen_width)
     self.qml_context.setContextProperty("screenHeight", screen_height)
     self.qml_context.setContextProperty("windowView", self)
     self.setSource(QtCore.QUrl.fromLocalFile(os.path.join(get_parent_dir(__file__), 'MessageBox.qml')))
コード例 #41
0
 def __init__(self, hi):
     Window.__init__(self, hi) # Héritage de la fonction window
     self.stop = 0  # Valeur utilisée pour arreter le programme quand elle passera à 1
     self.bulletsShips = [self.canevas.create_line(1249, 649, 1250, 650)] # Création d'une liste de balles pour le vaisseau (avec 1 element pour qu'elle ne soit jamais vide)
     self.bulletsAlien = [self.canevas.create_line(1249, 649, 1250, 650)] # Création d'une liste de balles pour les aliens (avec 1 element pour qu'elle ne soit jamais vide)
コード例 #42
0
    def __init__( self, caption ):

        Window.__init__( self, caption )


        dirChilds = Vector2( (-1,0) )

        
        self.items = []
        
        
        # Load default workspace
        filename = config.get( 'workspace', 'default.xml' )
        if filename:
            if not saving.load( self, filename ):
                print "Can't open default workspace"
        

        
        self.expandMatrix = TransformMatrix()
        self.expandMatrix.setExpand( Figure.expandCoef )

        self.viewMatrix = None
        self.viewMatrix = self.defaultView( self.size, 35 )


        self.selection = Selection( None )
        self.highlight = Selection( None )  # Dragging Figure over another Figure
        self.dragPos   = None               # Start drag position


        self.mode = let.Mode()              # Mode of reduction
        
        self.quick = False                  # Quick Reduction
        self.cursors = ( cursors.arrow, cursors.finger )
        self.setCursor( self.cursors[ int( self.quick ) ] )
        
        self.nonstop = False                # Nonstop reduction mode
        
        self.showInfo = True
        
        
        # Drawing 
        self.boldLambda = int( config.get( 'bold_lambda', 0 ) )

        
        
        self.eventProcs = { K_i:            self.eventInputItem,
                            K_d:            self.eventDeleteItem,
                            K_c:            self.eventCopyItem,
        
                            K_RETURN:       { KMOD_CTRL:    self.eventNonstop,
                                              None:         self.eventReduce },

                            K_BACKSPACE:    self.eventUndo,
                            K_z:            { KMOD_CTRL:    self.eventUndo },
                            K_y:            { KMOD_CTRL:    self.eventRedo },
                            K_LEFT:         { KMOD_ALT:     self.eventUndo },
                            K_RIGHT:        { KMOD_ALT:     self.eventRedo },
                            
                            K_SPACE:        self.eventExpandSelection,                            
                            K_DELETE:       self.eventDeleteNode,
                            K_INSERT:       { KMOD_ALT:     self.eventAddLambda,
                                              KMOD_CTRL:    self.eventAddApplicationAfter,
                                              None:         self.eventAddApplicationBefore },


                            K_s:            { KMOD_CTRL:    self.eventSave,
                                              KMOD_ALT:     self.eventModeBySelection },
                            K_o:            { KMOD_CTRL:    self.eventLoad },
                            
                            K_q:            self.eventModeQuick,
                            K_a:            { KMOD_ALT:     self.eventModeStrategy,
                                              KMOD_CTRL:    self.eventAddApplicationAfter,
                                              None:         self.eventAddApplicationBefore },
                            K_l:            { KMOD_ALT:     self.eventModeLazy,
                                              None:         self.eventAddLambda },
                            K_v:            self.eventAddVariable,
                            K_p:            { KMOD_ALT:     self.eventModeLazy },

                            K_e:            { KMOD_ALT:     self.eventExportMode },
                            
                            K_F1:           self.eventViewHelp,
                            K_F5:           self.eventRefreshView,
                            K_F12:          self.eventSaveScreen   }




    
        #-----------------------------------------------------
        # Prepare toolbars
        
        self.toolbars = []

        ims = toolbar.ImageSet( 'icons.bmp', (48,48) )
        
        # Create font for Menus
        fontsize = int( config.get( 'fontsize' ) )  or  11
        toolbar.ToolbarItem.fontsize = fontsize
        toolbar.ToolbarItem.font     = pygame.font.SysFont( 'lucidaconsole', fontsize )
        
        left = toolbar.Toolbar( toolbar.LEFT )
        left.add( self.eventInputItem,              'Input Item from console (I)',   'Input Item' )
        left.add( None, None, '' )
        left.add( None, None, 'Reduction' )
        left.add( self.eventModeStrategy,           'Toggle reduction strategy (Alt+A)',    ' Normal order',     ' Applicative',  lambda:self.mode.applicative )
        left.add( self.eventModeLazy,               'Toggle calculus (Alt+L, Alt+P)',       ' Pure Lambda',      ' Lazy',         lambda:self.mode.lazy )
        left.add( self.eventModeBySelection,        'Reduction inside selection only or the whole expression (Alt+S)',  
                                                                           ' whole expression', ' in selection', lambda:self.mode.redex )
        left.add( None, None, '' )
        left.add( self.eventSave,                   'Save Workspace. Input file name from console. (Ctrl+S)',  'Save' )
        left.add( self.eventLoad,                   'Load Workspace. Input file name from console. (Ctrl+O)',  'Load' )
        self.toolbars.append( left )
    
        right = toolbar.Toolbar( toolbar.RIGHT )
        right.add( self.eventModeQuick,             'Quick mode: Pick for reduction. (Q)',          (ims,2,1), (ims,2,2), lambda:self.quick )
        right.add( self.eventAddVariable,           'Add a free variable to workspace (V)',         (ims,0,0) )
        right.add( self.eventAddApplicationBefore,  'Add application before selection (Insert, A)', (ims,0,1) )
        right.add( self.eventAddApplicationAfter,   'Add application after selection (Ctrl+Insert, Ctrl+A)', (ims,0,2) )
        right.add( self.eventAddLambda,             'Add lambda bubble (Alt+Insert, L)',            (ims,1,2) )
        right.add( self.eventDeleteNode,            'Delete selected bubbles (Delete)',             (ims,1,1) )
        right.add( self.eventDeleteItem,            'Delete selected item (D)',                     (ims,1,0) )
        right.add( self.eventCopyItem,              'Copy selected item (C)',                       (ims,2,0) )
        self.toolbars.append( right )

        bottom = toolbar.Toolbar( toolbar.BOTTOM )
        bottom.add( self.eventUndo,                 'Undo (Ctrl+Z, Alt+Left, Backspace)',           (ims,3,1) )
        bottom.add( self.eventReduce,               'Reduce selected figure (Enter)',               (ims,3,0) )
        bottom.add( self.eventRedo,                 'Redo (Ctrl+Y, Alt+Right)',                     (ims,3,2) )
        self.toolbars.append( bottom )




        self.invalidate()
コード例 #43
0
ファイル: menu.py プロジェクト: masums/deepin-ui
    def __init__(self,
                 items,
                 is_root_menu=False,
                 select_scale=False,
                 x_align=ALIGN_START,
                 y_align=ALIGN_START,
                 font_size=DEFAULT_FONT_SIZE,
                 padding_x=3,
                 padding_y=3,
                 item_padding_x=6,
                 item_padding_y=3,
                 shadow_visible=True,
                 menu_min_width=130,
                 menu_item_select_color=None):
        '''
        Initialize Menu class.

        @param items: A list of item, item format: ((item_normal_dpixbuf, item_hover_dpixbuf, item_disable_dpixbuf), item_name, item_node).
        @param is_root_menu: Default is False for submenu, you should set it as True if you build root menu.
        @param select_scale: Default is False, it will use parant's width if it set True.
        @param x_align: Horizontal alignment value.
        @param y_align: Vertical alignment value.
        @param font_size: Menu font size, default is DEFAULT_FONT_SIZE
        @param padding_x: Horizontal padding value, default is 3 pixel.
        @param padding_y: Vertical padding value, default is 3 pixel.
        @param item_padding_x: Horizontal item padding value, default is 6 pixel.
        @param item_padding_y: Vertical item padding value, default is 3 pixel.
        @param shadow_visible: Whether show window shadow, default is True.
        @param menu_min_width: Minimum width of menu.
        '''
        global root_menus

        # Init.
        Window.__init__(self,
                        shadow_visible=shadow_visible,
                        window_type=gtk.WINDOW_POPUP,
                        shadow_radius=6)
        self.set_can_focus(True)  # can focus to response key-press signal
        self.draw_mask = self.draw_menu_mask
        self.is_root_menu = is_root_menu
        self.select_scale = select_scale
        self.x_align = x_align
        self.y_align = y_align
        self.submenu = None
        self.root_menu = None
        self.offset_x = 0  # use for handle extreme situaiton, such as, menu show at side of screen
        self.offset_y = 0
        self.padding_x = padding_x
        self.padding_y = padding_y
        self.item_padding_x = item_padding_x
        self.item_padding_y = item_padding_y
        self.menu_min_width = menu_min_width
        self.menu_item_select_color = menu_item_select_color

        # Init menu window.
        self.set_skip_pager_hint(True)
        self.set_skip_taskbar_hint(True)
        self.set_keep_above(True)

        # Add menu item.
        self.item_box = gtk.VBox()
        self.item_align = gtk.Alignment()
        self.item_align.set_padding(padding_y, padding_y, padding_x, padding_x)
        self.item_align.add(self.item_box)
        self.window_frame.add(self.item_align)
        self.menu_items = []
        self.font_size = font_size

        if items:
            self.add_menu_items(items)

        self.connect("show", self.init_menu)
        self.connect("hide", self.hide_menu)
        self.connect("realize", self.realize_menu)
コード例 #44
0
 def __init__(self):
     Window.__init__(self)
     self.qml_context.setContextProperty("screenWidth", screen_width)
     self.qml_context.setContextProperty("screenHeight", screen_height)
     self.qml_context.setContextProperty("windowView", self)
     self.setSource(QtCore.QUrl.fromLocalFile(os.path.join(get_parent_dir(__file__), 'MessageBox.qml')))
コード例 #45
0
ファイル: menu.py プロジェクト: torgiren/szkola
	def __init__(self,sizeY,sizeX,offsetY,offsetX,border):
#		Window.__init__(sizeY,sizeX,offsetY,offsetX,border)
		Window.__init__(self,sizeY+2,sizeX,offsetY,offsetX,border)
		self.itsOpts=[]
		self.itsAct=0
		self.ViewStart=0
コード例 #46
0
ファイル: leave.py プロジェクト: hugoruscitti/pybox
 def __init__(self, name, changes, time_last_save, save_callback):
     Window.__init__(self, 'leave.glade')
     self.can_continue = False
     self.save_callback = save_callback
     self._populate_template(name, changes, time_last_save)
コード例 #47
0
    def __init__(self, caption):

        Window.__init__(self, caption)

        dirChilds = Vector2((-1, 0))

        self.items = []

        # Load default workspace
        filename = config.get('workspace', 'default.xml')
        if filename:
            if not saving.load(self, filename):
                print "Can't open default workspace"

        self.expandMatrix = TransformMatrix()
        self.expandMatrix.setExpand(Figure.expandCoef)

        self.viewMatrix = None
        self.viewMatrix = self.defaultView(self.size, 35)

        self.selection = Selection(None)
        self.highlight = Selection(None)  # Dragging Figure over another Figure
        self.dragPos = None  # Start drag position

        self.mode = let.Mode()  # Mode of reduction

        self.quick = False  # Quick Reduction
        self.cursors = (cursors.arrow, cursors.finger)
        self.setCursor(self.cursors[int(self.quick)])

        self.nonstop = False  # Nonstop reduction mode

        self.showInfo = True

        # Drawing
        self.boldLambda = int(config.get('bold_lambda', 0))

        self.eventProcs = {
            K_i: self.eventInputItem,
            K_d: self.eventDeleteItem,
            K_c: self.eventCopyItem,
            K_RETURN: {
                KMOD_CTRL: self.eventNonstop,
                None: self.eventReduce
            },
            K_BACKSPACE: self.eventUndo,
            K_z: {
                KMOD_CTRL: self.eventUndo
            },
            K_y: {
                KMOD_CTRL: self.eventRedo
            },
            K_LEFT: {
                KMOD_ALT: self.eventUndo
            },
            K_RIGHT: {
                KMOD_ALT: self.eventRedo
            },
            K_SPACE: self.eventExpandSelection,
            K_DELETE: self.eventDeleteNode,
            K_INSERT: {
                KMOD_ALT: self.eventAddLambda,
                KMOD_CTRL: self.eventAddApplicationAfter,
                None: self.eventAddApplicationBefore
            },
            K_s: {
                KMOD_CTRL: self.eventSave,
                KMOD_ALT: self.eventModeBySelection
            },
            K_o: {
                KMOD_CTRL: self.eventLoad
            },
            K_q: self.eventModeQuick,
            K_a: {
                KMOD_ALT: self.eventModeStrategy,
                KMOD_CTRL: self.eventAddApplicationAfter,
                None: self.eventAddApplicationBefore
            },
            K_l: {
                KMOD_ALT: self.eventModeLazy,
                None: self.eventAddLambda
            },
            K_v: self.eventAddVariable,
            K_p: {
                KMOD_ALT: self.eventModeLazy
            },
            K_e: {
                KMOD_ALT: self.eventExportMode
            },
            K_F1: self.eventViewHelp,
            K_F5: self.eventRefreshView,
            K_F12: self.eventSaveScreen
        }

        #-----------------------------------------------------
        # Prepare toolbars

        self.toolbars = []

        ims = toolbar.ImageSet('icons.bmp', (48, 48))

        # Create font for Menus
        fontsize = int(config.get('fontsize')) or 11
        toolbar.ToolbarItem.fontsize = fontsize
        toolbar.ToolbarItem.font = pygame.font.SysFont('lucidaconsole',
                                                       fontsize)

        left = toolbar.Toolbar(toolbar.LEFT)
        left.add(self.eventInputItem, 'Input Item from console (I)',
                 'Input Item')
        left.add(None, None, '')
        left.add(None, None, 'Reduction')
        left.add(self.eventModeStrategy, 'Toggle reduction strategy (Alt+A)',
                 ' Normal order', ' Applicative',
                 lambda: self.mode.applicative)
        left.add(self.eventModeLazy, 'Toggle calculus (Alt+L, Alt+P)',
                 ' Pure Lambda', ' Lazy', lambda: self.mode.lazy)
        left.add(
            self.eventModeBySelection,
            'Reduction inside selection only or the whole expression (Alt+S)',
            ' whole expression', ' in selection', lambda: self.mode.redex)
        left.add(None, None, '')
        left.add(self.eventSave,
                 'Save Workspace. Input file name from console. (Ctrl+S)',
                 'Save')
        left.add(self.eventLoad,
                 'Load Workspace. Input file name from console. (Ctrl+O)',
                 'Load')
        self.toolbars.append(left)

        right = toolbar.Toolbar(toolbar.RIGHT)
        right.add(self.eventModeQuick, 'Quick mode: Pick for reduction. (Q)',
                  (ims, 2, 1), (ims, 2, 2), lambda: self.quick)
        right.add(self.eventAddVariable,
                  'Add a free variable to workspace (V)', (ims, 0, 0))
        right.add(self.eventAddApplicationBefore,
                  'Add application before selection (Insert, A)', (ims, 0, 1))
        right.add(self.eventAddApplicationAfter,
                  'Add application after selection (Ctrl+Insert, Ctrl+A)',
                  (ims, 0, 2))
        right.add(self.eventAddLambda, 'Add lambda bubble (Alt+Insert, L)',
                  (ims, 1, 2))
        right.add(self.eventDeleteNode, 'Delete selected bubbles (Delete)',
                  (ims, 1, 1))
        right.add(self.eventDeleteItem, 'Delete selected item (D)',
                  (ims, 1, 0))
        right.add(self.eventCopyItem, 'Copy selected item (C)', (ims, 2, 0))
        self.toolbars.append(right)

        bottom = toolbar.Toolbar(toolbar.BOTTOM)
        bottom.add(self.eventUndo, 'Undo (Ctrl+Z, Alt+Left, Backspace)',
                   (ims, 3, 1))
        bottom.add(self.eventReduce, 'Reduce selected figure (Enter)',
                   (ims, 3, 0))
        bottom.add(self.eventRedo, 'Redo (Ctrl+Y, Alt+Right)', (ims, 3, 2))
        self.toolbars.append(bottom)

        self.invalidate()