Esempio n. 1
0
 def OnOk(self, evt):
     # save the current entry & exit
     guiwidgets.save_size("CalendarEntryEditor", self.GetRect())
     if self.dirty:
         self.OnSaveButton(None)
     self.setdirty(False)
     evt.Skip()
	def saveSize(self):

        guiwidgets.save_size("AutoSyncSettingsDialog", self.GetRect())

	def SetAutoSyncTimer(self):

        self.auto_sync_timer.Stop()

        oneShot = True

        timeout=self.settings.sync_frequency*60000 

        if timeout:

            self.auto_sync_timer.Start(timeout, oneShot)

            self.Bind(wx.EVT_TIMER, self.OnTimer, self.auto_sync_timer)

	def OnTimer(self, event):

        self.mw.log("Auto Sync: Timed update")

        SyncSchedule(self.mw).sync(self.mw, silent=1)

        self.SetAutoSyncTimer()
 def OnOk(self, evt):
     # save the current entry & exit
     guiwidgets.save_size("CalendarEntryEditor", self.GetRect())
     if self.dirty:
         self.OnSaveButton(None)
     self.setdirty(False)
     evt.Skip()
 def ShowModal(self):
     i_w, i_h=self.image.GetSize()
     for v in self.targets:
         w,h=self.targets[v]['width'],self.targets[v]['height']
         if abs(i_w-w) < 5 and abs(i_h-h) < 5:
             self.skip=True
             return wx.ID_OK
     res=wx.Dialog.ShowModal(self)
     import guiwidgets
     guiwidgets.save_size("wallpaperpreview", self.GetRect())
     return res
Esempio n. 5
0
 def ShowModal(self):
     # see if the image size is already correct
     i_w, i_h = self.image.GetSize()
     for v in self.targets:
         w, h = self.targets[v]['width'], self.targets[v]['height']
         if abs(i_w - w) < 5 and abs(i_h - h) < 5:
             self.skip = True
             return wx.ID_OK
     res = wx.Dialog.ShowModal(self)
     import guiwidgets
     guiwidgets.save_size("wallpaperpreview", self.GetRect())
     return res
 def ShowModal(self):
     res=wx.Dialog.ShowModal(self)
     guiwidgets.save_size("wallpaperpreview", self.GetRect())
     return res
 def saveSize(self):
     guiwidgets.save_size("AutoSyncSettingsDialog", self.GetRect())
	def ShowModal(self):

        res=wx.Dialog.ShowModal(self)

        import guiwidgets

        guiwidgets.save_size("wallpaperpreview", self.GetRect())

        return res

	def SetZoom(self, evt):

        self.cropselect.SetZoom(self.SCALES[evt.GetPosition()][0])

        self.zoomlabel.SetLabel(self.SCALES[evt.GetPosition()][1])

        return

	def OnBackgroundColour(self, evt):

        self.cropselect.setlbcolour(evt.GetValue())

	def OnOriginSelect(self, _):

        v=self.originbox.GetStringSelection()

        assert v is not None

        t=self.targetbox.GetStringSelection()

        self.targets=self.phoneprofile.GetTargetsForImageOrigin(v)

        keys=self.targets.keys()

        keys.sort()

        self.targetbox.Set(keys)

        if t in keys:

            self.targetbox.SetSelection(keys.index(t))

        else:

            self.targetbox.SetSelection(0)

        self.OnTargetSelect(None)

	def OnTargetSelect(self, _):

        v=self.targetbox.GetStringSelection()

        print "target is",v

        w,h=self.targets[v]['width'],self.targets[v]['height']

        self.imagepreview.SetSize( (w,h) )

        self.cropselect.setresultsize( (w, h) )

        sz=self.GetSizer()

        if sz is not None:

            sz.Layout()

            self.Refresh(True)

	def GetResultImage(self):

        return self.imagepreview.bmp.ConvertToImage()

	def GetResultParams(self):

        return self.targets[self.targetbox.GetStringSelection()]

	def GetResultOrigin(self):

        return self.originbox.GetStringSelection()


if __name__=='__main__':

    if __debug__:

        def profile(filename, command):

            import hotshot, hotshot.stats, os

            file=os.path.abspath(filename)

            profile=hotshot.Profile(file)

            profile.run(command)

            profile.close()

            del profile

            howmany=100

            stats=hotshot.stats.load(file)

            stats.strip_dirs()

            stats.sort_stats('time', 'calls')

            stats.print_stats(100)

            stats.sort_stats('cum', 'calls')

            stats.print_stats(100)

            stats.sort_stats('calls', 'time')

            stats.print_stats(100)

            sys.exit(0)

    class FakeProfile:

        def GetImageOrigins(self):

            return {"images": {'description': 'General images'},
                    "mms": {'description': 'Multimedia Messages'},
                    "camera": {'description': 'Camera images'}}

        def GetTargetsForImageOrigin(self, origin):

            return {"wallpaper": {'width': 100, 'height': 200, 'description': 'Display as wallpaper'},
                    "photoid": {'width': 100, 'height': 150, 'description': 'Display as photo id'},
                    "outsidelcd": {'width': 90, 'height': 80, 'description': 'Display on outside screen'}}

    def run():

        app=wx.PySimpleApp()

        dlg=ImagePreviewDialog(None, wx.Image("test.jpg"), "foobar.png", FakeProfile())

        dlg.ShowModal()

    if __debug__ and True:

        profile("wp.prof", "run()")

    run()


import fileview

if __name__=='__main__':

    if __debug__:

        def profile(filename, command):

            import hotshot, hotshot.stats, os

            file=os.path.abspath(filename)

            profile=hotshot.Profile(file)

            profile.run(command)

            profile.close()

            del profile

            howmany=100

            stats=hotshot.stats.load(file)

            stats.strip_dirs()

            stats.sort_stats('time', 'calls')

            stats.print_stats(100)

            stats.sort_stats('cum', 'calls')

            stats.print_stats(100)

            stats.sort_stats('calls', 'time')

            stats.print_stats(100)

            sys.exit(0)

    class FakeProfile:

        def GetImageOrigins(self):

            return {"images": {'description': 'General images'},
                    "mms": {'description': 'Multimedia Messages'},
                    "camera": {'description': 'Camera images'}}

        def GetTargetsForImageOrigin(self, origin):

            return {"wallpaper": {'width': 100, 'height': 200, 'description': 'Display as wallpaper'},
                    "photoid": {'width': 100, 'height': 150, 'description': 'Display as photo id'},
                    "outsidelcd": {'width': 90, 'height': 80, 'description': 'Display on outside screen'}}

    def run():

        app=wx.PySimpleApp()

        dlg=ImagePreviewDialog(None, wx.Image("test.jpg"), "foobar.png", FakeProfile())

        dlg.ShowModal()

    if __debug__ and True:

        profile("wp.prof", "run()")

    run()
 def __save_size(self, evt):
     if self.__config_name is not None:
         guiwidgets.save_size(self.__config_name, self.GetRect())
     evt.Skip()
Esempio n. 10
0
 def __save_size(self, evt):
     if self.__config_name is not None:
         guiwidgets.save_size(self.__config_name, self.GetRect())
     evt.Skip()
Esempio n. 11
0
 def OnCancel(self, evt):
     # just exit
     guiwidgets.save_size("CalendarEntryEditor", self.GetRect())
     self.setdirty(False)
     evt.Skip()
Esempio n. 12
0
 def saveSize(self):
     guiwidgets.save_size("AutoSyncSettingsDialog", self.GetRect())
Esempio n. 13
0
 def OnCancel(self, evt):
     # just exit
     guiwidgets.save_size("CalendarEntryEditor", self.GetRect())
     self.setdirty(False)
     evt.Skip()