Exemplo n.º 1
0
	def __init__(self, parent, mo):
		self.log = logging.getLogger('MINICAL')
		self.parent = parent
		self.mo = mo
		self.factory = Factory()

		self.__stop_auto_highlight = False # Disable automatic highlighting of events.
		self.__stop_auto_dayjump = False   # Disable automatically jumping to the start of the event on selection.
		self.__stop_auto_treeview_update = False   # FIXME

		GladeSlaveDelegate.__init__(self, gladefile='mo_tab_events', toplevel_name='window_main')

		# Set up the user interface
		eventColumns = [
			Column('start', title='Start', data_type=datetime.datetime, sorted=True),
			Column('end', title='End', data_type=datetime.datetime),
			Column('summaryformat', title='Summary', use_markup=True),
			Column('duration', title='Duration', justify=gtk.JUSTIFY_RIGHT)
		]
		self.treeview_event = ObjectTree(eventColumns)
		self.vbox_eventslist.add(self.treeview_event)
		self.combobox_display_range.set_active(self.show_ranges.index(self.mo.config['events.default_show'].lower()))
		cal_options = gtk.CALENDAR_WEEK_START_MONDAY
		if self.mo.config['events.cal_show_weeknr']:
			cal_options |= gtk.CALENDAR_SHOW_WEEK_NUMBERS
		self.calendar.set_display_options((self.calendar.get_display_options() | cal_options))

		# Connect signals
		self.treeview_event.connect('selection-changed', self.treeview_event__selection_changed)
		self.treeview_event.connect('row-activated', self.treeview_event__row_activated)
		self.treeview_event.connect('key-press-event', self.treeview_event__key_press_event)

		self.on_toolbutton_today__clicked()
Exemplo n.º 2
0
 def __init__(self, parent, reptype = None):
 
         GladeSlaveDelegate.__init__(self, "ui", toplevel_name = 'ReportWindow')
         dic_reps = {'inventory' : self._inventory_report }
         
         print 'AAAAAAA', dic_reps
         self.show_report(report = dic_reps[reptype]())
Exemplo n.º 3
0
    def __init__(self, parent):

        self.__parent = parent

        GladeSlaveDelegate.__init__(self,
                                    gladefile='ui',
                                    toplevel_name='VulnerabilityWindow')

        self.list = self.get_widget('list_vulnerability')

        cols = [
            Column('description',
                   title=_('Description'),
                   data_type=unicode,
                   expand=True,
                   sorted=True,
                   editable=True),
            Column('severity',
                   title=_('Severity'),
                   data_type=int,
                   editable=True),
            Column('chance',
                   title=_('Probability'),
                   data_type=int,
                   editable=True)
        ]

        self.list.set_columns(cols)

        vulns = Vulnerability.query().all()

        if vulns is not None:
            for item in vulns:
                self.list.append(item)
Exemplo n.º 4
0
    def __init__(self, parent):

        self.__parent = parent

        GladeSlaveDelegate.__init__(self,
                                    gladefile='controls',
                                    toplevel_name='ControlsWindow')
Exemplo n.º 5
0
    def __init__(self, model=None, statusbar=None):
        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)

        self.model = model

        filecolumns = [Column('path', data_type=str, title="Arquivo", expand=True, searchable=True)]
        self.filelist.set_columns(filecolumns)
Exemplo n.º 6
0
 def __init__(self, parent):
     
     self.__parent = parent
     
     GladeSlaveDelegate.__init__(self,  
                                 gladefile = 'controls',
                                 toplevel_name = 'ControlsWindow')
     
     
Exemplo n.º 7
0
    def __init__(self, model=None):
        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)

        self.model = model or self
 
        # Creates a list of created scripts
        scriptcolumns = [Column('path', data_type=str, title="Script gerado"),\
                         Column("type", data_type=str, title="Tipo")]
        self.model.scriptlist.set_columns(scriptcolumns)
Exemplo n.º 8
0
    def __init__(self, store, model=None, visual_mode=False, edit_mode=None):
        """ A base class for editor slaves inheritance

        :param store: a store
        :param model: the object model tied with the proxy widgets
        :param visual_mode: does this slave must be opened in visual mode?
                            if so, all the proxy widgets will be disable
        :param edit_mode: indicate if the slave are being edited or its a new one
                          The editor that creates the slave should pass his
                          property edit_mode to the slaves.
                          If None self.edit_mode will be defined accordingly to
                          the model
        """
        self.store = store
        # FIXME: Need to check if we need to add edit_mode parameter for all classes
        # that inherit from BaseEditor
        if edit_mode is not None:
            self.edit_mode = edit_mode
        else:
            self.edit_mode = model is not None
        self.visual_mode = visual_mode

        if model:
            created = ""
        else:
            created = "created "
            model = self.create_model(self.store)

            if model is None:
                fmt = "%s.create_model() must return a valid model, not %r"
                raise ValueError(fmt % (self.__class__.__name__, model))

        log.info("%s editor using a %smodel %s" % (
            self.__class__.__name__, created, type(model).__name__))

        if self.model_type:
            if not isinstance(model, self.model_type):
                fmt = '%s editor requires a model of type %s, got a %r'
                raise TypeError(
                    fmt % (self.__class__.__name__,
                           self.model_type.__name__,
                           model))
        else:
            fmt = "Editor %s must define a model_type attribute"
            raise ValueError(fmt % (self.__class__.__name__, ))
        self.model = model

        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
        if self.visual_mode:
            self._setup_visual_mode()
        self.setup_proxies()
        self.setup_slaves()

        EditorSlaveCreateEvent.emit(self, model, store, visual_mode)
Exemplo n.º 9
0
    def __init__(self, store, model=None, visual_mode=False, edit_mode=None):
        """ A base class for editor slaves inheritance

        :param store: a store
        :param model: the object model tied with the proxy widgets
        :param visual_mode: does this slave must be opened in visual mode?
                            if so, all the proxy widgets will be disable
        :param edit_mode: indicate if the slave are being edited or its a new one
                          The editor that creates the slave should pass his
                          property edit_mode to the slaves.
                          If None self.edit_mode will be defined accordingly to
                          the model
        """
        self.store = store
        # FIXME: Need to check if we need to add edit_mode parameter for all classes
        # that inherit from BaseEditor
        if edit_mode is not None:
            self.edit_mode = edit_mode
        else:
            self.edit_mode = model is not None
        self.visual_mode = visual_mode

        if model:
            created = ""
        else:
            created = "created "
            model = self.create_model(self.store)

            if model is None:
                fmt = "%s.create_model() must return a valid model, not %r"
                raise ValueError(fmt % (self.__class__.__name__, model))

        log.info("%s editor using a %smodel %s" % (
            self.__class__.__name__, created, type(model).__name__))

        if self.model_type:
            if not isinstance(model, self.model_type):
                fmt = '%s editor requires a model of type %s, got a %r'
                raise TypeError(
                    fmt % (self.__class__.__name__,
                           self.model_type.__name__,
                           model))
        else:
            fmt = "Editor %s must define a model_type attribute"
            raise ValueError(fmt % (self.__class__.__name__, ))
        self.model = model

        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
        if self.visual_mode:
            self._setup_visual_mode()
        self.setup_proxies()
        self.setup_slaves()

        EditorSlaveCreateEvent.emit(self, model, store, visual_mode)
Exemplo n.º 10
0
    def __init__(self, parent):
        self.parent = parent
        # Be carefull that, when passing the widget list, the sizegroups
        # that you want to be merged are in the list, otherwise, they wont
        # be.
        GladeSlaveDelegate.__init__(self, gladefile="slave_view.ui", toplevel_name="window_container")

        self.slave = NestedSlave(self)
        self.attach_slave("eventbox", self.slave)
        self.slave.show()
        self.slave.focus_toplevel()  # Must be done after attach
Exemplo n.º 11
0
    def __init__(self, parent):
        self.parent = parent
        # Be carefull that, when passing the widget list, the sizegroups
        # that you want to be merged are in the list, otherwise, they wont
        # be.
        GladeSlaveDelegate.__init__(self, gladefile="slave_view.ui",
                                    toplevel_name="window_container")

        self.slave = NestedSlave(self)
        self.attach_slave("eventbox", self.slave)
        self.slave.show()
        self.slave.focus_toplevel()  # Must be done after attach
Exemplo n.º 12
0
    def __init__(self, store=None, payment_type=None, default_method=None):
        self._default_method = default_method
        self._widgets = {}
        self._methods = {}
        self._selected_method = None

        if payment_type is None:
            raise ValueError("payment_type must be set")
        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)

        self.store = store
        self._setup_payment_methods(payment_type)
Exemplo n.º 13
0
    def __init__(self, store, sales, parent=None):
        self.store = store
        if sales.get_selection_mode() != gtk.SELECTION_BROWSE:
            raise TypeError("Only SELECTION_BROWSE mode for the " "list is supported on this slave")
        self.sales = sales
        self.parent = parent
        self._report_filters = []

        GladeSlaveDelegate.__init__(self)

        self._update_print_button(False)
        self.update_buttons()
Exemplo n.º 14
0
    def __init__(self, payment_type, group, branch, method, total_value,
                 editor_class, parent):
        self.parent = parent
        self.branch = branch
        self.payment_type = payment_type
        self.group = group
        self.total_value = total_value
        self.editor_class = editor_class
        self.method = method

        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
        self._setup_widgets()
Exemplo n.º 15
0
    def __init__(self, store, sales, parent=None):
        self.store = store
        if sales.get_selection_mode() != gtk.SELECTION_BROWSE:
            raise TypeError("Only SELECTION_BROWSE mode for the "
                            "list is supported on this slave")
        self.sales = sales
        self.parent = parent
        self._report_filters = []

        GladeSlaveDelegate.__init__(self)

        self._update_print_button(False)
        self.update_buttons()
Exemplo n.º 16
0
 def __init__(self, parent):
     
     self.__parent = parent
     
     GladeSlaveDelegate.__init__(self,  
                                 gladefile = 'ui',
                                 toplevel_name = 'InventoryWindow')
     self.list = self.get_widget('invent_list')
     cols = [ Column('name', title = _('Name'), data_type = unicode, 
                     searchable = True, sorted = True),
              Column('description', title = _('Description'), data_type = unicode, 
                     expand = True),
              Column('owner', title = _('Owner'), data_type = unicode),
              Column('value', title = _('Value'), data_type = currency)]
     self.list.set_columns(cols)
     self.populate_list()
Exemplo n.º 17
0
    def __init__(self, store, model=None, visual_mode=False):
        """ A base class for editor slaves inheritance

        :param store: a store
        :param model: the object model tied with the proxy widgets
        :param visual_mode: does this slave must be opened in visual mode?
                            if so, all the proxy widgets will be disable
        """
        self.store = store
        self.edit_mode = model is not None
        self.visual_mode = visual_mode

        if model:
            created = ""
        else:
            created = "created "
            model = self.create_model(self.store)

            if model is None:
                raise ValueError(
                    "%s.create_model() must return a valid model, not %r" % (
                    self.__class__.__name__, model))

        log.info("%s editor using a %smodel %s" % (
            self.__class__.__name__, created, type(model).__name__))

        if self.model_type:
            if not isinstance(model, self.model_type):
                raise TypeError(
                    '%s editor requires a model of type %s, got a %r' % (
                    self.__class__.__name__, self.model_type.__name__,
                    model))
        else:
            raise ValueError("Editor %s must define a model_type "
                             "attribute" % (
                self.__class__.__name__, ))
        self.model = model

        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
        if self.visual_mode:
            self._setup_visual_mode()
        self.setup_proxies()
        self.setup_slaves()

        EditorSlaveCreateEvent.emit(self, model, store, visual_mode)
Exemplo n.º 18
0
    def __init__(self, store=None, payment_type=None, default_method=None,
                 no_payments=False):
        """
        :param no_payments: if ``True``, add the option "No payments" that
        doesn't create any payments.
        """
        self._default_method = default_method
        self._no_payments = no_payments
        self._widgets = {}
        self._methods = {}
        self._selected_method = None

        if payment_type is None:
            raise ValueError("payment_type must be set")
        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)

        self.store = store
        self._setup_payment_methods(payment_type)
Exemplo n.º 19
0
    def __init__(self, model=None, scripts=None, statusbar=None):
        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)

        assert model, "Model should not be None"
        self.model = model

        self.statusbar = statusbar

        self.fileTree.set_columns([Column('name', data_type=str, searchable=True, 
                                   expand=True)])

        #XXX: This argument is not necessary anymore since we should use model data to fill list
        if scripts:
            self._set_message("")
            self._fill(scripts)

        self._enable_drag_and_drop()
        self._setup_context_menu()
Exemplo n.º 20
0
	def __init__(self, dt = None):
		if not dt:
			self.dt = datetime.datetime.now()
		else:
			self.dt = dt
			
		# Set up the user interface
		GladeSlaveDelegate.__init__(self, gladefile="mo_datetime_edit", toplevel_name="window_main")

		self.entry_date = DateEntry()
		self.entry_time = ProxyEntry(data_type=datetime.time)
		self.set_datetime(self.dt)
		self.entry_date.connect('changed', self.entry_date__changed)
		self.entry_time.connect('changed', self.entry_time__changed)
		self.hbox.pack_start(self.entry_date, expand=False, fill=False)
		self.hbox.pack_start(self.entry_time, expand=False, fill=False)

		self.show()
Exemplo n.º 21
0
    def __init__(self, store, model=None, visual_mode=False):
        """ A base class for editor slaves inheritance

        :param store: a store
        :param model: the object model tied with the proxy widgets
        :param visual_mode: does this slave must be opened in visual mode?
                            if so, all the proxy widgets will be disable
        """
        self.store = store
        self.edit_mode = model is not None
        self.visual_mode = visual_mode

        if model:
            created = ""
        else:
            created = "created "
            model = self.create_model(self.store)

            if model is None:
                raise ValueError(
                    "%s.create_model() must return a valid model, not %r" %
                    (self.__class__.__name__, model))

        log.info("%s editor using a %smodel %s" %
                 (self.__class__.__name__, created, type(model).__name__))

        if self.model_type:
            if not isinstance(model, self.model_type):
                raise TypeError(
                    '%s editor requires a model of type %s, got a %r' %
                    (self.__class__.__name__, self.model_type.__name__, model))
        else:
            raise ValueError("Editor %s must define a model_type "
                             "attribute" % (self.__class__.__name__, ))
        self.model = model

        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
        if self.visual_mode:
            self._setup_visual_mode()
        self.setup_proxies()
        self.setup_slaves()

        EditorSlaveCreateEvent.emit(self, model, store, visual_mode)
Exemplo n.º 22
0
    def __init__(self,
                 store=None,
                 payment_type=None,
                 methods=None,
                 default_method=None):
        methods = methods or []
        self._widgets = {}
        self._methods = {}
        self._selected_method = None

        if payment_type is None:
            raise ValueError("payment_type must be set")
        GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)

        self.store = store
        self._setup_payment_methods(payment_type)

        if default_method is None:
            default_method = 'money'
        self._default_method = default_method
        self._select_default_method()
Exemplo n.º 23
0
	def __init__(self, parent, mo):
		self.parent = parent
		self.mo = mo
		self.factory = Factory()

		# Set up the user interface
		GladeSlaveDelegate.__init__(self, gladefile="mo_tab_notes", toplevel_name="window_main")
	
		noteColumns = [
			Column("summary", title='Title', data_type=str),
		]
		#self.treeview_note = ObjectList(noteColumns)
		self.treeview_note = ObjectTree(noteColumns)
		self.vbox_notelist.add(self.treeview_note)

		# Connect signals
		self.treeview_note.connect('row-activated', self.treeview_note__row_activated)
		self.treeview_note.connect('selection-changed', self.treeview_note__selection_changed)
		self.treeview_note.connect('key-press-event', self.treeview_note__key_press_event)

		self.refresh()
Exemplo n.º 24
0
    def __init__(self, parent):

        self.__parent = parent

        GladeSlaveDelegate.__init__(self,
                                    gladefile='ui',
                                    toplevel_name='InventoryWindow')
        self.list = self.get_widget('invent_list')
        cols = [
            Column('name',
                   title=_('Name'),
                   data_type=unicode,
                   searchable=True,
                   sorted=True),
            Column('description',
                   title=_('Description'),
                   data_type=unicode,
                   expand=True),
            Column('owner', title=_('Owner'), data_type=unicode),
            Column('value', title=_('Value'), data_type=currency)
        ]
        self.list.set_columns(cols)
        self.populate_list()
Exemplo n.º 25
0
    def __init__(self, parent):
        
        self.__parent = parent
        
        GladeSlaveDelegate.__init__(self,  
                                    gladefile = 'ui',
                                    toplevel_name = 'VulnerabilityWindow')
        
        self.list = self.get_widget('list_vulnerability')

        cols = [ Column('description', title = _('Description'), data_type = unicode,
                        expand = True, sorted = True, editable = True),
                 Column('severity', title = _('Severity'), data_type = int,
                        editable = True),
                 Column('chance', title = _('Probability'), data_type = int,
                        editable = True) ]
        
        self.list.set_columns(cols)
        
        vulns = Vulnerability.query().all()
        
        if vulns is not None:
            for item in vulns:
                self.list.append(item)
Exemplo n.º 26
0
	def __init__(self, parent, mo):
		self.parent = parent
		self.mo = mo
		self.factory = Factory()

		GladeSlaveDelegate.__init__(self, gladefile="mo_tab_todo", toplevel_name="window_main")

		# Set up the user interface
		todoColumns = [
			Column("done", title='Done', data_type=bool, editable=True),
			Column("summaryformat", title='Summary', use_markup=True),
			Column('priority', title='Priority', sorted=True, order=gtk.SORT_DESCENDING),
			ColoredColumn('due', title='Due', data_type=datetime.datetime, color='red', data_func=self.color_due),
			Column('created', title='Created', data_type=datetime.datetime)
		]
		self.treeview_todo = ObjectTree(todoColumns)
		self.vbox_todolist.add(self.treeview_todo)

		# Connect signals
		self.treeview_todo.connect('row-activated', self.treeview_todo__row_activated)
		self.treeview_todo.connect('selection-changed', self.treeview_todo__selection_changed)
		self.treeview_todo.connect('key-press-event', self.treeview_todo__key_press_event)

		self.refresh()
Exemplo n.º 27
0
 def __init__(self, store, parent=None, visual_mode=False):
     self._parent = parent
     self.store = store
     self.visual_mode = visual_mode
     GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
     self._setup_widgets()
Exemplo n.º 28
0
 def __init__(self, store, parent=None, visual_mode=False):
     self._parent = parent
     self.store = store
     self.visual_mode = visual_mode
     GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
     self._setup_widgets()
Exemplo n.º 29
0
 def __init__(self, employee):
     self.employee = employee
     GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
     self._setup_widgets()
Exemplo n.º 30
0
 def __init__(self, parent):
     self.parent = parent
     GladeSlaveDelegate.__init__(self,
                                 gladefile="slave_view2.ui",
                                 toplevel_name="window_container")
Exemplo n.º 31
0
 def __init__(self, parent):
     self.parent = parent
     GladeSlaveDelegate.__init__(self, gladefile="slave_view2.ui",
                                 toplevel_name="window_container")
Exemplo n.º 32
0
 def __init__(self, wizard, previous=None):
     logger.info('Entering step: %s' % self.__class__.__name__)
     self.wizard = wizard
     WizardStep.__init__(self, previous)
     GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
Exemplo n.º 33
0
 def __init__(self, employee):
     self.employee = employee
     GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
     self._setup_widgets()
Exemplo n.º 34
0
 def __init__(self, wizard, previous=None):
     logger.info('Entering step: %s' % self.__class__.__name__)
     self.wizard = wizard
     WizardStep.__init__(self, previous)
     GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
Exemplo n.º 35
0
 def __init__(self, previous=None, next=None, header=None, statusbar=None):
     WizardStep.__init__(self, previous, header)
     GladeSlaveDelegate.__init__(self, gladefile=self.gladefile)
     self.next = next
     self.statusbar = statusbar