コード例 #1
0
ファイル: X2MergeDialog.py プロジェクト: dob71/Printrun
 def OnSave(self, e):
     self.settings.colorOn = self.extOnTc.GetValue()
     self.settings.colorOff = self.extOffTc.GetValue()
     self.settings.basePenGcode = self.baseTc.GetValue()
     self.settings.insPenGcode = self.insTc.GetValue()
     self.settings.perlCmd = self.perlExeTc.GetValue()
     self.set("colorOn", self.settings.colorOn)
     self.set("colorOff", self.settings.colorOff)
     self.set("basePenGcode", self.settings.basePenGcode)
     self.set("insPenGcode", self.settings.insPenGcode)
     self.set("perlCmd", self.settings.perlCmd)
     altpath = archive.getSettingsPath('alterations')
     if (re.search("penultimate[^/\\\]*$", self.settings.basePenGcode) != None):
         mixed = re.sub("penultimate([^/\\\\]*)$", "mixed\\1", self.settings.basePenGcode)
     else:
         mixed = re.sub("(\\.[^\\./\\\\]*)$", "_mixed.g", self.settings.basePenGcode)
     if (mixed == None):
         mixed = "mixed.g"
     cmd = self.settings.perlCmd + " '"  + self.settings.basePenGcode + "' '" +  self.settings.insPenGcode + \
           "' '" + altpath + "\\" + self.settings.colorOn + "' '" + altpath + "\\" + self.settings.colorOff + "'"
     try:
         out=open(mixed,"w")
         out.write("")
     except IOError,x:
         print str(x)
         self.EndModal(2)
         self.Destroy()
         return
コード例 #2
0
    def __init__(self, *args, **kwds):
        printrun.pronsole.pronsole.__init__(self)

        kwds[
            "style"] = wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
        wx.Dialog.__init__(self, *args, **kwds)
        self.okButton = wx.Button(self, wx.ID_OK, "Generate and Load")
        self.cancelButton = wx.Button(self, wx.ID_CANCEL, "Cancel")
        self.Bind(wx.EVT_BUTTON, self.OnExit, self.cancelButton)
        self.Bind(wx.EVT_BUTTON, self.OnSave, self.okButton)

        self.scrollbarPanel = wx.ScrolledWindow(self,
                                                -1,
                                                style=wx.TAB_TRAVERSAL)
        self.browseButton1 = wx.Button(self.scrollbarPanel,
                                       wx.ID_ANY,
                                       "...",
                                       name='base')
        self.browseButton2 = wx.Button(self.scrollbarPanel,
                                       wx.ID_ANY,
                                       "...",
                                       name='ins')
        self.Bind(wx.EVT_BUTTON, self.onBrowse, self.browseButton1)
        self.Bind(wx.EVT_BUTTON, self.onBrowse, self.browseButton2)

        self.settings.colorOn = ''
        self.settings.colorOff = ''
        self.settings.basePenGcode = 'base_penultimate.g'
        self.settings.insPenGcode = 'insert_penutimate.g'
        self.mixedGcode = None
        self.load_default_rc(".x2mergerc")

        self.altpath = archive.getSettingsPath('alterations')
        self.altfiles = []
        for (dirpath, dirnames, filenames) in os.walk(self.altpath):
            self.altfiles.extend([
                elem for elem in filenames
                if 'on' in elem.lower() or 'off' in elem.lower()
            ])
            break
        if len(self.settings.colorOn) == 0 and len(self.altfiles) > 1:
            self.settings.colorOn = self.altfiles[1]
        if len(self.settings.colorOff) == 0 and len(self.altfiles) > 0:
            self.settings.colorOff = self.altfiles[0]

        self.__set_properties()
        self.__do_layout()

        self.Center()
        self.Show()
コード例 #3
0
ファイル: X2MergeDialog.py プロジェクト: CNCBASHER/x2swn
 def OnSave(self, e):
     self.settings.colorOn = self.extOnTc.GetValue()
     self.settings.colorOff = self.extOffTc.GetValue()
     self.settings.basePenGcode = self.baseTc.GetValue()
     self.settings.insPenGcode = self.insTc.GetValue()
     self.set("colorOn", self.settings.colorOn)
     self.set("colorOff", self.settings.colorOff)
     self.set("basePenGcode", self.settings.basePenGcode)
     self.set("insPenGcode", self.settings.insPenGcode)
     self.altpath = archive.getSettingsPath('alterations')
     mixed = self.outFileTc.GetValue()
     try:
         out=open(mixed,"w+")
         out.write("")
     except IOError,x:
         print str(x)
         self.EndModal(2)
         self.Destroy()
         return
コード例 #4
0
ファイル: X2MergeDialog.py プロジェクト: dob71/x2swn
    def __init__(self, *args, **kwds):
        printrun.pronsole.pronsole.__init__(self)

        kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
        wx.Dialog.__init__(self, *args, **kwds)
        self.okButton = wx.Button(self, wx.ID_OK, "Generate and Load")
        self.cancelButton = wx.Button(self, wx.ID_CANCEL, "Cancel")
        self.Bind(wx.EVT_BUTTON, self.OnExit, self.cancelButton)
        self.Bind(wx.EVT_BUTTON, self.OnSave, self.okButton)

        self.scrollbarPanel = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
        self.browseButton1 = wx.Button(self.scrollbarPanel, wx.ID_ANY, "...", name = 'base')
        self.browseButton2 = wx.Button(self.scrollbarPanel, wx.ID_ANY, "...", name = 'ins')
        self.Bind(wx.EVT_BUTTON, self.onBrowse, self.browseButton1)
        self.Bind(wx.EVT_BUTTON, self.onBrowse, self.browseButton2)
        
        self.settings.colorOn = ''
        self.settings.colorOff = ''
        self.settings.basePenGcode = 'base_penultimate.g'
        self.settings.insPenGcode = 'insert_penutimate.g'
        self.mixedGcode = None
        self.load_default_rc(".x2mergerc")

        self.altpath = archive.getSettingsPath('alterations')
        self.altfiles = []
        for (dirpath, dirnames, filenames) in os.walk(self.altpath):
            self.altfiles.extend([elem for elem in filenames if 'on' in elem.lower() or 'off' in elem.lower()])
            break
        if len(self.settings.colorOn) == 0 and len(self.altfiles) > 1:
            self.settings.colorOn = self.altfiles[1]
        if len(self.settings.colorOff) == 0 and len(self.altfiles) > 0:
            self.settings.colorOff = self.altfiles[0]

        self.__set_properties()   
        self.__do_layout()        

        self.Center()
        self.Show()