Пример #1
0
 def __init__(self, util, meter_type, ui_refresh_period, data_source):
     """ Initializer
     
     :param util: utility class
     :param meter_type: the type of the meter - linear or circular
     :param ui_refresh_period: refresh interval for animation
     :param data_source: audio data source
     """
     self.util = util
     self.meter_config = util.meter_config
     
     if getattr(util, "config", None):
         self.config = util.config
         self.rect = self.config[SCREEN_RECT]
     else:
         self.rect = self.util.meter_config[SCREEN_RECT]
             
     self.meter_type = meter_type
     self.ui_refresh_period = ui_refresh_period
     self.data_source = data_source       
     Container.__init__(self, util, self.rect, (0, 0, 0))
     self.max_volume = 100.0
     self.total_steps = 100
     self.origin_x = self.origin_y = 0
     self.meter_bounding_box = None
     self.bgr = None
     self.fgr = None
     self.left_sprites = None
     self.right_sprites = None
     self.needle_sprites = None
     self.mono_needle_rects = None
     self.left_needle_rects = None
     self.right_needle_rects = None
     self.masks = None
     self.channels = 1
Пример #2
0
    def __init__(self, window):
        """Class initialiser"""
        if isinstance(window.get_child(), gtk.Notebook):
            err('There is already a Notebook at the top of this window')
            raise(ValueError)

        Container.__init__(self)
        gtk.Notebook.__init__(self)
        self.terminator = Terminator()
        self.window = window
        gobject.type_register(Notebook)
        self.register_signals(Notebook)
        self.connect('switch-page', self.deferred_on_tab_switch)
        self.configure()

        child = window.get_child()
        window.remove(child)
        window.add(self)
        window_last_active_term = window.last_active_term
        self.newtab(widget=child)
        if window_last_active_term:
            self.set_last_active_term(window_last_active_term)
            window.last_active_term = None

        self.show_all()
Пример #3
0
 def __init__(self, util):
     """ Initializer
     
     :param util: utility object
     """        
     self.util = util
     self.config = util.config
     self.screen_w = self.config[SCREEN_INFO][WIDTH]
     self.screen_h = self.config[SCREEN_INFO][HEIGHT]
     self.lines = 12
     line_length = 52
     font_vertical_percent = 5
     
     self.lyrics_util = LyricsUtil(util.k2, self.lines, line_length)
     self.lyrics_not_found_label = self.config[LABELS][LYRICS_NOT_FOUND]
     
     plugin_folder = type(self).__name__.lower() 
     Screensaver.__init__(self, plugin_folder)
     self.bounding_box = util.screen_rect
     Container.__init__(self, util, self.bounding_box, (0, 0, 0))
             
     font_size = int((font_vertical_percent * self.bounding_box.h)/100)    
     self.f = util.get_font(font_size)
     self.lyrics_not_found = True
     
     c = Component(util, bgr=(0, 0, 0))
     self.set_not_found(c)
     self.add_component(c)
     self.current_page = 1
     self.current_song = ""
Пример #4
0
    def __init__(self, util=None):
        """ Initializer
        
        :param util: utility object
        """
        ScreensaverWeather.__init__(self)
        self.config = None
        self.set_util(util)
        self.update_period = self.util.weather_config[UPDATE_PERIOD]

        if self.util.weather_config[USE_LOGGING]:
            logging.basicConfig(level=logging.NOTSET)
        else:
            logging.disable(logging.CRITICAL)

        if self.config != None:
            self.rect = util.screen_rect
            self.util.weather_config["screen.rect"] = util.screen_rect
        else:
            self.init_display()
            self.rect = self.util.weather_config["screen.rect"]

        plugin_folder = type(self).__name__.lower()
        images_folder = os.path.join(PACKAGE_SCREENSAVER, plugin_folder,
                                     DEFAULT_IMAGES_FOLDER)
        self.images = util.load_background_images(images_folder)
        self.indexes = cycle(range(len(self.images)))

        Container.__init__(self, self.util, self.rect, BLACK)
Пример #5
0
    def __init__(self):
        """Class initialiser"""
        self.terminator = Terminator()
        self.terminator.register_window(self)

        Container.__init__(self)
        gtk.Window.__init__(self)
        gobject.type_register(Window)
        self.register_signals(Window)

        self.set_property("allow-shrink", True)
        self.apply_icon()

        self.register_callbacks()
        self.apply_config()

        self.title = WindowTitle(self)
        self.title.update()

        options = self.config.options_get()
        if options:
            if options.forcedtitle is not None:
                self.title.force_title(options.forcedtitle)

            if options.role is not None:
                self.set_role(options.role)

            if options.geometry is not None:
                if not self.parse_geometry(options.geometry):
                    err("Window::__init__: Unable to parse geometry: %s" % options.geometry)

        self.pending_set_rough_geometry_hint = False
Пример #6
0
    def __init__(self, axis, **kwargs):
        Container.__init__(self, **kwargs)

        self._axis = axis
        self.padding = (kwargs.get("hpadding", 5), kwargs.get("vpadding", 5))

        self.expandable[self._axis] = True
Пример #7
0
    def __init__(self, axis, **kwargs):
        Container.__init__(self, **kwargs)

        self._axis = axis
        self.padding = (kwargs.get('hpadding', 5), kwargs.get('vpadding', 5))

        self.expandable[self._axis] = True
Пример #8
0
    def __init__(self, util, meter_type, ui_refresh_period, data_source):
        """ Initializer
        
        :param util: utility class
        :param meter_type: the type of the meter - linear or circular
        :param ui_refresh_period: refresh interval for animation
        :param data_source: audio data source
        """
        self.util = util
        self.meter_config = util.meter_config

        if getattr(util, "config", None):
            self.config = util.config
            self.rect = self.config[SCREEN_RECT]
        else:
            self.rect = self.util.meter_config[SCREEN_RECT]

        self.meter_type = meter_type
        self.ui_refresh_period = ui_refresh_period
        self.data_source = data_source
        Container.__init__(self, util, self.rect, (0, 0, 0))
        self.max_volume = 100.0
        self.total_steps = 100
        self.origin_x = self.origin_y = 0
        self.meter_bounding_box = None
        self.bgr = None
        self.fgr = None
        self.left_sprites = None
        self.right_sprites = None
        self.needle_sprites = None
        self.mono_needle_rects = None
        self.left_needle_rects = None
        self.right_needle_rects = None
        self.masks = None
        self.channels = 1
Пример #9
0
    def __init__(self, window):
        """Class initialiser"""
        if isinstance(window.get_child(), Gtk.Notebook):
            err('There is already a Notebook at the top of this window')
            raise (ValueError)

        Container.__init__(self)
        GObject.GObject.__init__(self)
        self.terminator = Terminator()
        self.window = window
        GObject.type_register(Notebook)
        self.register_signals(Notebook)
        self.connect('switch-page', self.deferred_on_tab_switch)
        self.connect('scroll-event', self.on_scroll_event)
        self.configure()

        child = window.get_child()
        window.remove(child)
        window.add(self)
        window_last_active_term = window.last_active_term
        self.newtab(widget=child)
        if window_last_active_term:
            self.set_last_active_term(window_last_active_term)
            window.last_active_term = None

        self.show_all()
Пример #10
0
    def __init__(self):
        """Class initialiser"""
        self.terminator = Terminator()
        self.terminator.register_window(self)

        Container.__init__(self)
        gtk.Window.__init__(self)
        gobject.type_register(Window)
        self.register_signals(Window)

        self.set_property('allow-shrink', True)
        self.apply_icon()

        self.register_callbacks()
        self.apply_config()

        self.title = WindowTitle(self)
        self.title.update()

        options = self.config.options_get()
        if options:
            if options.forcedtitle is not None:
                self.title.force_title(options.forcedtitle)

            if options.role is not None:
                self.set_role(options.role)

            if options.geometry is not None:
                if not self.parse_geometry(options.geometry):
                    err('Window::__init__: Unable to parse geometry: %s' %
                        options.geometry)

        self.pending_set_rough_geometry_hint = False
Пример #11
0
 def __init__(self):
     """Class initialiser"""
     self.terminator = Terminator()
     self.maker = Factory()
     Container.__init__(self)
     self.signals.append({'name': 'resize-term', 
                          'flags': gobject.SIGNAL_RUN_LAST,
                          'return_type': gobject.TYPE_NONE, 
                          'param_types': (gobject.TYPE_STRING,)})
Пример #12
0
	def __init__(self, x, y, w, h, **kwargs):
		'''Create a vertical layout
		
		Keyword arguments:
		name -- unique widget identifier
		padding -- vertical space between child items
		'''
		self.padding = kwargs.get('padding', 5)
		
		Container.__init__(self, x, y, w, h, **kwargs)
Пример #13
0
	def __init__(self, theme, **kwargs):
		"""Create a frame
		
		Keyword arguments:
		children -- list of child elements to be added to this container
		"""
		Container.__init__(self, **kwargs)
		
		self.names = {}
		self.focus = []
		
		self.theme = theme
Пример #14
0
	def __init__(self, theme, **kwargs):
		"""Create a frame
		
		Keyword arguments:
		children -- list of child elements to be added to this container
		"""
		Container.__init__(self, **kwargs)
		
		self.names = {}
		self.focus = []
		
		self.theme = theme
Пример #15
0
 def __init__(self,caption=""):
     Container.__init__(self)
     self.mMoved=False
     self.mDragOffsetX=-1
     self.mDragOffsetY=-1
     self.setCaption(caption)
     self.setFrameSize(1)
     self.setPadding(2)
     self.setTitleBarHeight(16)
     self.setAlignment(Graphics.CENTER)
     self.addMouseListener(self)
     self.setMovable(True)
     self.setOpaque(True)
Пример #16
0
 def __init__(self, default_name, pref_id, light=1, safe=False, indoor=False, mod=None):
     """Initialize the room. Set <light> level to 0 for a dark room."""
     Container.__init__(self, default_name, path=pref_id, pref_id=pref_id)
     self.exits = {}
     self.set_max_weight_carried(4e9)
     self.set_max_volume_carried(3e9)
     self.actions.append(Action(self.go_to, ["go", "walk"], True, False))
     self.actions.append(Action(self.look_at, ["look", "examine"], True, True))
     self.fix_in_place("You can't move that!")
     self.closable = False
     self.default_light = light  # Can see and perceive emits when light level > 0
     self.monster_safe = safe
     self.indoor = indoor
     self.mod = mod
Пример #17
0
    def __init__(self, children=[], homogeneous=True, spacing=1):
        ''' Create horizontal box

        :Parameters:
            children : [glydget.Widget, ...]
                Initial list of children
            homogeneous : bool
                If true all children are given equal space allocations.
            spacing : int
                The horizontal space between children in pixels.
        '''
        self._spacing = spacing
        self._homogeneous = homogeneous
        Container.__init__(self, children)
        self.style = theme.Container
Пример #18
0
    def __init__(self, children=[], homogeneous=True, spacing=1):
        ''' Create horizontal box

        :Parameters:
            children : [glydget.Widget, ...]
                Initial list of children
            homogeneous : bool
                If true all children are given equal space allocations.
            spacing : int
                The horizontal space between children in pixels.
        '''
        self._spacing = spacing
        self._homogeneous = homogeneous
        Container.__init__(self, children)
        self.style = theme.Container
Пример #19
0
    def __init__(self, children=[], homogeneous=False, spacing=1):
        """
        :Parameters:

        `children` : [glydget.widget.Widget, ...]
            Initial list of children
        `homogeneous` : bool
            If true all children are given equal space allocations.
        `spacing` : int
            The horizontal space between children in pixels.
        """

        self._spacing = spacing
        self._homogeneous = homogeneous
        Container.__init__(self, children)
        self.style = theme.Container
Пример #20
0
 def __init__(self,
              position,
              size,
              children=[],
              format=GL_RGB8,
              *args,
              **kwargs):
     Container.__init__(self,
                        sort_key=lambda x: x.__zorder,
                        children=children)
     FBOWidget.__init__(self,
                        position,
                        size,
                        *args,
                        format=format,
                        **kwargs)
Пример #21
0
    def __init__(self, children=[], homogeneous=False, spacing=1):
        '''
        :Parameters:

        `children` : [glydget.widget.Widget, ...]
            Initial list of children
        `homogeneous` : bool
            If true all children are given equal space allocations.
        `spacing` : int
            The horizontal space between children in pixels.
        '''

        self._spacing = spacing
        self._homogeneous = homogeneous
        Container.__init__(self, children)
        self.style = theme.Container
Пример #22
0
 def draw_weather(self):
     """ Draw weather forecast  """
     
     c = self.util.weather_config[COLOR_DARK]
     Container.__init__(self, self.util, self.rect, BLACK)
     
     c = Component(self.util)
     c.content = self.initial_image
     c.content_x = 0
     c.content_y = 0
     c.bounding_box = self.rect
     self.add_component(c)  
     
     widths = self.get_widths()
     heights = self.get_heights()
     
     self.draw_tiles(widths, heights)
Пример #23
0
    def __init__(self):
        """Class initialiser"""
        self.terminator = Terminator()
        self.terminator.register_window(self)

        Container.__init__(self)
        GObject.GObject.__init__(self)
        GObject.type_register(Window)
        self.register_signals(Window)

        self.get_style_context().add_class("terminator-terminal-window")

        #        self.set_property('allow-shrink', True)  # FIXME FOR GTK3, or do we need this actually?
        icon_to_apply = ''

        self.register_callbacks()
        self.apply_config()

        self.title = WindowTitle(self)
        self.title.update()

        options = self.config.options_get()
        if options:
            if options.forcedtitle:
                self.title.force_title(options.forcedtitle)

            if options.role:
                self.set_role(options.role)


#            if options.classname is not None:
#                self.set_wmclass(options.classname, self.wmclass_class)

            if options.forcedicon is not None:
                icon_to_apply = options.forcedicon

            if options.geometry:
                if not self.parse_geometry(options.geometry):
                    err('Window::__init__: Unable to parse geometry: %s' %
                        options.geometry)

        self.apply_icon(icon_to_apply)
        self.pending_set_rough_geometry_hint = False
Пример #24
0
 def draw_weather(self):
     """ Draw Today's weather """
     
     Container.__init__(self, self.util, self.rect, BLACK)
     
     c = Component(self.util)
     c.content = self.initial_image
     c.content_x = 0
     c.content_y = 0
     c.bounding_box = self.rect
     self.add_component(c)       
     
     top_height = self.draw_top_background()
     self.draw_bottom_background()
     self.draw_city(top_height)
     self.draw_time(top_height)        
     self.draw_code()
     self.draw_temp()        
     self.draw_high_low()         
     self.draw_details()
Пример #25
0
    def __init__(self, window):
        """Class initialiser"""
        if isinstance(window.get_child(), gtk.Notebook):
            err('There is already a Notebook at the top of this window')
            raise (ValueError)

        Container.__init__(self)
        gtk.Notebook.__init__(self)
        self.terminator = Terminator()
        self.window = window
        gobject.type_register(Notebook)
        self.register_signals(Notebook)
        self.configure()

        child = window.get_child()
        window.remove(child)
        window.add(self)
        self.newtab(widget=child)

        self.show_all()
Пример #26
0
    def __init__(self, window):
        """Class initialiser"""
        if isinstance(window.get_child(), gtk.Notebook):
            err('There is already a Notebook at the top of this window')
            raise(ValueError)

        Container.__init__(self)
        gtk.Notebook.__init__(self)
        self.terminator = Terminator()
        self.window = window
        gobject.type_register(Notebook)
        self.register_signals(Notebook)
        self.configure()

        child = window.get_child()
        window.remove(child)
        window.add(self)
        self.newtab(widget=child)

        self.show_all()
Пример #27
0
    def __init__(self):
        """Class initialiser"""
        self.terminator = Terminator()
        self.terminator.register_window(self)

        Container.__init__(self)
        GObject.GObject.__init__(self)
        GObject.type_register(Window)
        self.register_signals(Window)

        self.get_style_context().add_class("terminator-terminal-window")

#        self.set_property('allow-shrink', True)  # FIXME FOR GTK3, or do we need this actually?
        icon_to_apply=''

        self.register_callbacks()
        self.apply_config()

        self.title = WindowTitle(self)
        self.title.update()
        
        self.preventHide = False

        options = self.config.options_get()
        if options:
            if options.forcedtitle:
                self.title.force_title(options.forcedtitle)

            if options.role:
                self.set_role(options.role)
            
            if options.forcedicon is not None:
                icon_to_apply = options.forcedicon

            if options.geometry:
                if not self.parse_geometry(options.geometry):
                    err('Window::__init__: Unable to parse geometry: %s' % 
                            options.geometry)

        self.apply_icon(icon_to_apply)
        self.pending_set_rough_geometry_hint = False
Пример #28
0
    def __init__(self, util=None):
        """ Initializer
        
        :param util: utility object
        """
        ScreensaverWeather.__init__(self)
        self.config = None
        self.set_util(util)
        self.update_period = self.util.weather_config[UPDATE_PERIOD]
        self.name = "peppyweather"

        if self.util.weather_config[USE_LOGGING]:
            logging.basicConfig(level=logging.NOTSET)
        else:
            logging.disable(logging.CRITICAL)

        if self.config != None:
            self.rect = util.screen_rect
            self.util.weather_config["screen.rect"] = util.screen_rect
        else:
            self.init_display()
            self.rect = self.util.weather_config["screen.rect"]

        self.images = []
        bgr = util.config[BACKGROUND][SCREEN_BGR_COLOR]
        bgr_count = util.image_util.get_background_count()
        if bgr_count > 1:
            count = 4
        else:
            count = 1
        r = random.sample(range(0, bgr_count), count)
        br = 4
        for n in r:
            img = util.get_background(self.name + "." + str(n),
                                      bgr,
                                      index=n,
                                      blur_radius=br)
            self.images.append((img[3], img[2]))

        self.indexes = cycle(range(len(self.images)))
        Container.__init__(self, self.util, self.rect, BLACK)
Пример #29
0
class Window(Container):
    '''
    Window for gui
    '''

    def __init__(self, (width, height), position):
        Container.__init__(self, (width, height), position)
        self.alphavalue = 196
        #border
        self.showborder = True
        self.bordercolor = (128, 128, 0)
        self.bordersize = 2
        self.backgroundcolor = (80, 80, 80, self.alphavalue)
Пример #30
0
 def __init__(self, default_name, path, pref_id=None):
     Container.__init__(self, default_name, pref_id)
     self.closed = True
     self.closable = False
     self.see_inside = False
     self.hitpoints = 10  # default hitpoints
     self.health = self.hitpoints  # default full health (0 health --> dead)
     self.enemies = []
     self.viewed = False
     self.armor_class = 0
     self.combat_skill = 0
     self.strength = 0
     self.dexterity = 1
     self.default_weapon = Weapon("bare hands", None, 1, 5, 1)
     self.default_armor = Armor("skin", path, 0, 0)
     self.weapon_wielding = self.default_weapon
     self.armor_worn = self.default_armor
     self.closed_err = "You can't put things in creatures!"
     self.visible_inventory = [
     ]  #Things the creature is holding, you can see them.
     self.invisible = False
     self.introduced = set()
     self.proper_name = default_name.capitalize()
Пример #31
0
	def __init__(self, **kwargs):
		kwargs.setdefault('w', 150)
		
		Container.__init__(self, **kwargs)
		
		self.padding = (kwargs.get('hpadding', 5), kwargs.get('vpadding', 5))
Пример #32
0
 def __init__(self, **kwargs):
     Container.__init__(self)
     self.window_class = kwargs['window_class']
     self.window_title = kwargs.get('window_title', None)
Пример #33
0
 def __init__(self):
     Container.__init__(self)
Пример #34
0
	def __init__(self, **kwargs):
		kwargs.setdefault('w', 150)
		
		Container.__init__(self, **kwargs)
		
		self.padding = (kwargs.get('hpadding', 5), kwargs.get('vpadding', 5))
Пример #35
0
    def __init__(self, **kwargs):
        kwargs.setdefault("w", 150)

        Container.__init__(self, **kwargs)

        self.padding = (kwargs.get("hpadding", 5), kwargs.get("vpadding", 5))
Пример #36
0
 def __init__(self, component, **traits):
     self.component = component
     Container.__init__(self, **traits)
     self._viewport_component_changed()
     return
Пример #37
0
	def __init__(self, position, size, children=[], format=GL_RGB8, *args, **kwargs):
		Container.__init__(self, sort_key=lambda x: x.__zorder, children=children)
		FBOWidget.__init__(self, position, size, *args, format=format, **kwargs)
Пример #38
0
 def __init__(self, children=[], homogeneous=False, spacing=1):
     self._spacing = spacing
     self._homogeneous = homogeneous
     Container.__init__(self, children)
     self.style = theme.Container