Ejemplo n.º 1
0
 def __init__(self, wcal):
     gtk.HBox.__init__(self)
     self.initVars()
     self.wcal = wcal
     self.updateCols()
     self.updateDir()
     self.show()
     #####
     optionsWidget = gtk.VBox()
     ##
     hbox = gtk.HBox()
     hbox.pack_start(gtk.Label(_('Width')), 0, 0)
     spin = IntSpinButton(0, 99)
     hbox.pack_start(spin, 0, 0)
     spin.set_value(ui.wcalDaysOfMonthColWidth)
     spin.connect('changed', self.widthSpinChanged)
     optionsWidget.pack_start(hbox, 0, 0)
     ##
     hbox = gtk.HBox()
     hbox.pack_start(gtk.Label(_('Direction')), 0, 0)
     combo = DirectionComboBox()
     hbox.pack_start(combo, 0, 0)
     combo.setValue(ui.wcalDaysOfMonthColDir)
     combo.connect('changed', self.dirComboChanged)
     optionsWidget.pack_start(hbox, 0, 0)
     ##
     optionsWidget.show_all()
     self.optionsWidget = optionsWidget
Ejemplo n.º 2
0
 def initVars(self, *a, **ka):
     CustomizableCalObj.initVars(self, *a, **ka)
     if not self.optionsWidget:
         self.optionsWidget = gtk.VBox()
     ####
     if self.customizeWidth:
         value = self.getWidthValue()
         self.setWidthWidget(value)
         ###
         hbox = gtk.HBox()
         pack(hbox, gtk.Label(_('Width')))
         spin = IntSpinButton(0, 999)
         pack(hbox, spin)
         spin.set_value(value)
         spin.connect('changed', self.widthSpinChanged)
         pack(self.optionsWidget, hbox)
     ####
     if self.customizeFont:
         hbox = gtk.HBox()
         pack(hbox, gtk.Label(_('Font Family')))
         combo = FontFamilyCombo(hasAuto=True)
         combo.set_value(self.getFontValue())
         pack(hbox, combo)
         combo.connect('changed', self.fontFamilyComboChanged)
         pack(self.optionsWidget, hbox)
     ####
     self.optionsWidget.show_all()
Ejemplo n.º 3
0
 def __init__(self):
     DayOccurrenceView.__init__(self)
     self.maxHeight = ui.eventViewMaxHeight
     self.optionsWidget = gtk.HBox()
     ###
     hbox = gtk.HBox()
     spin = IntSpinButton(1, 9999)
     spin.set_value(ui.eventViewMaxHeight)
     spin.connect('changed', self.heightSpinChanged)
     hbox.pack_start(gtk.Label(_('Maximum Height')), 0, 0)
     hbox.pack_start(spin, 0, 0)
     self.optionsWidget.pack_start(hbox, 0, 0)
     ###
     self.optionsWidget.show_all()
Ejemplo n.º 4
0
 def __init__(self):
     gtk.HBox.__init__(self)
     self.set_property('height-request', ui.wcalHeight)
     self.initVars()
     self.myKeys = (
         'up', 'down', 'page_up', 'page_down',
         'space', 'home', 'end',
         #'menu', 'f10', 'm',
     )
     self.connect('key-press-event', self.keyPress)
     self.connect('scroll-event', self.scroll)
     ###
     self.connect('button-press-event', self.buttonPress)
     #####
     defaultItems = [
         ToolbarColumn(self),
         WeekDaysColumn(self),
         PluginsTextColumn(self),
         EventsIconColumn(self),
         EventsTextColumn(self),
         DaysOfMonthColumnGroup(self),
     ]
     defaultItemsDict = dict([(item._name, item) for item in defaultItems])
     for name, enable in ui.wcalItems:
         try:
             item = defaultItemsDict[name]
         except KeyError:
             print 'weekCal item %s does not exist'%name
         else:
             item.enable = enable
             self.appendItem(item)
     #####
     optionsWidget = gtk.VBox()
     ##
     hbox = gtk.HBox()
     spin = IntSpinButton(1, 9999)
     spin.set_value(ui.wcalHeight)
     spin.connect('changed', self.heightSpinChanged)
     hbox.pack_start(gtk.Label(_('Height')), 0, 0)
     hbox.pack_start(spin, 0, 0)
     optionsWidget.pack_start(hbox, 0, 0)
     ###
     optionsWidget.show_all()
     self.optionsWidget = optionsWidget
     #####
     self.updateStatus()
     listener.dateChange.add(self)
Ejemplo n.º 5
0
 def __init__(self, wcal):
     Column.__init__(self, wcal)
     self.set_property('width-request', ui.wcalEventsIconColWidth)
     self.connect('expose-event', self.onExposeEvent)
     #####
     optionsWidget = gtk.VBox()
     ##
     hbox = gtk.HBox()
     hbox.pack_start(gtk.Label(_('Width')), 0, 0)
     spin = IntSpinButton(0, 99)
     hbox.pack_start(spin, 0, 0)
     spin.set_value(ui.wcalEventsIconColWidth)
     spin.connect('changed', self.widthSpinChanged)
     optionsWidget.pack_start(hbox, 0, 0)
     ##
     optionsWidget.show_all()
     self.optionsWidget = optionsWidget
Ejemplo n.º 6
0
class EventWidget(common.EventWidget):
    def __init__(self, event):## FIXME
        common.EventWidget.__init__(self, event)
        ######
        sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
        ######
        hbox = gtk.HBox()
        label = gtk.Label(_('Scale'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        self.scaleCombo = common.Scale10PowerComboBox()
        hbox.pack_start(self.scaleCombo, 0, 0)
        self.pack_start(hbox, 0, 0)
        ####
        hbox = gtk.HBox()
        label = gtk.Label(_('Start'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        self.startSpin = IntSpinButton(-maxStart, maxStart)
        self.startSpin.connect('changed', self.startSpinChanged)
        hbox.pack_start(self.startSpin, 0, 0)
        self.pack_start(hbox, 0, 0)
        ####
        hbox = gtk.HBox()
        self.endRelCombo = gtk.combo_box_new_text()
        for item in ('Duration', 'End'):
            self.endRelCombo.append_text(_(item))
        self.endRelCombo.connect('changed', self.endRelComboChanged)
        sizeGroup.add_widget(self.endRelCombo)
        hbox.pack_start(self.endRelCombo, 0, 0)
        self.endSpin = IntSpinButton(-maxDur, maxDur)
        hbox.pack_start(self.endSpin, 0, 0)
        self.pack_start(hbox, 0, 0)
        ####
        self.endRelComboChanged()
    def endRelComboChanged(self, combo=None):
        rel = self.endRelCombo.get_active()
        start = self.startSpin.get_value()
        end = self.endSpin.get_value()
        if rel==0:## reletive(duration)
            self.endSpin.set_range(1, maxStart)
            self.endSpin.set_value(max(1, end-start))
        elif rel==1:## absolute(end)
            self.endSpin.set_range(start+1, maxStart)
            self.endSpin.set_value(max(start+1, start+end))
    def startSpinChanged(self, spin=None):
        if self.endRelCombo.get_active() == 1:## absolute(end)
            self.endSpin.set_range(self.startSpin.get_value()+1, maxStart)
    def updateWidget(self):
        common.EventWidget.updateWidget(self)
        self.scaleCombo.set_value(self.event.scale)
        self.startSpin.set_value(self.event.start)
        self.endRelCombo.set_active(0 if self.event.endRel else 1)
        self.endSpin.set_value(self.event.end)
    def updateVars(self):## FIXME
        common.EventWidget.updateVars(self)
        self.event.scale = self.scaleCombo.get_value()
        self.event.start = self.startSpin.get_value()
        self.event.endRel = (self.endRelCombo.get_active()==0)
        self.event.end = self.endSpin.get_value()
Ejemplo n.º 7
0
 def __init__(self, shownCals=ui.shownCals):
     gtk.Widget.__init__(self)
     self.set_property('height-request', ui.mcalHeight)
     ######
     optionsWidget = gtk.VBox()
     ###
     hbox = gtk.HBox()
     spin = IntSpinButton(1, 9999)
     spin.set_value(ui.mcalHeight)
     spin.connect('changed', self.heightSpinChanged)
     hbox.pack_start(gtk.Label(_('Height')), 0, 0)
     hbox.pack_start(spin, 0, 0)
     optionsWidget.pack_start(hbox, 0, 0)
     ####
     hbox = gtk.HBox(spacing=3)
     ##
     hbox.pack_start(gtk.Label(_('Left Margin')), 0, 0)
     spin = IntSpinButton(0, 99)
     spin.set_value(ui.mcalLeftMargin)
     spin.connect('changed', self.leftMarginSpinChanged)
     hbox.pack_start(spin, 0, 0)
     ##
     hbox.pack_start(gtk.Label(_('Top')), 0, 0)
     spin = IntSpinButton(0, 99)
     spin.set_value(ui.mcalTopMargin)
     spin.connect('changed', self.topMarginSpinChanged)
     hbox.pack_start(spin, 0, 0)
     ##
     hbox.pack_start(gtk.Label(''), 1, 1)
     optionsWidget.pack_start(hbox, 0, 0)
     ####
     self.initVars(optionsWidget=optionsWidget)
     ######
     self.shownCals = shownCals
     ######################
     #self.kTime = 0
     ######################
     self.drag_source_set(gdk.MODIFIER_MASK,(('',0,0),),gdk.ACTION_COPY)
     self.drag_source_add_text_targets()
     self.connect('drag-data-get', self.dragDataGet)
     self.connect('drag-begin', self.dragBegin)
     self.connect('drag-data-received', self.dragDataRec)
     self.drag_dest_set(
         gdk.MODIFIER_MASK,
         (
             ('', 0, 0),
             ('application/x-color', 0, 0),
         ),
         gdk.ACTION_COPY,
     )
     self.drag_dest_add_text_targets()
     self.drag_dest_add_uri_targets()
     """
     ## ACTION_MOVE ?????????????????????
     ## if source ACTION was ACTION_COPY, calendar recieves its own dragged day
     ## just like gnome-calendar-applet (but it seems not a logical behaviar)
     #self.drag_source_add_uri_targets()#???????
     ##self.connect('drag-end', self.dragCalEnd)
     ##self.connect('drag-drop', self.dragCalDrop)
     ##self.connect('drag-failed', self.dragCalFailed)
     #self.connect('drag-leave', self.dragLeave)
     """
     ######################
     self.connect('expose-event', self.drawAll)
     self.connect('button-press-event', self.buttonPress)
     #self.connect('screen-changed', self.screenChanged)
     self.myKeys = (
         'up', 'down',
         'right', 'left',
         'page_up', 'page_down',
         'space', 'home', 'end',
         'menu', 'f10', 'm',
     )
     self.connect('key-press-event', self.keyPress)
     self.connect('scroll-event', self.scroll)
     ######################
     self.updateTextWidth()
     ######################
     listener.dateChange.add(self)
Ejemplo n.º 8
0
class CustomizableToolbar(gtk.Toolbar, CustomizableCalObj):
    _name = 'toolbar'
    desc = _('Toolbar')
    styleList = ('Icon', 'Text', 'Text below Icon', 'Text beside Icon')
    defaultItems = []
    defaultItemsDict = {}
    def __init__(self, funcOwner, vertical=False, onPressContinue=False):
        gtk.Toolbar.__init__(self)
        self.funcOwner = funcOwner
        self.set_orientation(gtk.ORIENTATION_VERTICAL if vertical else gtk.ORIENTATION_HORIZONTAL)
        self.add_events(gdk.POINTER_MOTION_MASK)
        self.onPressContinue = onPressContinue
        ###
        optionsWidget = gtk.VBox()
        ##
        hbox = gtk.HBox()
        hbox.pack_start(gtk.Label(_('Style')), 0, 0)
        self.styleCombo = gtk.combo_box_new_text()
        for item in self.styleList:
            self.styleCombo.append_text(_(item))
        hbox.pack_start(self.styleCombo, 0, 0)
        optionsWidget.pack_start(hbox, 0, 0)
        ##
        hbox = gtk.HBox()
        hbox.pack_start(gtk.Label(_('Icon Size')), 0, 0)
        self.iconSizeCombo = gtk.combo_box_new_text()
        for (i, item) in enumerate(iconSizeList):
            self.iconSizeCombo.append_text(_(item[0]))
        hbox.pack_start(self.iconSizeCombo, 0, 0)
        optionsWidget.pack_start(hbox, 0, 0)
        self.iconSizeHbox = hbox
        ##
        hbox = gtk.HBox()
        hbox.pack_start(gtk.Label(_('Buttons Border')), 0, 0)
        self.buttonsBorderSpin = IntSpinButton(0, 99)
        hbox.pack_start(self.buttonsBorderSpin, 0, 0)
        optionsWidget.pack_start(hbox, 0, 0)
        ##
        self.initVars(optionsWidget=optionsWidget)
        self.iconSizeCombo.connect('changed', self.iconSizeComboChanged)
        self.styleCombo.connect('changed', self.styleComboChanged)
        self.buttonsBorderSpin.connect('changed', self.buttonsBorderSpinChanged)
        #self.styleComboChanged()
        ##
        #print 'toolbar state', self.get_state()## STATE_NORMAL
        #self.set_state(gtk.STATE_ACTIVE)## FIXME
        #self.set_property('border-width', 0)
        #style = self.get_style()
        #style.border_width = 10
        #self.set_style(style)
    getIconSizeName = lambda self: iconSizeList[self.iconSizeCombo.get_active()][0]
    setIconSizeName = lambda self, size_name: self.set_icon_size(iconSizeDict[size_name])
    ## gtk.Toolbar.set_icon_size was previously Deprecated, but it's not Deprecated now!!
    def setButtonsBorder(self, bb):
        for item in self.items:
            item.set_border_width(bb)
    def iconSizeComboChanged(self, combo=None):
        self.setIconSizeName(self.getIconSizeName())
    def styleComboChanged(self, combo=None):
        style = self.styleCombo.get_active()
        self.set_style(style)
        #self.showHideWidgets()## FIXME
        self.iconSizeHbox.set_sensitive(style!=1)
    def buttonsBorderSpinChanged(self, spin=None):
        self.setButtonsBorder(self.buttonsBorderSpin.get_value())
    def moveItemUp(self, i):
        button = self.items[i]
        self.remove(button)
        self.insert(button, i-1)
        self.items.insert(i-1, self.items.pop(i))
    #def insertItem(self, item, pos):
    #    CustomizableCalObj.insertItem(self, pos, item)
    #    gtk.Toolbar.insert(self, item, pos)
    #    item.show()
    def appendItem(self, item):
        CustomizableCalObj.appendItem(self, item)
        gtk.Toolbar.insert(self, item, -1)
        if item.enable:
            item.show()
    def getData(self):
        return {
            'items': self.getItemsData(),
            'iconSize': self.getIconSizeName(),
            'style': self.styleList[self.styleCombo.get_active()],
            'buttonsBorder': self.buttonsBorderSpin.get_value(),
        }
    def setupItemSignals(self, item):
        if item.method:
            func = getattr(self.funcOwner, item.method)
            if self.onPressContinue:
                item.child.connect('button-press-event', lambda obj, ev: self.itemPress(func))
                item.child.connect('button-release-event', self.itemRelease)
            else:
                item.connect('clicked', func)
    def setData(self, data):
        for (name, enable) in data['items']:
            try:
                item = self.defaultItemsDict[name]
            except KeyError:
                myRaise()
            else:
                item.enable = enable
                self.setupItemSignals(item)
                self.appendItem(item)
        ###
        iconSize = data['iconSize']
        for (i, item) in enumerate(iconSizeList):
            if item[0]==iconSize:
                self.iconSizeCombo.set_active(i)
        self.setIconSizeName(iconSize)
        ###
        styleNum = self.styleList.index(data['style'])
        self.styleCombo.set_active(styleNum)
        self.set_style(styleNum)
        ###
        bb = data.get('buttonsBorder', 0)
        self.buttonsBorderSpin.set_value(bb)
        self.setButtonsBorder(bb)
        ###
    def itemPress(self, func):
        self.lastPressTime = time()
        self.remain = True
        func()
        timeout_add(ui.timeout_initial, self.itemPressRemain, func)
    def itemPressRemain(self, func):
        if self.remain and time()-self.lastPressTime>=ui.timeout_repeat/1000.0:
            func()
            timeout_add(ui.timeout_repeat, self.itemPressRemain, func)
    def itemRelease(self, widget, event=None):
        self.remain = False
Ejemplo n.º 9
0
 def __init__(self):
     gtk.HBox.__init__(self)
     CalBase.__init__(self)
     self.set_property('height-request', ui.wcalHeight)
     ######################
     self.connect('scroll-event', self.scroll)
     ###
     self.connect('button-press-event', self.buttonPress)
     #####
     defaultItems = [
         ToolbarColumn(self),
         WeekDaysColumn(self),
         PluginsTextColumn(self),
         EventsIconColumn(self),
         EventsCountColumn(self),
         EventsTextColumn(self),
         EventsBoxColumn(self),
         DaysOfMonthColumnGroup(self),
     ]
     defaultItemsDict = dict([(item._name, item) for item in defaultItems])
     itemNames = defaultItemsDict.keys()
     for name, enable in ui.wcalItems:
         try:
             item = defaultItemsDict[name]
         except KeyError:
             print('weekCal item %s does not exist'%name)
         else:
             item.enable = enable
             self.appendItem(item)
             itemNames.remove(name)
     for name in itemNames:
         item = defaultItemsDict[name]
         item.enable = False
         self.appendItem(item)
     #####
     hbox = gtk.HBox()
     spin = IntSpinButton(1, 9999)
     spin.set_value(ui.wcalHeight)
     spin.connect('changed', self.heightSpinChanged)
     pack(hbox, gtk.Label(_('Height')))
     pack(hbox, spin)
     pack(self.optionsWidget, hbox)
     ###
     hbox = gtk.HBox()
     spin = FloatSpinButton(0.01, 1, 2)
     spin.set_value(ui.wcalTextSizeScale)
     spin.connect('changed', self.textSizeScaleSpinChanged)
     pack(hbox, gtk.Label(_('Text Size Scale')))
     pack(hbox, spin)
     pack(self.optionsWidget, hbox)
     ########
     hbox = gtk.HBox(spacing=3)
     ####
     item = CheckPrefItem(ui, 'wcalGrid', _('Grid'))
     item.updateWidget()
     gridCheck = item._widget
     pack(hbox, gridCheck)
     gridCheck.item = item
     ####
     colorItem = ColorPrefItem(ui, 'wcalGridColor', True)
     colorItem.updateWidget()
     pack(hbox, colorItem._widget)
     gridCheck.colorb = colorItem._widget
     gridCheck.connect('clicked', self.gridCheckClicked)
     colorItem._widget.item = colorItem
     colorItem._widget.connect('color-set', self.gridColorChanged)
     colorItem._widget.set_sensitive(ui.wcalGrid)
     ####
     pack(self.optionsWidget, hbox)
     ###
     self.optionsWidget.show_all()
Ejemplo n.º 10
0
 def __init__(self):
     gtk.Widget.__init__(self)
     CalBase.__init__(self)
     self.set_property('height-request', ui.mcalHeight)
     ######
     hbox = gtk.HBox()
     spin = IntSpinButton(1, 9999)
     spin.set_value(ui.mcalHeight)
     spin.connect('changed', self.heightSpinChanged)
     pack(hbox, gtk.Label(_('Height')))
     pack(hbox, spin)
     pack(self.optionsWidget, hbox)
     ####
     hbox = gtk.HBox(spacing=3)
     ##
     pack(hbox, gtk.Label(_('Left Margin')))
     spin = IntSpinButton(0, 99)
     spin.set_value(ui.mcalLeftMargin)
     spin.connect('changed', self.leftMarginSpinChanged)
     pack(hbox, spin)
     ##
     pack(hbox, gtk.Label(_('Top')))
     spin = IntSpinButton(0, 99)
     spin.set_value(ui.mcalTopMargin)
     spin.connect('changed', self.topMarginSpinChanged)
     pack(hbox, spin)
     ##
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self.optionsWidget, hbox)
     ########
     hbox = gtk.HBox(spacing=3)
     ####
     item = CheckPrefItem(ui, 'mcalGrid', _('Grid'))
     item.updateWidget()
     gridCheck = item._widget
     pack(hbox, gridCheck)
     gridCheck.item = item
     ####
     colorItem = ColorPrefItem(ui, 'mcalGridColor', True)
     colorItem.updateWidget()
     pack(hbox, colorItem._widget)
     gridCheck.colorb = colorItem._widget
     gridCheck.connect('clicked', self.gridCheckClicked)
     colorItem._widget.item = colorItem
     colorItem._widget.connect('color-set', self.gridColorChanged)
     colorItem._widget.set_sensitive(ui.mcalGrid)
     ####
     pack(self.optionsWidget, hbox)
     ########
     frame = gtk.Frame(_('Calendars'))
     self.typeParamsVbox = gtk.VBox()
     frame.add(self.typeParamsVbox)
     frame.show_all()
     pack(self.optionsWidget, frame)
     self.optionsWidget.show_all()
     self.updateTypeParamsWidget()## FIXME
     ######################
     #self.kTime = 0
     ######################
     self.connect('expose-event', self.drawAll)
     self.connect('button-press-event', self.buttonPress)
     #self.connect('screen-changed', self.screenChanged)
     self.connect('scroll-event', self.scroll)
     ######################
     self.updateTextWidth()