Esempio n. 1
0
 def __init__(self, statusIconMode=2):
     gtk.Window.__init__(self)##, gtk.WINDOW_POPUP) ## ????????????
     self.initVars()
     ud.windowList.appendItem(self)
     ui.mainWin = self
     ##################
     ## statusIconMode:
         ## ('none', 'none')
         ## ('statusIcon', 'normal')
         ## ('applet', 'gnome')
         ## ('applet', 'kde')
         ##
         ## 0: none (simple window)
         ## 1: applet
         ## 2: standard status icon
     self.statusIconMode = statusIconMode
     ###
     #ui.eventManDialog = None
     #ui.timeLineWin = None
     ###
     #ui.weekCalWin = WeekCalWindow()
     #ud.windowList.appendItem(ui.weekCalWin)
     ###
     self.dayInfoDialog = None
     #print('windowList.items', [item._name for item in ud.windowList.items])
     ###########
     ##self.connect('window-state-event', selfStateEvent)
     self.set_title('%s %s'%(core.APP_DESC, core.VERSION))
     #self.connect('main-show', lambda arg: self.present())
     #self.connect('main-hide', lambda arg: self.hide())
     self.set_decorated(False)
     self.set_property('skip-taskbar-hint', not ui.winTaskbar) ## self.set_skip_taskbar_hint  ## FIXME
     self.set_role('starcal2')
     #self.set_focus_on_map(True)#????????
     #self.set_type_hint(gdk.WINDOW_TYPE_HINT_NORMAL)
     #self.connect('realize', self.onRealize)
     self.set_default_size(ui.winWidth, 1)
     try:
         self.move(ui.winX, ui.winY)
     except:
         pass
     #############################################################
     self.connect('focus-in-event', self.focusIn, 'Main')
     self.connect('focus-out-event', self.focusOut, 'Main')
     self.connect('button-press-event', self.buttonPress)
     self.connect('key-press-event', self.keyPress)
     self.connect('configure-event', self.configureEvent)
     self.connect('destroy', self.quit)
     #############################################################
     """
     #self.add_events(gdk.VISIBILITY_NOTIFY_MASK)
     #self.connect('frame-event', show_event)
     ## Compiz does not send configure-event(or any event) when MOVING window(sends in last point,
     ## when moving completed)
     #self.connect('drag-motion', show_event)
     ud.rootWindow.set_events(...
     ud.rootWindow.add_filter(self.onRootWinEvent)
     #self.realize()
     #gdk.flush()
     #self.configureEvent(None, None)
     #self.connect('drag-motion', show_event)
     ######################
     ## ????????????????????????????????????????????????
     ## when button is down(before button-release-event), motion-notify-event does not recived!
     """
     ##################################################################
     self.focus = False
     #self.focusOutTime = 0
     #self.clockTr = None
     ############################################################################
     self.winCon = None
     ############
     self.vbox = MainWinVbox()
     ui.checkMainWinItems()
     itemsPkg = 'scal2.ui_gtk.mainwin_items'
     for (name, enable) in ui.mainWinItems:
         #print(name, enable)
         if enable:
             try:
                 module = __import__(
                     '.'.join([
                         itemsPkg,
                         name,
                     ]),
                     fromlist=['CalObj'],
                 )
                 CalObj = module.CalObj
             except:
                 myRaise()
                 continue
             item = CalObj()
             item.enable = enable
             item.connect('size-request', self.childSizeRequest) ## or item.connect
             #modify_bg_all(item, gtk.STATE_NORMAL, rgbToGdkColor(*ui.bgColor))
         else:
             desc = mainWinItemsDesc[name]
             item = DummyCalObj(name, desc, itemsPkg, True)
             ## what about size-request FIXME
         self.vbox.appendItem(item)
     self.appendItem(self.vbox)
     self.vbox.show()
     self.customizeDialog = None
     #######
     self.add(self.vbox)
     ####################
     self.isMaximized = False
     ####################
     #ui.prefDialog = None
     self.exportDialog = None
     self.selectDateDialog = None
     ############### Building About Dialog
     self.aboutDialog = None
     ###############
     self.menuMain = None
     #####
     check = gtk.CheckMenuItem(label=_('_On Top'))
     check.connect('activate', self.keepAboveClicked)
     check.set_active(ui.winKeepAbove)
     self.set_keep_above(ui.winKeepAbove)
     self.checkAbove = check
     #####
     check = gtk.CheckMenuItem(label=_('_Sticky'))
     check.connect('activate', self.stickyClicked)
     check.set_active(ui.winSticky)
     if ui.winSticky:
         self.stick()
     self.checkSticky = check
     ############################################################
     self.statusIconInit()
     listener.dateChange.add(self)
     #if self.statusIconMode!=1:
     #    gobject.timeout_add_seconds(self.timeout, self.statusIconUpdate)
     #########
     self.connect('delete-event', self.onDeleteEvent)
     #########################################
     for plug in core.allPlugList:
         if plug.external:
             try:
                 plug.set_dialog(self)
             except AttributeError:
                 pass
     ###########################
     self.onConfigChange()
Esempio n. 2
0
 def __init__(self, trayMode=2):
     gtk.Window.__init__(self)##, gtk.WINDOW_POPUP) ## ????????????
     self.initVars()
     ud.windowList.appendItem(self)
     ui.mainWin = self
     ##################
     ## trayMode:
         ## ('none', 'none')
         ## ('tray', 'normal')
         ## ('applet', 'gnome')
         ## ('applet', 'kde')
         ##
         ## 0: none (simple window)
         ## 1: applet
         ## 2: standard tray icon
     self.trayMode = trayMode
     ###
     ui.eventManDialog = EventManagerDialog()
     ###
     ui.timeLineWin = TimeLineWindow()
     ###
     #ui.weekCalWin = WeekCalWindow()
     #ud.windowList.appendItem(ui.weekCalWin)
     ###
     self.dayInfoDialog = DayInfoDialog()
     #print 'windowList.items', [item._name for item in ud.windowList.items]
     ###########
     ##self.connect('window-state-event', selfStateEvent)
     self.set_title('%s %s'%(core.APP_DESC, core.VERSION))
     #self.connect('main-show', lambda arg: self.present())
     #self.connect('main-hide', lambda arg: self.hide())
     self.set_decorated(False)
     self.set_property('skip-taskbar-hint', not ui.winTaskbar) ## self.set_skip_taskbar_hint  ## FIXME
     self.set_role('starcal2')
     #self.set_focus_on_map(True)#????????
     #self.set_type_hint(gdk.WINDOW_TYPE_HINT_NORMAL)
     #self.connect('realize', self.onRealize)
     self.set_default_size(ui.winWidth, 1)
     try:
         self.move(ui.winX, ui.winY)
     except:
         pass
     #############################################################
     self.connect('focus-in-event', self.focusIn, 'Main')
     self.connect('focus-out-event', self.focusOut, 'Main')
     self.connect('button-press-event', self.buttonPress)
     self.connect('key-press-event', self.keyPress)
     self.connect('configure-event', self.configureEvent)
     self.connect('destroy', self.quit)
     #############################################################
     """
     #self.add_events(gdk.VISIBILITY_NOTIFY_MASK)
     #self.connect('frame-event', show_event)
     ## Compiz does not send configure-event(or any event) when MOVING window(sends in last point,
     ## when moving completed)
     #self.connect('drag-motion', show_event)
     ud.rootWindow.set_events(...
     ud.rootWindow.add_filter(self.onRootWinEvent)
     #self.realize()
     #gdk.flush()
     #self.configureEvent(None, None)
     #self.connect('drag-motion', show_event)
     ######################
     ## ????????????????????????????????????????????????
     ## when button is down(before button-release-event), motion-notify-event does not recived!
     """
     ##################################################################
     self.focus = False
     #self.focusOutTime = 0
     #self.clockTr = None
     ############################################################################
     self.winCon = MainWinController()
     ############
     defaultItems = [
         self.winCon,
         MainWinToolbar(),
         YearMonthLabelBox(),
         MonthCal(),
         WeekCal(),
         StatusBox(),
         PluginsTextBox(),
         EventViewMainWinItem(),
     ]
     defaultItemsDict = dict([(obj._name, obj) for obj in defaultItems])
     ui.checkMainWinItems()
     self.vbox = MainWinVbox()
     for (name, enable) in ui.mainWinItems:
         #print name, enable
         try:
             item = defaultItemsDict[name]
         except:
             myRaise()
             continue
         item.enable = enable
         item.connect('size-request', self.childSizeRequest) ## or item.connect
         #modify_bg_all(item, gtk.STATE_NORMAL, rgbToGdkColor(*ui.bgColor))
         self.vbox.appendItem(item)
     self.appendItem(self.vbox)
     self.vbox.show()
     self.customizeDialog = CustomizeDialog(self.vbox)
     #######
     self.add(self.vbox)
     ####################
     self.isMaximized = False
     ####################
     ui.prefDialog = preferences.PrefDialog(self.trayMode)
     self.exportDialog = scal2.ui_gtk.export.ExportDialog()
     self.selectDateDialog = scal2.ui_gtk.selectdate.SelectDateDialog()
     self.selectDateDialog.connect('response-date', self.selectDateResponse)
     selectDateShow = self.selectDateShow
     ############### Building About Dialog
     about = AboutDialog(
         name=core.APP_DESC,
         version=core.VERSION,
         title=_('About ')+core.APP_DESC,
         authors=[_(line) for line in open(join(rootDir, 'authors-dialog')).read().splitlines()],
         comments=core.aboutText,
         license=core.licenseText,
         website=core.homePage,
     )
     ## add Donate button ## FIXME
     about.connect('delete-event', self.aboutHide)
     about.connect('response', self.aboutHide)
     #about.set_logo(gdk.pixbuf_new_from_file(ui.logo))
     #about.set_skip_taskbar_hint(True)
     self.about = about
     ########################################### Building main menu
     menu = gtk.Menu()
     ####
     item = gtk.ImageMenuItem(_('Resize'))
     item.set_image(imageFromFile('resize.png'))
     item.connect('button-press-event', self.startResize)
     menu.add(item)
     ####
     check = gtk.CheckMenuItem(label=_('_On Top'))
     check.connect('activate', self.keepAboveClicked)
     menu.add(check)
     check.set_active(ui.winKeepAbove)
     self.set_keep_above(ui.winKeepAbove)
     self.checkAbove = check
     #####
     check = gtk.CheckMenuItem(label=_('_Sticky'))
     check.connect('activate', self.stickyClicked)
     menu.add(check)
     check.set_active(ui.winSticky)
     if ui.winSticky:
         self.stick()
     self.checkSticky = check
     #####
     menu.add(labelStockMenuItem('Select _Today', gtk.STOCK_HOME, self.goToday))
     menu.add(labelStockMenuItem('Select _Date...', gtk.STOCK_INDEX, selectDateShow))
     menu.add(labelStockMenuItem('Day Info', gtk.STOCK_INFO, self.dayInfoShow))
     menu.add(labelStockMenuItem('_Customize', gtk.STOCK_EDIT, self.customizeShow))
     menu.add(labelStockMenuItem('_Preferences', gtk.STOCK_PREFERENCES, self.prefShow))
     #menu.add(labelStockMenuItem('_Add Event', gtk.STOCK_ADD, ui.eventManDialog.addCustomEvent))
     menu.add(labelStockMenuItem('_Event Manager', gtk.STOCK_ADD, self.eventManShow))
     menu.add(labelImageMenuItem('Time Line', 'timeline-18.png', self.timeLineShow))
     #menu.add(labelImageMenuItem('Week Calendar', 'weekcal-18.png', self.weekCalShow))
     menu.add(labelStockMenuItem(_('Export to %s')%'HTML', gtk.STOCK_CONVERT, self.exportClicked))
     menu.add(labelStockMenuItem('_About', gtk.STOCK_ABOUT, self.aboutShow))
     if self.trayMode!=1:
         menu.add(labelStockMenuItem('_Quit', gtk.STOCK_QUIT, self.quit))
     menu.show_all()
     self.menuMain = menu
     ############################################################
     self.trayInit()
     listener.dateChange.add(self)
     #if self.trayMode!=1:
     #    timeout_add_seconds(self.timeout, self.trayUpdate)
     #########
     self.connect('delete-event', self.dialogClose)
     ######################
     self.updateMenuSize()
     ui.prefDialog.updatePrefGui()
     self.clipboard = gtk.clipboard_get(gdk.SELECTION_CLIPBOARD)
     #########################################
     for plug in core.allPlugList:
         if plug.external and hasattr(plug, 'set_dialog'):
             plug.set_dialog(self)
     ###########################
     self.onConfigChange()
Esempio n. 3
0
    def __init__(self, statusIconMode=2):
        gtk.Window.__init__(self)  ##, gtk.WINDOW_POPUP) ## ????????????
        self.initVars()
        ud.windowList.appendItem(self)
        ui.mainWin = self
        ##################
        ## statusIconMode:
        ## ('none', 'none')
        ## ('statusIcon', 'normal')
        ## ('applet', 'gnome')
        ## ('applet', 'kde')
        ##
        ## 0: none (simple window)
        ## 1: applet
        ## 2: standard status icon
        self.statusIconMode = statusIconMode
        ###
        #ui.eventManDialog = None
        #ui.timeLineWin = None
        ###
        #ui.weekCalWin = WeekCalWindow()
        #ud.windowList.appendItem(ui.weekCalWin)
        ###
        self.dayInfoDialog = None
        #print('windowList.items', [item._name for item in ud.windowList.items])
        ###########
        ##self.connect('window-state-event', selfStateEvent)
        self.set_title('%s %s' % (core.APP_DESC, core.VERSION))
        #self.connect('main-show', lambda arg: self.present())
        #self.connect('main-hide', lambda arg: self.hide())
        self.set_decorated(False)
        self.set_property(
            'skip-taskbar-hint',
            not ui.winTaskbar)  ## self.set_skip_taskbar_hint  ## FIXME
        self.set_role('starcal2')
        #self.set_focus_on_map(True)#????????
        #self.set_type_hint(gdk.WINDOW_TYPE_HINT_NORMAL)
        #self.connect('realize', self.onRealize)
        self.set_default_size(ui.winWidth, 1)
        try:
            self.move(ui.winX, ui.winY)
        except:
            pass
        #############################################################
        self.connect('focus-in-event', self.focusIn, 'Main')
        self.connect('focus-out-event', self.focusOut, 'Main')
        self.connect('button-press-event', self.buttonPress)
        self.connect('key-press-event', self.keyPress)
        self.connect('configure-event', self.configureEvent)
        self.connect('destroy', self.quit)
        #############################################################
        """
		#self.add_events(gdk.VISIBILITY_NOTIFY_MASK)
		#self.connect('frame-event', show_event)
		## Compiz does not send configure-event(or any event) when MOVING window(sends in last point,
		## when moving completed)
		#self.connect('drag-motion', show_event)
		ud.rootWindow.set_events(...
		ud.rootWindow.add_filter(self.onRootWinEvent)
		#self.realize()
		#gdk.flush()
		#self.configureEvent(None, None)
		#self.connect('drag-motion', show_event)
		######################
		## ????????????????????????????????????????????????
		## when button is down(before button-release-event), motion-notify-event does not recived!
		"""
        ##################################################################
        self.focus = False
        #self.focusOutTime = 0
        #self.clockTr = None
        ############################################################################
        self.winCon = None
        ############
        self.vbox = MainWinVbox()
        ui.checkMainWinItems()
        itemsPkg = 'scal2.ui_gtk.mainwin_items'
        for (name, enable) in ui.mainWinItems:
            #print(name, enable)
            if enable:
                try:
                    module = __import__(
                        '.'.join([
                            itemsPkg,
                            name,
                        ]),
                        fromlist=['CalObj'],
                    )
                    CalObj = module.CalObj
                except:
                    myRaise()
                    continue
                item = CalObj()
                item.enable = enable
                item.connect('size-request',
                             self.childSizeRequest)  ## or item.connect
                #modify_bg_all(item, gtk.STATE_NORMAL, rgbToGdkColor(*ui.bgColor))
            else:
                desc = mainWinItemsDesc[name]
                item = DummyCalObj(name, desc, itemsPkg, True)
                ## what about size-request FIXME
            self.vbox.appendItem(item)
        self.appendItem(self.vbox)
        self.vbox.show()
        self.customizeDialog = None
        #######
        self.add(self.vbox)
        ####################
        if ui.winMaximized:
            self.maximize()
        ####################
        #ui.prefDialog = None
        self.exportDialog = None
        self.selectDateDialog = None
        ############### Building About Dialog
        self.aboutDialog = None
        ###############
        self.menuMain = None
        #####
        check = gtk.CheckMenuItem(label=_('_On Top'))
        check.connect('activate', self.keepAboveClicked)
        check.set_active(ui.winKeepAbove)
        self.set_keep_above(ui.winKeepAbove)
        self.checkAbove = check
        #####
        check = gtk.CheckMenuItem(label=_('_Sticky'))
        check.connect('activate', self.stickyClicked)
        check.set_active(ui.winSticky)
        if ui.winSticky:
            self.stick()
        self.checkSticky = check
        ############################################################
        self.statusIconInit()
        listener.dateChange.add(self)
        #if self.statusIconMode!=1:
        #	gobject.timeout_add_seconds(self.timeout, self.statusIconUpdate)
        #########
        self.connect('delete-event', self.onDeleteEvent)
        #########################################
        for plug in core.allPlugList:
            if plug.external:
                try:
                    plug.set_dialog(self)
                except AttributeError:
                    pass
        ###########################
        self.onConfigChange()