コード例 #1
0
ファイル: motors.py プロジェクト: SiChiTong/hackflight
    def __init__(self, driver):

        Dialog.__init__(self, driver)

        # Add a quadcopter image for motor testing
        (self.image_motors,
         self.label_motors) = self._load_photo(MOTORS_IMAGE_FILE)
        (self.image_motors1,
         self.label_motors1) = self._load_photo(MOTORS1_IMAGE_FILE)
        (self.image_motors2,
         self.label_motors2) = self._load_photo(MOTORS2_IMAGE_FILE)
        (self.image_motors3,
         self.label_motors3) = self._load_photo(MOTORS3_IMAGE_FILE)
        (self.image_motors4,
         self.label_motors4) = self._load_photo(MOTORS4_IMAGE_FILE)

        # Add a warning checkbox for motor testing
        self.checkbox_var = IntVar()
        self.warning_motors = Checkbutton(self.driver.canvas, \
                variable=self.checkbox_var, command=self._checkbox_callback, \
                text=MOTORS_WARNING_TEXT, font=('Heletica', 14),  fg='red', bg='black', highlightthickness=0)

        # A a scale for motors
        self.scale = Scale(self.driver.canvas,
                           from_=1850,
                           to_=1000,
                           command=self._scale_callback,
                           orient=VERTICAL,
                           length=MOTOR_SCALE_LENGTH,
                           bg='black',
                           fg='white')

        # Index of active motor (0 = none)
        self.active_motor = 0
コード例 #2
0
    def __init__(self, driver):

        Dialog.__init__(self, driver)

        self.running = False

        self.message_count = 0
        self.current_message = None
        self.previous_message = None

        self.scrollbar = Scrollbar(driver.canvas)
        self.listbox = Listbox(driver.canvas, bg='black', fg='white')

        self.checkbox_var = IntVar()
        self.checkbox = Checkbutton(self.driver.canvas,
                                    text='Autoscroll',
                                    selectcolor='black',
                                    variable=self.checkbox_var,
                                    bg='black',
                                    fg='white',
                                    highlightthickness=0)
        self.checkbox.select()

        self.listbox.config(yscrollcommand=self.scrollbar.set)
        self.scrollbar.config(command=self.listbox.yview)
コード例 #3
0
ファイル: filedialog.py プロジェクト: Ripsnorta/pyui2
    def __init__(self, startDir, callback, filter = ".*"):
        currentDir = startDir.replace('\\','/')
        self.callback = callback
        self.filter = filter
        Dialog.__init__(self, -1, -1, 400,240, "File Dialog")
        self.setLayout(pyui2.layouts.TableLayoutManager(6,8))
        
        self.dirLabel = pyui2.widgets.Label("Directory:")
        self.fileLabel = pyui2.widgets.Label("Filename:")
        self.filterLabel = pyui2.widgets.Label("Filter:")

        self.dirBox = pyui2.widgets.Label(currentDir)
        self.filesBox = pyui2.widgets.ListBox(self._pyui2Selected, self._pyui2DoubleClicked)
        self.nameBox = pyui2.widgets.Label("")
        self.filterBox = pyui2.widgets.Edit(self.filter,10,self._pyui2Filter)

        self.dirButton = pyui2.widgets.Button("Up", self._pyui2Up)
        self.openButton = pyui2.widgets.Button("Open", self._pyui2Open)
        self.closeButton = pyui2.widgets.Button("Close", self._pyui2Close)

        self.addChild( self.dirLabel,    (0,0,2,1) )
        self.addChild( self.fileLabel,   (0,6,2,1) )
        self.addChild( self.filterLabel, (0,7,2,1) )
        self.addChild( self.dirBox,      (2,0,3,1) )
        self.addChild( self.filesBox,    (0,1,6,5) )
        self.addChild( self.nameBox,     (2,6,3,1) )
        self.addChild( self.filterBox,   (2,7,3,1) )
        self.addChild( self.dirButton,   (5,0,1,1) )
        self.addChild( self.openButton,  (5,6,1,1) )
        self.addChild( self.closeButton, (5,7,1,1) )        

        self.pack()
        self.setCurrentDir(currentDir)
コード例 #4
0
ファイル: file_dialogs.py プロジェクト: AngelFishy/Kytten
    def __init__(self, path=os.getcwd(), extensions=[], title="Select File",
                 width=540, height=300, window=None, batch=None, group=None,
                 anchor=ANCHOR_CENTER, offset=(0, 0),
                 theme=None, movable=True, on_select=None, on_escape=None):
        self.path = path
        self.extensions = extensions
        self.title = title
        self.on_select = on_select
        self.selected_file = None
        self._set_files()

        def on_parent_menu_select(choice):
            self._select_file(self.parents_dict[choice])

        def on_menu_select(choice):
            self._select_file(self.files_dict[choice])

        self.dropdown = Dropdown(options=self.parents,
                                 selected=self.parents[-1],
                                 align=VALIGN_BOTTOM,
                                 on_select=on_parent_menu_select)
        self.menu = Menu(options=self.files, align=HALIGN_LEFT,
                         on_select=on_menu_select)
        self.scrollable = Scrollable(
            VerticalLayout([self.dropdown, self.menu], align=HALIGN_LEFT),
            width=width, height=height)

        content = self._get_content()
        Dialog.__init__(self, content, window=window, batch=batch, group=group,
                        anchor=anchor, offset=offset, theme=theme,
                        movable=movable, on_escape=on_escape)
コード例 #5
0
ファイル: im_extension.py プロジェクト: jpfxgood/ped
 def __init__(self,scr,title = "Chat"):
     """ takes the curses window to pop up over, title to display, will dynamically size to parent window """
     self.current_buddy = None
     self.current_server = None
     self.chat_connection = None
     self.win = None
     self.buddys = None
     self.messages = None
     self.reply = None
     self.reply_border = None
     self.config_button = None
     self.cancel = None
     self.config = {}
     self.status = {}
     self.children = []
     self.myname = None
     self.event_time = time.clock()
     self.title = title
     # load the config right away
     self.load_config()
     self.setparent(scr)
     self.resize()
     max_y,max_x = self.getparent().getmaxyx()
     min_y,min_x = self.getparent().getbegyx()
     Dialog.__init__(self,scr,"ChatDialog", max_y, max_x, [ Frame(title),
                                                         self.buddys,
                                                         self.messages,
                                                         self.reply_border,
                                                         self.reply,
                                                         self.config_button,
                                                         self.cancel], min_y, min_x)
     self.start_chat_thread()
コード例 #6
0
ファイル: imu.py プロジェクト: simondlevy/Hackflight
    def __init__(self, gcs, simulation=False, vehicleScale=0.1, updateMsec=10):

        Dialog.__init__(self, gcs)

        # Vehicle dimensions
        W = vehicleScale
        D = vehicleScale / 2
        L = vehicleScale * 2

        # Update period
        self.update_msec = updateMsec

        # Let these be in World-coordinates (worldview-matrix already applied)
        # In right-handed, counter-clockwise order
        (self.vehicle_points, self.vehicle_faces,
         self.vehicle_face_colors) = get_vehicle(W, D, L)

        # Assume no angles to start
        self.roll_pitch_yaw = None

        # Rotation matrices
        self.pitchrot = np.eye(3)
        self.yawrot = np.eye(3)
        self.rollrot = np.eye(3)

        self.simulation = simulation
        self.running = False
コード例 #7
0
ファイル: imu.py プロジェクト: sujanabasnet/Hackflight
    def __init__(self, gcs, simulation=False):

        Dialog.__init__(self, gcs)

        # Vehicle dimensions
        W = VEHICLE_SCALE
        D = VEHICLE_SCALE / 2
        L = VEHICLE_SCALE * 2

        # Let these be in World-coordinates (worldview-matrix already applied)
        # In right-handed, counter-clockwise order
        (self.vehicle_points,
         self.vehicle_faces,
         self.vehicle_face_colors) = get_vehicle(W, D, L)

        # Assume no angles to start
        self.roll_pitch_yaw = None

        # Rotation matrices
        self.pitchrot = _eye3()
        self.yawrot = _eye3()
        self.rollrot = _eye3()

        self.simulation = simulation
        self.running = False
コード例 #8
0
ファイル: file_dialogs.py プロジェクト: wty0512/micropylis
    def __init__(self, path=os.getcwd(), extensions=[], title="Select File",
                 width=540, height=300, window=None, batch=None, group=None,
                 anchor=ANCHOR_CENTER, offset=(0, 0),
                 theme=None, movable=True, on_select=None, on_escape=None):
        self.path = path
        self.extensions = extensions
        self.title = title
        self.on_select = on_select
        self.selected_file = None
        self._set_files()

        def on_parent_menu_select(choice):
            self._select_file(self.parents_dict[choice])

        def on_menu_select(choice):
            self._select_file(self.files_dict[choice])

        self.dropdown = Dropdown(options=self.parents,
                                 selected=self.parents[-1],
                                 align=VALIGN_BOTTOM,
                                 on_select=on_parent_menu_select)
        self.menu = Menu(options=self.files, align=HALIGN_LEFT,
                         on_select=on_menu_select)
        self.scrollable = Scrollable(
            VerticalLayout([self.dropdown, self.menu], align=HALIGN_LEFT),
            width=width, height=height)

        content = self._get_content()
        Dialog.__init__(self, content, window=window, batch=batch, group=group,
                        anchor=anchor, offset=offset, theme=theme,
                        movable=movable, on_escape=on_escape)
コード例 #9
0
 def __init__(self, location=(0, 0), surface=None):
     Dialog.__init__(self, (0, 0, 640, 640), (200, 200, 200),
                     surface,
                     closekey=pygame.K_ESCAPE,
                     border_width=0,
                     shadow_weight=0)
     self.font = pygame.font.Font(None, 30)
     self.player = get_game().player
     self.x, self.y = location
コード例 #10
0
 def __init__(self, parent, username, title, callback):
     Dialog.__init__(self, parent.gui, False)
     self.dlg.set_transient_for(parent.dlg)
     self.parent = parent
     self.parent.username_dialog = self
     self.callback = callback
     self.dlg.set_title(title)
     self.username = username
     self.user.set_text(username)
     self.user.grab_focus()
コード例 #11
0
ファイル: motors.py プロジェクト: simondlevy/Hackflight
    def __init__(self, gcs):

        Dialog.__init__(self, gcs)

        # Add a warning checkbox for motor testing
        self.checkbox_var = tk.IntVar()
        self.warning = tk.Checkbutton(self.gcs.canvas,
                                      variable=self.checkbox_var,
                                      command=self._checkbox_callback,
                                      text=self.WARNING_TEXT,
                                      font=('Helvetica', 14), fg='red',
                                      bg='black', highlightthickness=0)
コード例 #12
0
    def __init__(self, run_it, downloads, mainwindow):
        Dialog.__init__(self)
        self.set_title('Downloading, please wait...')
        self.mainwindow = mainwindow
        self.run_it = run_it
        self.n_downloads = 0

        self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)

        table = gtk.Table(len(downloads) + 1, 3)
        self.vbox.pack_start(table, False, False, 0)
        table.set_row_spacings(4)
        table.set_col_spacings(10)
        table.set_border_width(10)

        bars = []

        row = 0
        for iface, dl in downloads:
            bar = gtk.ProgressBar()
            bars.append((dl, bar))
            table.attach(gtk.Label(iface.get_name()), 0, 1, row, row + 1)
            table.attach(gtk.Label(pretty_size(dl.source.size)), 1, 2, row,
                         row + 1)
            table.attach(bar, 2, 3, row, row + 1)
            row += 1
            self.start_download(dl)

        mainwindow.hide()
        self.vbox.show_all()

        def resp(box, resp):
            for iface, dl in downloads:
                dl.abort()
            gtk.timeout_remove(self.idle_timeout)
            self.idle_timeout = None
            self.destroy()
            mainwindow.show()

        self.connect('response', resp)

        def update_bars():
            if self.n_downloads == 0:
                self.destroy()
                self.run_it()
                return False
            for dl, bar in bars:
                perc = dl.get_current_fraction()
                bar.set_fraction(perc)
            return True

        self.idle_timeout = gtk.timeout_add(250, update_bars)
コード例 #13
0
    def __init__(self, gcs):

        Dialog.__init__(self, gcs)

        # Add a quadcopter image for motor testing
        self.image_motors, self.label_motors = \
            self._load_photo(MOTORS_IMAGE_FILE)
        self.image_motors1, self.label_motors1 = \
            self._load_photo(MOTORS1_IMAGE_FILE)
        self.image_motors2, self.label_motors2 = \
            self._load_photo(MOTORS2_IMAGE_FILE)
        self.image_motors3, self.label_motors3 = \
            self._load_photo(MOTORS3_IMAGE_FILE)
        self.image_motors4, self.label_motors4 = \
            self._load_photo(MOTORS4_IMAGE_FILE)

        # Add a warning checkbox for motor testing
        self.checkbox_var = tk.IntVar()
        self.warning_motors = tk.Checkbutton(self.gcs.canvas,
                                             variable=self.checkbox_var,
                                             command=self._checkbox_callback,
                                             text=MOTORS_WARNING_TEXT,
                                             font=('Heletica', 14),
                                             fg='red',
                                             bg='black',
                                             highlightthickness=0)

        # A a scale for motors
        self.scale = tk.Scale(self.gcs.canvas,
                              from_=100,
                              to_=0,
                              command=self._scale_callback,
                              orient=tk.VERTICAL,
                              length=MOTOR_SCALE_LENGTH,
                              bg='black',
                              fg='white')

        # A label for the scale
        self.scale_label = tk.Label(self.gcs.canvas,
                                    text='%',
                                    bg='black',
                                    fg='white')

        # Index of active motor (0 = none)
        self.active_motor = 0
コード例 #14
0
ファイル: messages.py プロジェクト: robert-b/hackflight
    def __init__(self, driver):

        Dialog.__init__(self, driver)

        self.message_count = 0
        self.current_message = None
        self.previous_message = None

        self.scrollbar = Scrollbar(driver.canvas)
        self.listbox = Listbox(driver.canvas, bg='black', fg='white')

        self.checkbox_var = IntVar()
        self.checkbox = Checkbutton(self.driver.canvas, 
                text='Autoscroll', selectcolor='black', variable=self.checkbox_var, 
                bg='black', fg='white', highlightthickness=0)
        self.checkbox.select()
        
        self.listbox.config(yscrollcommand=self.scrollbar.set)
        self.scrollbar.config(command=self.listbox.yview)
コード例 #15
0
ファイル: im_extension.py プロジェクト: jpfxgood/ped
 def __init__(self, chat_dialog, title = "Chat Config" ):
     """ constructor takes the chat_dialog we're nested over and a title """
     p_win = chat_dialog.win
     min_y,min_x = p_win.getbegyx()
     max_y,max_x = p_win.getmaxyx()
     max_x += min_x
     max_y += min_y
     width = 56
     height = 9
     x = (max_x + min_x)/2 - width/2
     y = (max_y + min_y)/2 - height/2
     Dialog.__init__(self,p_win,"ChatConfig", height, width, [
         Frame(title),
         Prompt("server",1,2,2,"Server: ", 50-8, chat_dialog.config.get("server","")),
         Prompt("port",2,2,3,"Port: ", 13-6, chat_dialog.config.get("port","")),
         Prompt("name",3,2,4,"Screen Name: ",50-13, chat_dialog.config.get("name","")),
         Prompt("password",4,2,5,"Password: "******"password","")),
         Button("ok",5,2,7,"OK",Component.CMP_KEY_OK),
         Button("cancel",6,7,7,"CANCEL",Component.CMP_KEY_CANCEL)],y,x)
コード例 #16
0
 def __init__(self, parent):
     Dialog.__init__(self, parent, False, False, True)
     self.parent = parent
     self.blocked = False
     self.username_dialog = None
     self.question_dialog = None
     self.saved = False
     self.oldusername = self.main.username
     self.settings.check_autostart()
     self.dlg.set_title(lang.settings_title)
     
     # Tabs
     self.get('users').set_label(lang.settings_tab_accounts)
     self.get('general').set_label(lang.settings_tab_general)
     self.get('atarashii').set_label(lang.settings_tab_atarashii)
     self.get('syncing').set_label(lang.settings_tab_syncing)
     self.get('notifications').set_label(lang.settings_tab_notifications)
     self.get('theme').set_label(lang.settings_tab_theme)
     
     # Pages
     self.page_accounts(self.settings)
     self.page_atarashii(self.settings)
     self.page_syncing(self.settings)
     self.page_theme(self.settings)
     self.page_notify_sounds(self.settings)
     
     # Activate
     if (not self.main.status(ST_LOGIN_COMPLETE) \
        and self.main.username != UNSET_USERNAME) \
        or self.main.status(ST_CONNECT):
         
         self.activate(False)
     
     # Events
     self.close_button.set_label(lang.settings_button)
     self.close_button.connect('clicked', self.on_save)
     
     cancel_button = self.get('cancelbutton')
     cancel_button.set_label(lang.settings_button_cancel)
     cancel_button.connect('clicked', self.on_close)
     gobject.idle_add(self.accounts.grab_focus)
     self.dlg.set_size_request(-1, -1)
コード例 #17
0
ファイル: colordialog.py プロジェクト: Ripsnorta/pyui2
    def __init__(self, callback, r=255, g=0, b=0):
        self.callback = callback
        self.r = r
        self.g = g
        self.b = b
        
        Dialog.__init__(self, -1, -1, 400,240, "Color Dialog")
        self.setLayout(pyui2.layouts.TableLayoutManager(4,9))

        self.colorGradient = ColorGradient(None, self)
        self.colorStrip = ColorStrip(None, self)
        self.colorSolid = ColorSolid(None)

        self.okButton = pyui2.widgets.Button("OK", self._pyui2OK)
        self.cancelButton = pyui2.widgets.Button("Cancel", self._pyui2Cancel)
        
        self.redLabel = pyui2.widgets.Label("Red:")
        self.greenLabel = pyui2.widgets.Label("Green:")
        self.blueLabel = pyui2.widgets.Label("Blue:")

        self.redBox = pyui2.widgets.SliderBar(self._pyui2Red, 255, r)
        self.greenBox = pyui2.widgets.SliderBar(self._pyui2Green, 255, g)
        self.blueBox = pyui2.widgets.SliderBar(self._pyui2Blue, 255, b)

        self.addChild( self.colorGradient,  (0,0,2,5) )
        self.addChild( self.colorStrip,     (2,0,2,5) )
        self.addChild( self.colorSolid,     (0,5,1,3) )
        self.addChild( self.redLabel,       (1,5,1,1) )
        self.addChild( self.greenLabel,     (1,6,1,1) )
        self.addChild( self.blueLabel,      (1,7,1,1) )        
        self.addChild( self.redBox,         (2,5,2,1) )
        self.addChild( self.greenBox,       (2,6,2,1) )
        self.addChild( self.blueBox,        (2,7,2,1) )        
        self.addChild( self.cancelButton,   (0,8,2,1) )
        self.addChild( self.okButton,       (2,8,2,1) )        

        self.pack()
        self.setColor()
コード例 #18
0
    def __init__(self, gcs):

        Dialog.__init__(self, gcs)

        # Add a warning checkbox for motor testing
        self.checkbox_var = tk.IntVar()
        self.warning = tk.Checkbutton(self.gcs.canvas,
                                      variable=self.checkbox_var,
                                      command=self._checkbox_callback,
                                      text=WARNING_TEXT,
                                      font=('Heletica', 14),
                                      fg='red',
                                      bg='black',
                                      highlightthickness=0)

        # Add scales for servos, motors
        self.servo1_scale = ServoScale(self, SERVO1_X, 1, 'Servo 1')
        self.servo2_scale = ServoScale(self, SERVO2_X, 2, 'Servo 2')
        self.motor1_scale = MotorScale(self, MOTOR1_X, 3, 'Motor 1')
        self.motor2_scale = MotorScale(self, MOTOR2_X, 4, 'Motor 2')

        # Index of active motor (0 = none)
        self.active_motor = 0
コード例 #19
0
ファイル: stddialog.py プロジェクト: Ripsnorta/pyui2
    def __init__(self, title, text):

        font = getTheme().getProperty("DEFAULT FONT")
        size = font.getTextSize(title)
        Dialog.__init__(self, title = title)
        self.setLayout(pyui2.layouts.BorderLayoutManager())

        self.textLabel = pyui2.widgets.Label(text)
        self.textLabel.setText(text)
        self.buttonPanel = pyui2.widgets.Panel()
        self.buttonPanel.setLayout(pyui2.layouts.BorderLayoutManager())
        self.okButton = pyui2.widgets.Button("OK", self._pyui2OK)
        self.okButton.resize(self.innerRect[2]/2, self.okButton.height)
        self.cancelButton = pyui2.widgets.Button("Cancel", self._pyui2Cancel)
        self.cancelButton.resize(self.innerRect[2]/2, self.cancelButton.height)     
        self.buttonPanel.addChild(self.okButton, locals.WEST)
        self.buttonPanel.addChild(self.cancelButton, locals.EAST)
        self.buttonPanel.pack()
        
        self.addChild(self.textLabel, locals.CENTER)
        self.addChild(self.buttonPanel, locals.SOUTH)

        self.pack()
コード例 #20
0
ファイル: setup.py プロジェクト: simondlevy/hackflight
    def __init__(self, driver, simulation=False):

        Dialog.__init__(self, driver)

        # Vehicle dimensions
        W = VEHICLE_SCALE
        D = VEHICLE_SCALE / 2
        L = VEHICLE_SCALE * 2

        #Let these be in World-coordinates (worldview-matrix already applied)
        ####In right-handed, counter-clockwise order
        self.vehicle_points, self.vehicle_faces, self.vehicle_face_colors = get_vehicle(W, D, L)

        # Assume no angles to start
        self.yaw_pitch_roll = None

        # Rotation matrices
        self.pitchrot = np.eye(3)
        self.yawrot = np.eye(3)
        self.rollrot = np.eye(3)

        self.simulation = simulation
        self.running = False
コード例 #21
0
ファイル: motors.py プロジェクト: f8industries/hackflight
    def __init__(self, driver):

        Dialog.__init__(self, driver)

        # Add a quadcopter image for motor testing
        (self.image_motors,self.label_motors) = self._load_photo(MOTORS_IMAGE_FILE)
        (self.image_motors1,self.label_motors1) = self._load_photo(MOTORS1_IMAGE_FILE)
        (self.image_motors2,self.label_motors2) = self._load_photo(MOTORS2_IMAGE_FILE)
        (self.image_motors3,self.label_motors3) = self._load_photo(MOTORS3_IMAGE_FILE)
        (self.image_motors4,self.label_motors4) = self._load_photo(MOTORS4_IMAGE_FILE)

        # Add a warning checkbox for motor testing
        self.checkbox_var = IntVar()
        self.warning_motors = Checkbutton(self.driver.canvas, \
                variable=self.checkbox_var, command=self._checkbox_callback, \
                text=MOTORS_WARNING_TEXT, font=('Heletica', 14),  fg='red', bg='black', highlightthickness=0)

        # A a scale for motors
        self.scale = Scale(self.driver.canvas, from_=1850, to_=1000, command=self._scale_callback,
                orient=VERTICAL, length=MOTOR_SCALE_LENGTH, bg='black', fg='white')

        # Index of active motor (0 = none)
        self.active_motor = 0
コード例 #22
0
ファイル: textentrydialog.py プロジェクト: humdingers/pynxc
 def __init__(self, parent, title="Enter some text", prompt="Enter some text",
  default="", cancel_button=1):
     self.prompt = prompt
     self.default = default
     Dialog.__init__(self, parent, title, cancel_button=cancel_button)
コード例 #23
0
 def __init__(self, parent, title="Enter some text", prompt="Enter some text",
  default="", cancel_button=1):
     self.prompt = prompt
     self.default = default
     Dialog.__init__(self, parent, title, cancel_button=cancel_button)
コード例 #24
0
ファイル: map.py プロジェクト: dantheta/cursesfrp
	def __init__(self, *args):
		Dialog.__init__(self, *args)
		self.locations = locations
		self.setup()
コード例 #25
0
    def __init__(self, driver):

        Dialog.__init__(self, driver)

        self.running = False
コード例 #26
0
ファイル: mainwindow.py プロジェクト: 0install/old-cvs-export
    def __init__(self, prog_args):
        Dialog.__init__(self)
        self.set_title('Dependency Injector')
        self.set_default_size(400, 300)

        tips = gtk.Tooltips()

        # Network use
        hbox = gtk.HBox(False, 2)
        self.vbox.pack_start(hbox, False, True, 0)
        hbox.set_border_width(4)

        network = gtk.combo_box_new_text()
        for level in network_levels:
            network.append_text(level.capitalize())
        network.set_active(list(network_levels).index(policy.network_use))
        hbox.pack_start(gtk.Label('Network use:'), False, True, 0)
        hbox.pack_start(network, True, True, 2)

        def set_network_use(combo):
            policy.network_use = network_levels[network.get_active()]
            policy.save_config()
            policy.recalculate()

        network.connect('changed', set_network_use)

        hbox.show_all()

        # Freshness
        hbox = gtk.HBox(False, 2)
        self.vbox.pack_start(hbox, False, True, 0)
        hbox.set_border_width(4)

        times = [x.time for x in freshness_levels]
        if policy.freshness not in times:
            freshness_levels.append(
                Freshness(policy.freshness, '%d seconds' % policy.freshness))
            times.append(policy.freshness)
        freshness = gtk.combo_box_new_text()
        for level in freshness_levels:
            freshness.append_text(str(level))
        freshness.set_active(times.index(policy.freshness))
        hbox.pack_start(gtk.Label('Freshness:'), False, True, 0)
        hbox.pack_start(freshness, True, True, 2)

        def set_freshness(combo):
            policy.freshness = freshness_levels[freshness.get_active()].time
            policy.save_config()
            policy.recalculate()

        freshness.connect('changed', set_freshness)

        button = gtk.Button('Refresh all now')

        def refresh_all(b):
            for x in policy.walk_interfaces():
                policy.begin_iface_download(x, True)

        button.connect('clicked', refresh_all)
        hbox.pack_start(button, False, True, 2)

        hbox.show_all()

        # Tree view
        self.browser = InterfaceBrowser()
        self.vbox.pack_start(self.browser, True, True, 0)
        self.browser.show()

        # Select versions
        hbox = gtk.HBox(False, 2)
        self.vbox.pack_start(hbox, False, True, 0)
        hbox.set_border_width(4)

        button = gtk.Button()
        self.browser.edit_properties.connect_proxy(button)
        hbox.pack_start(button, False, True, 0)

        stable_toggle = gtk.CheckButton('Help test new versions')
        hbox.pack_start(stable_toggle, False, True, 0)
        tips.set_tip(
            stable_toggle,
            "Try out new versions as soon as they are available, instead of "
            "waiting for them to be marked as 'stable'. "
            "This sets the default policy. Click on 'Interface Properties...' "
            "to set the policy for an individual interface.")
        stable_toggle.set_active(policy.help_with_testing)

        def toggle_stability(toggle):
            policy.help_with_testing = toggle.get_active()
            policy.save_config()
            policy.recalculate()

        stable_toggle.connect('toggled', toggle_stability)

        hbox.show_all()

        # Progress bar
        self.progress = gtk.ProgressBar()
        self.vbox.pack_start(self.progress, False, True, 0)

        # Responses

        self.add_button(gtk.STOCK_HELP, gtk.RESPONSE_HELP)
        self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        self.add_button(gtk.STOCK_EXECUTE, gtk.RESPONSE_OK)
        self.set_default_response(gtk.RESPONSE_OK)

        def response(dialog, resp):
            if resp == gtk.RESPONSE_CANCEL:
                self.destroy()
            elif resp == gtk.RESPONSE_OK:
                import download_box
                download_box.download_and_run(self, prog_args)
            elif resp == gtk.RESPONSE_HELP:
                gui_help.display()

        self.connect('response', response)
コード例 #27
0
ファイル: receiver.py プロジェクト: simondlevy/Hackflight
    def __init__(self, gcs):

        Dialog.__init__(self, gcs)

        self.running = False
コード例 #28
0
ファイル: monsterguide.py プロジェクト: saltduck/magictower
 def __init__(self, location=(0, 0), surface=None):
     Dialog.__init__(self, (0, 0, 640, 640), (200, 200, 200), surface, closekey=pygame.K_ESCAPE, border_width=0, shadow_weight=0)
     self.font = pygame.font.Font(None, 30)
     self.player = get_game().player
     self.x, self.y = location
コード例 #29
0
ファイル: receiver.py プロジェクト: simondlevy/hackflight
    def __init__(self, driver):

        Dialog.__init__(self, driver)

        self.running = False
コード例 #30
0
ファイル: menu.py プロジェクト: dantheta/cursesfrp
	def __init__(self, parent, options):
		Dialog.__init__(self, parent, 6, 20, 1, 15)
		self.options = options
		self.sel = 0
		self.setup()