def __init__(self, parent, screenshot_full, screenshot, pos): wx.Dialog.__init__(self, parent, -1, _('Submit Bug Report - Screenshot - Digsby')) self.SetFrameIcon(skin.get('appdefaults.taskbaricon')) # store both screenshots -- the one with blanked out areas, and the # full one self.big_screenshot_digsby = screenshot self.screenshot_digsby = pil_to_wxb_nocache(resize_screenshot(screenshot)) self.big_screenshot_full = screenshot_full self.screenshot_full = pil_to_wxb_nocache(resize_screenshot(screenshot_full)) self.screenshot = self.screenshot_digsby self.hide_non_digsby = True p = self.panel = wx.Panel(self) s = self.panel.Sizer = VSizer() s.Add((self.screenshot_full.Width, self.screenshot_full.Height + 20)) p.Bind(wx.EVT_PAINT, self.paint) hz = wx.BoxSizer(wx.HORIZONTAL) checkbox = wx.CheckBox(p, -1, _('Blank out non Digsby windows')) checkbox.SetValue(True) checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheckFullScreenShot) hz.Add(checkbox, 0, EXPAND) hz.AddStretchSpacer(1) hz.Add(StaticText(p, -1, _('Is it OK to send this screenshot to digsby.com?')), 0, EXPAND) s.Add(hz, 0, wx.BOTTOM | EXPAND, 7) send = Button(p, wx.ID_OK, _('OK')) send.SetDefault() cancel = Button(p, wx.ID_CANCEL, _('Cancel')) h = HSizer() h.AddStretchSpacer(1) h.AddMany([(send, 0, EXPAND | RIGHT, 10), (cancel, 0)]) s.Add(h, 0, EXPAND) s = self.Sizer = VSizer() s.Add(self.panel, 1, EXPAND | ALL, 8) self.Fit() self.SetPosition(pos)
def __init__(self, parent, screenshot_full, screenshot, pos): sc.SizedDialog.__init__(self, parent, -1, _('Submit Bug Report - Screenshot - Digsby')) self.SetFrameIcon(skin.get('appdefaults.taskbaricon')) # store both screenshots -- the one with blanked out areas, and the # full one self.big_screenshot_digsby = screenshot self.screenshot_digsby = pil_to_wxb_nocache( resize_screenshot(screenshot)) self.big_screenshot_full = screenshot_full self.screenshot_full = pil_to_wxb_nocache( resize_screenshot(screenshot_full)) self.screenshot = self.screenshot_digsby self.hide_non_digsby = True p = self.panel = self.GetContentsPane() screenshot_panel = sc.SizedPanel(self.panel, -1) screenshot_panel.SetMinSize( (self.screenshot_full.Width, self.screenshot_full.Height + 20)) screenshot_panel.Bind(wx.EVT_PAINT, self.paint) hpanel = sc.SizedPanel(self.panel, -1) hpanel.SetSizerType("horizontal") checkbox = wx.CheckBox(hpanel, -1, _('Blank out non Digsby windows')) checkbox.SetValue(True) checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheckFullScreenShot) checkbox.SetSizerProps(expand=True) stretchpanel = sc.SizedPanel(hpanel, -1) stretchpanel.SetSizerProps(expand=True, proportion=1) StaticText(hpanel, -1, _('Is it OK to send this screenshot to digsby.com?')) self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL)) self.Fit() self.SetPosition(pos)
def __init__(self, parent, screenshot_full, screenshot, pos): sc.SizedDialog.__init__(self, parent, -1, _('Submit Bug Report - Screenshot - Digsby')) self.SetFrameIcon(skin.get('appdefaults.taskbaricon')) # store both screenshots -- the one with blanked out areas, and the # full one self.big_screenshot_digsby = screenshot self.screenshot_digsby = pil_to_wxb_nocache(resize_screenshot(screenshot)) self.big_screenshot_full = screenshot_full self.screenshot_full = pil_to_wxb_nocache(resize_screenshot(screenshot_full)) self.screenshot = self.screenshot_digsby self.hide_non_digsby = True p = self.panel = self.GetContentsPane() screenshot_panel = sc.SizedPanel(self.panel, -1) screenshot_panel.SetMinSize((self.screenshot_full.Width, self.screenshot_full.Height + 20)) screenshot_panel.Bind(wx.EVT_PAINT, self.paint) hpanel = sc.SizedPanel(self.panel, -1) hpanel.SetSizerType("horizontal") checkbox = wx.CheckBox(hpanel, -1, _('Blank out non Digsby windows')) checkbox.SetValue(True) checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheckFullScreenShot) checkbox.SetSizerProps(expand=True) stretchpanel = sc.SizedPanel(hpanel, -1) stretchpanel.SetSizerProps(expand=True, proportion=1) StaticText(hpanel, -1, _('Is it OK to send this screenshot to digsby.com?')) self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL)) self.Fit() self.SetPosition(pos)
def resize_image_for_dialog(screenshot, maxsize=650): if isinstance(screenshot, wx.Bitmap): screenshot = wxb_to_pil_nocache(screenshot) w, h = screenshot.size img = screenshot if w > maxsize or h > maxsize: if w > h: new_height = int(h/float(w) * maxsize) img = img.resize((maxsize, new_height), BICUBIC if maxsize > w else ANTIALIAS) else: new_width = int(w/float(h) * maxsize) img = img.resize((new_width, maxsize), BICUBIC if maxsize > h else ANTIALIAS) return pil_to_wxb_nocache(img)
def resize_image_for_dialog(screenshot, maxsize=650): if isinstance(screenshot, wx.Bitmap): screenshot = wxb_to_pil_nocache(screenshot) w, h = screenshot.size img = screenshot if w > maxsize or h > maxsize: if w > h: new_height = int(h / float(w) * maxsize) img = img.resize((maxsize, new_height), BICUBIC if maxsize > w else ANTIALIAS) else: new_width = int(w / float(h) * maxsize) img = img.resize((new_width, maxsize), BICUBIC if maxsize > h else ANTIALIAS) return pil_to_wxb_nocache(img)