button show after write
This commit is contained in:
parent
0cb9a4c542
commit
95ccc2c4df
@ -3171,6 +3171,7 @@ void Plater::priv::update_fff_scene()
|
||||
this->preview->reload_print();
|
||||
// In case this was MM print, wipe tower bounding box on 3D tab might need redrawing with exact depth:
|
||||
view3D->reload_scene(true);
|
||||
show_action_buttons(false);
|
||||
}
|
||||
|
||||
void Plater::priv::update_sla_scene()
|
||||
@ -4052,7 +4053,7 @@ void Plater::priv::show_action_buttons(const bool is_ready_to_slice) const
|
||||
if (sidebar->show_reslice(false) |
|
||||
sidebar->show_export(true) |
|
||||
sidebar->show_send(send_gcode_shown) |
|
||||
sidebar->show_disconnect(false/*disconnect_shown*/))
|
||||
sidebar->show_disconnect(disconnect_shown))
|
||||
sidebar->Layout();
|
||||
}
|
||||
else
|
||||
@ -4606,9 +4607,10 @@ void Plater::export_gcode()
|
||||
}
|
||||
if (! output_path.empty())
|
||||
{
|
||||
RemovableDriveManager::get_instance().update(0, true);
|
||||
RemovableDriveManager::get_instance().set_last_save_path(output_path.string());
|
||||
std::string path = output_path.string();
|
||||
p->export_gcode(std::move(output_path), PrintHostJob());
|
||||
RemovableDriveManager::get_instance().update(0, true);
|
||||
RemovableDriveManager::get_instance().set_last_save_path(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,9 +24,6 @@ GUID WceusbshGUID = { 0x25dbce51, 0x6c8f, 0x4a72,
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
//std::vector<DriveData> RemovableDriveManager::m_current_drives;
|
||||
//std::vector<std::function<void()>> RemovableDriveManager::m_callbacks;
|
||||
|
||||
|
||||
#if _WIN32
|
||||
INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
@ -42,7 +39,6 @@ void RemovableDriveManager::search_for_drives()
|
||||
std::string path (1,(char)('A' + i));
|
||||
path+=":";
|
||||
UINT drive_type = GetDriveTypeA(path.c_str());
|
||||
//std::cout << "found drive" << (char)('A' + i) << ": type:" <<driveType << "\n";
|
||||
if (drive_type == DRIVE_REMOVABLE)
|
||||
{
|
||||
// get name of drive
|
||||
@ -63,7 +59,6 @@ void RemovableDriveManager::search_for_drives()
|
||||
{
|
||||
ULARGE_INTEGER free_space;
|
||||
GetDiskFreeSpaceExA(path.c_str(), &free_space, NULL, NULL);
|
||||
//std::cout << std::string(volumeName.begin(), volumeName.end()) << " " << std::string(fileSystemName.begin(), fileSystemName.end()) << " " << freeSpace.QuadPart << "\n";
|
||||
if (free_space.QuadPart > 0)
|
||||
{
|
||||
path += "\\";
|
||||
@ -74,12 +69,9 @@ void RemovableDriveManager::search_for_drives()
|
||||
}
|
||||
}
|
||||
}
|
||||
//std::cout << "found drives:" << m_current_drives.size() << "\n";
|
||||
}
|
||||
void RemovableDriveManager::eject_drive(const std::string &path)
|
||||
{
|
||||
|
||||
//if (!update() || !is_drive_mounted(path))
|
||||
if(m_current_drives.empty())
|
||||
return;
|
||||
for (auto it = m_current_drives.begin(); it != m_current_drives.end(); ++it)
|
||||
@ -88,7 +80,6 @@ void RemovableDriveManager::eject_drive(const std::string &path)
|
||||
{
|
||||
std::string mpath = "\\\\.\\" + path;
|
||||
mpath = mpath.substr(0, mpath.size() - 1);
|
||||
//std::cout << "Ejecting " << mpath << "\n";
|
||||
HANDLE handle = CreateFileA(mpath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
@ -138,7 +129,7 @@ std::string RemovableDriveManager::get_drive_from_path(const std::string& path)
|
||||
}
|
||||
void RemovableDriveManager::register_window()
|
||||
{
|
||||
std::cout << "Registering for device notification\n";
|
||||
//creates new unvisible window that is recieving callbacks from system
|
||||
WNDCLASSEX wndClass;
|
||||
wndClass.cbSize = sizeof(WNDCLASSEX);
|
||||
wndClass.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
|
||||
@ -181,9 +172,6 @@ INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
||||
LRESULT lRet = 1;
|
||||
static HDEVNOTIFY hDeviceNotify;
|
||||
|
||||
static HWND hEditWnd;
|
||||
static ULONGLONG msgCount = 0;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
@ -194,11 +182,7 @@ INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
||||
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
|
||||
NotificationFilter.dbcc_classguid = WceusbshGUID;
|
||||
|
||||
hDeviceNotify = RegisterDeviceNotification(
|
||||
hWnd, // events recipient
|
||||
&NotificationFilter, // type of device
|
||||
DEVICE_NOTIFY_WINDOW_HANDLE // type of recipient handle
|
||||
);
|
||||
hDeviceNotify = RegisterDeviceNotification(hWnd, &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||
break;
|
||||
|
||||
case WM_DEVICECHANGE:
|
||||
@ -280,7 +264,6 @@ void RemovableDriveManager::search_for_drives()
|
||||
|
||||
}
|
||||
|
||||
//std::cout << "found drives:" <<m_current_drives.size() << "\n";
|
||||
#endif
|
||||
}
|
||||
void RemovableDriveManager::search_path(const std::string &path,const std::string &parent_path)
|
||||
@ -416,7 +399,7 @@ void RemovableDriveManager::init()
|
||||
#endif
|
||||
update();
|
||||
}
|
||||
bool RemovableDriveManager::update(const long time, bool check)
|
||||
bool RemovableDriveManager::update(const long time,const bool check)
|
||||
{
|
||||
if(time != 0) //time = 0 is forced update
|
||||
{
|
||||
@ -467,11 +450,8 @@ std::vector<DriveData> RemovableDriveManager::get_all_drives()
|
||||
}
|
||||
void RemovableDriveManager::check_and_notify()
|
||||
{
|
||||
//std::cout<<"drives count: "<<m_drives_count;
|
||||
if(m_drives_count != m_current_drives.size())
|
||||
{
|
||||
//m_rdmmm->log("drives count not same");
|
||||
//std::cout<<" vs "<< m_current_drives.size();
|
||||
if(m_callbacks.size() != 0 && m_drives_count > m_current_drives.size() && m_last_save_path != "" && !is_drive_mounted(m_last_save_path))
|
||||
{
|
||||
for (auto it = m_callbacks.begin(); it != m_callbacks.end(); ++it)
|
||||
@ -481,7 +461,6 @@ void RemovableDriveManager::check_and_notify()
|
||||
}
|
||||
m_drives_count = m_current_drives.size();
|
||||
}
|
||||
//std::cout<<"\n";
|
||||
}
|
||||
void RemovableDriveManager::add_callback(std::function<void()> callback)
|
||||
{
|
||||
@ -522,10 +501,4 @@ void RemovableDriveManager::reset_last_save_path()
|
||||
{
|
||||
m_last_save_path = "";
|
||||
}
|
||||
|
||||
void RemovableDriveManager::print()
|
||||
{
|
||||
//std::cout << "Removed Device: "<<(int)is_last_drive_removed()<<"\n";
|
||||
std::cout << "notified\n";
|
||||
}
|
||||
}}//namespace Slicer::Gui::
|
||||
}}//namespace Slicer::Gui
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
//update() searches for removable devices, returns false if empty.
|
||||
void init();
|
||||
bool update(const long time = 0, bool check = false); //time = 0 is forced update, time expects wxGetLocalTime()
|
||||
bool update(const long time = 0,const bool check = false); //time = 0 is forced update, time expects wxGetLocalTime()
|
||||
bool is_drive_mounted(const std::string &path);
|
||||
void eject_drive(const std::string &path);
|
||||
std::string get_last_save_path();
|
||||
@ -44,8 +44,6 @@ public:
|
||||
void set_last_save_path(const std::string &path);
|
||||
bool is_last_drive_removed();
|
||||
bool is_last_drive_removed_with_update(const long time = 0); // param as update()
|
||||
void print();
|
||||
|
||||
private:
|
||||
RemovableDriveManager();
|
||||
void search_for_drives();
|
||||
|
Loading…
Reference in New Issue
Block a user